diff options
Diffstat (limited to 'kernel/panic.c')
| -rw-r--r-- | kernel/panic.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/kernel/panic.c b/kernel/panic.c index cf80672b7924..4d8d6f906dec 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
| @@ -33,6 +33,7 @@ static int pause_on_oops; | |||
| 33 | static int pause_on_oops_flag; | 33 | static int pause_on_oops_flag; |
| 34 | static DEFINE_SPINLOCK(pause_on_oops_lock); | 34 | static DEFINE_SPINLOCK(pause_on_oops_lock); |
| 35 | static bool crash_kexec_post_notifiers; | 35 | static bool crash_kexec_post_notifiers; |
| 36 | int panic_on_warn __read_mostly; | ||
| 36 | 37 | ||
| 37 | int panic_timeout = CONFIG_PANIC_TIMEOUT; | 38 | int panic_timeout = CONFIG_PANIC_TIMEOUT; |
| 38 | EXPORT_SYMBOL_GPL(panic_timeout); | 39 | EXPORT_SYMBOL_GPL(panic_timeout); |
| @@ -428,6 +429,17 @@ static void warn_slowpath_common(const char *file, int line, void *caller, | |||
| 428 | if (args) | 429 | if (args) |
| 429 | vprintk(args->fmt, args->args); | 430 | vprintk(args->fmt, args->args); |
| 430 | 431 | ||
| 432 | if (panic_on_warn) { | ||
| 433 | /* | ||
| 434 | * This thread may hit another WARN() in the panic path. | ||
| 435 | * Resetting this prevents additional WARN() from panicking the | ||
| 436 | * system on this thread. Other threads are blocked by the | ||
| 437 | * panic_mutex in panic(). | ||
| 438 | */ | ||
| 439 | panic_on_warn = 0; | ||
| 440 | panic("panic_on_warn set ...\n"); | ||
| 441 | } | ||
| 442 | |||
| 431 | print_modules(); | 443 | print_modules(); |
| 432 | dump_stack(); | 444 | dump_stack(); |
| 433 | print_oops_end_marker(); | 445 | print_oops_end_marker(); |
| @@ -485,6 +497,7 @@ EXPORT_SYMBOL(__stack_chk_fail); | |||
| 485 | 497 | ||
| 486 | core_param(panic, panic_timeout, int, 0644); | 498 | core_param(panic, panic_timeout, int, 0644); |
| 487 | core_param(pause_on_oops, pause_on_oops, int, 0644); | 499 | core_param(pause_on_oops, pause_on_oops, int, 0644); |
| 500 | core_param(panic_on_warn, panic_on_warn, int, 0644); | ||
| 488 | 501 | ||
| 489 | static int __init setup_crash_kexec_post_notifiers(char *s) | 502 | static int __init setup_crash_kexec_post_notifiers(char *s) |
| 490 | { | 503 | { |
