aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/panic.c
diff options
context:
space:
mode:
authorSimon Kagstrom <simon.kagstrom@netinsight.net>2009-10-16 08:09:18 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-11-30 07:01:49 -0500
commit456b565cc52fbcdaa2e19ffdf40d9dd3b726d603 (patch)
treec73029f31756289ed54183e97e0613f87cef6ed5 /kernel/panic.c
parent7cb777a3d71f9d1f7eb149c7a504d21f24219ae8 (diff)
core: Add kernel message dumper to call on oopses and panics
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 <simon.kagstrom@netinsight.net> Reviewed-by: Anders Grafstrom <anders.grafstrom@netinsight.net> Reviewed-by: Linus Torvalds <torvalds@linux-foundation.org> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'kernel/panic.c')
-rw-r--r--kernel/panic.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/panic.c b/kernel/panic.c
index bcdef26e3332..8c43226a544d 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -10,6 +10,7 @@
10 */ 10 */
11#include <linux/debug_locks.h> 11#include <linux/debug_locks.h>
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/kmsg_dump.h>
13#include <linux/kallsyms.h> 14#include <linux/kallsyms.h>
14#include <linux/notifier.h> 15#include <linux/notifier.h>
15#include <linux/module.h> 16#include <linux/module.h>
@@ -74,6 +75,7 @@ NORET_TYPE void panic(const char * fmt, ...)
74 dump_stack(); 75 dump_stack();
75#endif 76#endif
76 77
78 kmsg_dump(KMSG_DUMP_PANIC);
77 /* 79 /*
78 * If we have crashed and we have a crash kernel loaded let it handle 80 * If we have crashed and we have a crash kernel loaded let it handle
79 * everything else. 81 * everything else.
@@ -338,6 +340,7 @@ void oops_exit(void)
338{ 340{
339 do_oops_enter_exit(); 341 do_oops_enter_exit();
340 print_oops_end_marker(); 342 print_oops_end_marker();
343 kmsg_dump(KMSG_DUMP_OOPS);
341} 344}
342 345
343#ifdef WANT_WARN_ON_SLOWPATH 346#ifdef WANT_WARN_ON_SLOWPATH