diff options
Diffstat (limited to 'kernel/panic.c')
| -rw-r--r-- | kernel/panic.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/kernel/panic.c b/kernel/panic.c index f6d549a29a5c..f121e6ba7e11 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/kmsg_dump.h> | 14 | #include <linux/kmsg_dump.h> |
| 15 | #include <linux/kallsyms.h> | 15 | #include <linux/kallsyms.h> |
| 16 | #include <linux/notifier.h> | 16 | #include <linux/notifier.h> |
| 17 | #include <linux/vt_kern.h> | ||
| 17 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| 18 | #include <linux/random.h> | 19 | #include <linux/random.h> |
| 19 | #include <linux/ftrace.h> | 20 | #include <linux/ftrace.h> |
| @@ -45,6 +46,13 @@ int panic_on_warn __read_mostly; | |||
| 45 | int panic_timeout = CONFIG_PANIC_TIMEOUT; | 46 | int panic_timeout = CONFIG_PANIC_TIMEOUT; |
| 46 | EXPORT_SYMBOL_GPL(panic_timeout); | 47 | EXPORT_SYMBOL_GPL(panic_timeout); |
| 47 | 48 | ||
| 49 | #define PANIC_PRINT_TASK_INFO 0x00000001 | ||
| 50 | #define PANIC_PRINT_MEM_INFO 0x00000002 | ||
| 51 | #define PANIC_PRINT_TIMER_INFO 0x00000004 | ||
| 52 | #define PANIC_PRINT_LOCK_INFO 0x00000008 | ||
| 53 | #define PANIC_PRINT_FTRACE_INFO 0x00000010 | ||
| 54 | unsigned long panic_print; | ||
| 55 | |||
| 48 | ATOMIC_NOTIFIER_HEAD(panic_notifier_list); | 56 | ATOMIC_NOTIFIER_HEAD(panic_notifier_list); |
| 49 | 57 | ||
| 50 | EXPORT_SYMBOL(panic_notifier_list); | 58 | EXPORT_SYMBOL(panic_notifier_list); |
| @@ -124,6 +132,24 @@ void nmi_panic(struct pt_regs *regs, const char *msg) | |||
| 124 | } | 132 | } |
| 125 | EXPORT_SYMBOL(nmi_panic); | 133 | EXPORT_SYMBOL(nmi_panic); |
| 126 | 134 | ||
| 135 | static void panic_print_sys_info(void) | ||
| 136 | { | ||
| 137 | if (panic_print & PANIC_PRINT_TASK_INFO) | ||
| 138 | show_state(); | ||
| 139 | |||
| 140 | if (panic_print & PANIC_PRINT_MEM_INFO) | ||
| 141 | show_mem(0, NULL); | ||
| 142 | |||
| 143 | if (panic_print & PANIC_PRINT_TIMER_INFO) | ||
| 144 | sysrq_timer_list_show(); | ||
| 145 | |||
| 146 | if (panic_print & PANIC_PRINT_LOCK_INFO) | ||
| 147 | debug_show_all_locks(); | ||
| 148 | |||
| 149 | if (panic_print & PANIC_PRINT_FTRACE_INFO) | ||
| 150 | ftrace_dump(DUMP_ALL); | ||
| 151 | } | ||
| 152 | |||
| 127 | /** | 153 | /** |
| 128 | * panic - halt the system | 154 | * panic - halt the system |
| 129 | * @fmt: The text string to print | 155 | * @fmt: The text string to print |
| @@ -237,7 +263,10 @@ void panic(const char *fmt, ...) | |||
| 237 | if (_crash_kexec_post_notifiers) | 263 | if (_crash_kexec_post_notifiers) |
| 238 | __crash_kexec(NULL); | 264 | __crash_kexec(NULL); |
| 239 | 265 | ||
| 240 | bust_spinlocks(0); | 266 | #ifdef CONFIG_VT |
| 267 | unblank_screen(); | ||
| 268 | #endif | ||
| 269 | console_unblank(); | ||
| 241 | 270 | ||
| 242 | /* | 271 | /* |
| 243 | * We may have ended up stopping the CPU holding the lock (in | 272 | * We may have ended up stopping the CPU holding the lock (in |
| @@ -250,6 +279,8 @@ void panic(const char *fmt, ...) | |||
| 250 | debug_locks_off(); | 279 | debug_locks_off(); |
| 251 | console_flush_on_panic(); | 280 | console_flush_on_panic(); |
| 252 | 281 | ||
| 282 | panic_print_sys_info(); | ||
| 283 | |||
| 253 | if (!panic_blink) | 284 | if (!panic_blink) |
| 254 | panic_blink = no_blink; | 285 | panic_blink = no_blink; |
| 255 | 286 | ||
| @@ -654,6 +685,7 @@ void refcount_error_report(struct pt_regs *regs, const char *err) | |||
| 654 | #endif | 685 | #endif |
| 655 | 686 | ||
| 656 | core_param(panic, panic_timeout, int, 0644); | 687 | core_param(panic, panic_timeout, int, 0644); |
| 688 | core_param(panic_print, panic_print, ulong, 0644); | ||
| 657 | core_param(pause_on_oops, pause_on_oops, int, 0644); | 689 | core_param(pause_on_oops, pause_on_oops, int, 0644); |
| 658 | core_param(panic_on_warn, panic_on_warn, int, 0644); | 690 | core_param(panic_on_warn, panic_on_warn, int, 0644); |
| 659 | core_param(crash_kexec_post_notifiers, crash_kexec_post_notifiers, bool, 0644); | 691 | core_param(crash_kexec_post_notifiers, crash_kexec_post_notifiers, bool, 0644); |
