kdumpst-load/config: Add option to use crashkernel as pstore/ram memory

Currently kdumpst only allows a proper RAM buffer to be used as ramoops
memory area - this is the proper way of doing that, but there are cases
in which it's not trivial to have these buffers available:

(a) In case it's not there by default (due to kernel alignment / device-tree)
for example, there is no easy parameter to reserve such area right now
(using mem= is the way to go, but a bit complex to gather the exact size).

(b) The kernel parameter crashkernel= does something like this: reserve
a piece of memory not to be used by the kernel. It's meant for kdump, but
can be (ab)used for other purposes.

So, we hereby add a way for kdumpst to make use of crash reserved area
if the users wish so; the risks are exposed in the config file text.

Also, since we're changing this code, take the opportunity to improve the
sanitization of addresses from /proc/iomem and fix a corner case of empty
RANGE in the iomem parsing routine.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
This commit is contained in:
Guilherme G. Piccoli
2023-12-23 12:03:00 -05:00
parent acd5a64652
commit 63345d21a7
2 changed files with 17 additions and 3 deletions

View File

@ -16,9 +16,15 @@
# relies in having an available RAM buffer on /proc/iomem with at least
# PSTORE_MEM_AMOUNT (decimal, in MB) in size. Also, kernel must be able to
# allocate a contiguous memory amount of PSTORE_RECORD_SZ (decimal, MB).
# If there is no such RAM buffer, there is a possibility to make use of
# the crash kernel area for that. There are risks: such memory area could
# have its address mapped differently across kernel updates; also if both
# pstore and the kdump kernel are loaded, that memory region will be for
# sure corrupted by the kexec panic load - so, kind of a last resource.
USE_PSTORE_RAM=1
PSTORE_MEM_AMOUNT=4194304
PSTORE_RECORD_SZ=1048576
PSTORE_RAM_USE_CRASH_MEM=0
#
#
# Mount-related options