aboutsummaryrefslogtreecommitdiff
path: root/include/linux/kmsg_dump.h
AgeCommit message (Collapse)AuthorFilesLines
2020-05-30printk: Introduce kmsg_dump_reason_str()Kees Cook1-0/+7
The pstore subsystem already had a private version of this function. With the coming addition of the pstore/zone driver, this needs to be shared. As it really should live with printk, move it there instead. Link: https://lore.kernel.org/lkml/[email protected]/ Acked-by: Petr Mladek <[email protected]> Acked-by: Sergey Senozhatsky <[email protected]> Reviewed-by: Pavel Tatashin <[email protected]> Signed-off-by: Kees Cook <[email protected]>
2020-05-30printk: honor the max_reason field in kmsg_dumperPavel Tatashin1-0/+1
kmsg_dump() allows to dump kmesg buffer for various system events: oops, panic, reboot, etc. It provides an interface to register a callback call for clients, and in that callback interface there is a field "max_reason", but it was getting ignored when set to any "reason" higher than KMSG_DUMP_OOPS unless "always_kmsg_dump" was passed as kernel parameter. Allow clients to actually control their "max_reason", and keep the current behavior when "max_reason" is not set. Signed-off-by: Pavel Tatashin <[email protected]> Link: https://lore.kernel.org/lkml/[email protected]/ Reviewed-by: Petr Mladek <[email protected]> Signed-off-by: Kees Cook <[email protected]>
2020-05-30printk: Collapse shutdown types into a single dump reasonKees Cook1-3/+1
To turn the KMSG_DUMP_* reasons into a more ordered list, collapse the redundant KMSG_DUMP_(RESTART|HALT|POWEROFF) reasons into KMSG_DUMP_SHUTDOWN. The current users already don't meaningfully distinguish between them, so there's no need to, as discussed here: https://lore.kernel.org/lkml/CA+CK2bAPv5u1ih5y9t5FUnTyximtFCtDYXJCpuyjOyHNOkRdqw@mail.gmail.com/ Link: https://lore.kernel.org/lkml/[email protected]/ Reviewed-by: Pavel Tatashin <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Acked-by: Michael Ellerman <[email protected]> (powerpc) Signed-off-by: Kees Cook <[email protected]>
2012-07-21printk: Implement some unlocked kmsg_dump functionsAnton Vorontsov1-0/+16
If used from KDB, the locked variants are prone to deadlocks (suppose we got to the debugger w/ the logbuf lock held). So, we have to implement a few routines that grab no logbuf lock. Yet we don't need these functions in modules, so we don't export them. Signed-off-by: Anton Vorontsov <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2012-06-18kmsg - kmsg_dump() fix CONFIG_PRINTK=n compilationKay Sievers1-5/+5
Signed-off-by: Kay Sievers <[email protected]> Cc: Stephen Rothwell <[email protected]> Reported-by: Randy Dunlap <[email protected]> Reported-by: Fengguang Wu <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-06-15kmsg - kmsg_dump() use iterator to receive log buffer contentKay Sievers1-7/+38
Provide an iterator to receive the log buffer content, and convert all kmsg_dump() users to it. The structured data in the kmsg buffer now contains binary data, which should no longer be copied verbatim to the kmsg_dump() users. The iterator should provide reliable access to the buffer data, and also supports proper log line-aware chunking of data while iterating. Signed-off-by: Kay Sievers <[email protected]> Tested-by: Tony Luck <[email protected]> Reported-by: Anton Vorontsov <[email protected]> Tested-by: Anton Vorontsov <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-03-05kmsg_dump: don't run on non-error paths by defaultMatthew Garrett1-2/+7
Since commit 04c6862c055f ("kmsg_dump: add kmsg_dump() calls to the reboot, halt, poweroff and emergency_restart paths"), kmsg_dump() gets run on normal paths including poweroff and reboot. This is less than ideal given pstore implementations that can only represent single backtraces, since a reboot may overwrite a stored oops before it's been picked up by userspace. In addition, some pstore backends may have low performance and provide a significant delay in reboot as a result. This patch adds a printk.always_kmsg_dump kernel parameter (which can also be changed from userspace). Without it, the code will only be run on failure paths rather than on normal paths. The option can be enabled in environments where there's a desire to attempt to audit whether or not a reboot was cleanly requested or not. Signed-off-by: Matthew Garrett <[email protected]> Acked-by: Seiji Aguchi <[email protected]> Cc: Seiji Aguchi <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Marco Stornelli <[email protected]> Cc: Artem Bityutskiy <[email protected]> Cc: KOSAKI Motohiro <[email protected]> Cc: Vivek Goyal <[email protected]> Cc: Don Zickus <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2012-01-12kexec: remove KMSG_DUMP_KEXECWANG Cong1-1/+0
KMSG_DUMP_KEXEC is useless because we already save kernel messages inside /proc/vmcore, and it is unsafe to allow modules to do other stuffs in a crash dump scenario. [[email protected]: fix powerpc build] Signed-off-by: WANG Cong <[email protected]> Reported-by: Vivek Goyal <[email protected]> Acked-by: Vivek Goyal <[email protected]> Acked-by: Jarod Wilson <[email protected]> Cc: "Eric W. Biederman" <[email protected]> Cc: KOSAKI Motohiro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2011-06-15kmsg_dump.h: fix build when CONFIG_PRINTK is disabledRandy Dunlap1-0/+1
Fix <linux/kmsg_dump.h> when CONFIG_PRINTK is not enabled: include/linux/kmsg_dump.h:56: error: 'EINVAL' undeclared (first use in this function) include/linux/kmsg_dump.h:61: error: 'EINVAL' undeclared (first use in this function) Looks like commit 595dd3d8bf95 ("kmsg_dump: fix build for CONFIG_PRINTK=n") uses EINVAL without having the needed header file(s), but I'm sure that I build tested that patch also. oh well. Signed-off-by: Randy Dunlap <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2011-01-13kmsg_dump: add kmsg_dump() calls to the reboot, halt, poweroff and ↵Seiji Aguchi1-0/+4
emergency_restart paths We need to know the reason why system rebooted in support service. However, we can't inform our customers of the reason because final messages are lost on current Linux kernel. This patch improves the situation above because the final messages are saved by adding kmsg_dump() to reboot, halt, poweroff and emergency_restart path. Signed-off-by: Seiji Aguchi <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Marco Stornelli <[email protected]> Reviewed-by: Artem Bityutskiy <[email protected]> Reviewed-by: KOSAKI Motohiro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2009-12-31kmsg_dump: Dump on crash_kexec as wellKOSAKI Motohiro1-0/+1
crash_kexec gets called before kmsg_dump(KMSG_DUMP_OOPS) if panic_on_oops is set, so the kernel log buffer is not stored for this case. This patch adds a KMSG_DUMP_KEXEC dump type which gets called when crash_kexec() is invoked. To avoid getting double dumps, the old KMSG_DUMP_PANIC is moved below crash_kexec(). The mtdoops driver is modified to handle KMSG_DUMP_KEXEC in the same way as a panic. Signed-off-by: KOSAKI Motohiro <[email protected]> Acked-by: Simon Kagstrom <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2009-12-02kmsg_dump: fix build for CONFIG_PRINTK=nRandy Dunlap1-0/+16
kmsg_dump() fails to build when CONFIG_PRINTK=n; provide stubs for the kmsg_dump*() functions when CONFIG_PRINTK=n. kernel/printk.c: In function 'kmsg_dump': kernel/printk.c:1501: error: 'log_buf_len' undeclared (first use in this function) kernel/printk.c:1502: error: 'logged_chars' undeclared (first use in this function) kernel/printk.c:1506: error: 'log_buf' undeclared (first use in this function) Signed-off-by: Randy Dunlap <[email protected]> Acked-by: Simon Kagstrom <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2009-11-30core: Add kernel message dumper to call on oopses and panicsSimon Kagstrom1-0/+44
The core functionality is implemented as per Linus suggestion from http://lists.infradead.org/pipermail/linux-mtd/2009-October/027620.html (with the kmsg_dump implementation by Linus). A struct kmsg_dumper has been added which contains a callback to dump the kernel log buffers on crashes. The kmsg_dump function gets called from oops_exit() and panic() and invokes this callbacks with the crash reason. [dwmw2: Fix log_end handling] Signed-off-by: Simon Kagstrom <[email protected]> Reviewed-by: Anders Grafstrom <[email protected]> Reviewed-by: Linus Torvalds <[email protected]> Acked-by: Ingo Molnar <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]> Signed-off-by: David Woodhouse <[email protected]>