pstore/ram: Introduce max_reason and convert dump_oops
Now that pstore_register() can correctly pass max_reason to the kmesg dump facility, introduce a new "max_reason" module parameter and "max-reason" Device Tree field. The "dump_oops" module parameter and "dump-oops" Device Tree field are now considered deprecated, but are now automatically converted to their corresponding max_reason values when present, though the new max_reason setting has precedence. For struct ramoops_platform_data, the "dump_oops" member is entirely replaced by a new "max_reason" member, with the only existing user updated in place. Additionally remove the "reason" filter logic from ramoops_pstore_write(), as that is not specifically needed anymore, though technically this is a change in behavior for any ramoops users also setting the printk.always_kmsg_dump boot param, which will cause ramoops to behave as if max_reason was set to KMSG_DUMP_MAX. Co-developed-by: Pavel Tatashin <pasha.tatashin@soleen.com> Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com> Link: https://lore.kernel.org/lkml/20200515184434.8470-6-keescook@chromium.org/ Signed-off-by: Kees Cook <keescook@chromium.org>
This commit is contained in:
@@ -32,11 +32,17 @@ memory to be mapped strongly ordered, and atomic operations on strongly ordered
|
||||
memory are implementation defined, and won't work on many ARMs such as omaps.
|
||||
|
||||
The memory area is divided into ``record_size`` chunks (also rounded down to
|
||||
power of two) and each oops/panic writes a ``record_size`` chunk of
|
||||
power of two) and each kmesg dump writes a ``record_size`` chunk of
|
||||
information.
|
||||
|
||||
Dumping both oopses and panics can be done by setting 1 in the ``dump_oops``
|
||||
variable while setting 0 in that variable dumps only the panics.
|
||||
Limiting which kinds of kmsg dumps are stored can be controlled via
|
||||
the ``max_reason`` value, as defined in include/linux/kmsg_dump.h's
|
||||
``enum kmsg_dump_reason``. For example, to store both Oopses and Panics,
|
||||
``max_reason`` should be set to 2 (KMSG_DUMP_OOPS), to store only Panics
|
||||
``max_reason`` should be set to 1 (KMSG_DUMP_PANIC). Setting this to 0
|
||||
(KMSG_DUMP_UNDEF), means the reason filtering will be controlled by the
|
||||
``printk.always_kmsg_dump`` boot param: if unset, it'll be KMSG_DUMP_OOPS,
|
||||
otherwise KMSG_DUMP_MAX.
|
||||
|
||||
The module uses a counter to record multiple dumps but the counter gets reset
|
||||
on restart (i.e. new dumps after the restart will overwrite old ones).
|
||||
@@ -90,7 +96,7 @@ Setting the ramoops parameters can be done in several different manners:
|
||||
.mem_address = <...>,
|
||||
.mem_type = <...>,
|
||||
.record_size = <...>,
|
||||
.dump_oops = <...>,
|
||||
.max_reason = <...>,
|
||||
.ecc = <...>,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user