-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Please enable CONFIG_PSTORE for ramoops support #5063
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I started to look at this before starting the weekend early. My intention is to build the pstore support as a module, with an overlay to reserve the memory and cause the module to be loaded, but the first attempt crashed and burned - probably because of a change in the base DTBs since 2017 making them incompatible with @notro's overlay. I'll have another look if I get a moment. |
Thank you for working on this. |
Building ramoops and pstore as modules running on a 3B (what I happened to have connected and booted):
and with them built-in:
That's quite a difference in terms of the point at which ramoops becomes usable. In terms of memory usage, the built-in version takes up an extra 16kB when not in use (i.e. how much are we "taxing" the millions of users who will never use ramoops), which isn't great - I'm not decided yet. The awkward aspect of the ramoops mechanism is that the memory buffer must be declared with an explicit address as well as the size, which could make it tricky to create a single, simple overlay to work with all configurations. An alternative would be to give each base DTB file a disabled ramoops declaration, with a dtoverlay to enable it. This is more work, but more likely to give a satisfactory result. |
That's enabled now - see cf28d57 and eda0160. In the end, the fixed address blob seems to work OK, although I did add a parameter to allow it to be moved. The Pi 4 family required a modified overlay because |
See: raspberrypi/linux#4151 kernel: media: i2c: imx477: Enable sensor temperature readout See: raspberrypi/linux#5067 kernel: configs: Enable pstore and ramoops as built-ins kernel: overlays: Add the ramoops overlay See: raspberrypi/linux#5063 kernel: configs: Enable the MAX7300/7301 GPIO expanders
Latest rpi-update kernel contains this feature |
See: raspberrypi/linux#4151 kernel: media: i2c: imx477: Enable sensor temperature readout See: raspberrypi/linux#5067 kernel: configs: Enable pstore and ramoops as built-ins kernel: overlays: Add the ramoops overlay See: raspberrypi/linux#5063 kernel: configs: Enable the MAX7300/7301 GPIO expanders
Thank you so much! I'm using this with the following snippet in config.txt: Please note that the settings in /etc/sysctl.d/98-rpi.conf may need to be adjusted to capture all relevant dmesg data after setting sysctls. (Specifically, kernel.printk needs 7 as first number.) An alternative would be to add "max-reason" to the dts which allows configuring this filter without spamming the console. Oh, and if you want somewhat reliable logging of previous dmesg, do not use systemd-pstore. The first (cold) boot will be logged correctly, but any subsequent reboots will only have the last line of dmesg available because systemd clears the pstore at the wrong time. |
There is also an ecc parameter which enables automatic error correction in case some bits flip in RAM during reboot/reset. Not a requirement for me, but I thought I'd mention it in case someone ever wants to find all related info in one place. The good thing about the additional dts parameters ("max-reason" and "ecc") is that they don't need a kernel recompile. |
OK to close? |
Yes. Thank you! |
Describe the bug
CONFIG_PSTORE=y allows storing messages in a RAM buffer which survives reboot/reset/watchdog.
Together with CONFIG_PSTORE_CONSOLE=y (kernel messages in that RAM buffer) and CONFIG_PSTORE_RAM=y (Oops/Panic messages in that RAM buffer) most of the relevant info before a crash/hang can survive a reboot.
As a nice bonus, enabling CONFIG_PSTORE_DEFLATE_COMPRESS=y will compress the data before storing it, making more efficient use of the 10 kBytes set aside for this purpose.
This helps a lot if you want to debug kernel crashes/hangs without a serial console attached.
Steps to reproduce the behaviour
The full Howto is here https://forums.raspberrypi.com/viewtopic.php?t=199047
Device (s)
Raspberry Pi 4 Mod. B
System
pi@raspberrypi:~ $ cat /etc/rpi-issue
Raspberry Pi reference 2022-04-04
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 27a8050c3c06e567c794620394a8c2d74262a516, stage4
pi@raspberrypi:~ $ vcgencmd version
Mar 24 2022 13:19:26
Copyright (c) 2012 Broadcom
version e5a963efa66a1974127860b42e913d2374139ff5 (clean) (release) (start)
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.15.32-v8+ #1538 SMP PREEMPT Thu Mar 31 19:40:39 BST 2022 aarch64 GNU/Linux
Logs
No response
Additional context
Thanks!
The text was updated successfully, but these errors were encountered: