diff options
Diffstat (limited to 'kernel/panic.c')
-rw-r--r-- | kernel/panic.c | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/kernel/panic.c b/kernel/panic.c index d96469de72dc..fa400852bf6c 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/nmi.h> | 25 | #include <linux/nmi.h> |
26 | #include <linux/console.h> | 26 | #include <linux/console.h> |
27 | #include <linux/bug.h> | ||
27 | 28 | ||
28 | #define PANIC_TIMER_STEP 100 | 29 | #define PANIC_TIMER_STEP 100 |
29 | #define PANIC_BLINK_SPD 18 | 30 | #define PANIC_BLINK_SPD 18 |
@@ -449,20 +450,25 @@ void oops_exit(void) | |||
449 | kmsg_dump(KMSG_DUMP_OOPS); | 450 | kmsg_dump(KMSG_DUMP_OOPS); |
450 | } | 451 | } |
451 | 452 | ||
452 | #ifdef WANT_WARN_ON_SLOWPATH | 453 | struct warn_args { |
453 | struct slowpath_args { | ||
454 | const char *fmt; | 454 | const char *fmt; |
455 | va_list args; | 455 | va_list args; |
456 | }; | 456 | }; |
457 | 457 | ||
458 | static void warn_slowpath_common(const char *file, int line, void *caller, | 458 | void __warn(const char *file, int line, void *caller, unsigned taint, |
459 | unsigned taint, struct slowpath_args *args) | 459 | struct pt_regs *regs, struct warn_args *args) |
460 | { | 460 | { |
461 | disable_trace_on_warning(); | 461 | disable_trace_on_warning(); |
462 | 462 | ||
463 | pr_warn("------------[ cut here ]------------\n"); | 463 | pr_warn("------------[ cut here ]------------\n"); |
464 | pr_warn("WARNING: CPU: %d PID: %d at %s:%d %pS()\n", | 464 | |
465 | raw_smp_processor_id(), current->pid, file, line, caller); | 465 | if (file) |
466 | pr_warn("WARNING: CPU: %d PID: %d at %s:%d %pS\n", | ||
467 | raw_smp_processor_id(), current->pid, file, line, | ||
468 | caller); | ||
469 | else | ||
470 | pr_warn("WARNING: CPU: %d PID: %d at %pS\n", | ||
471 | raw_smp_processor_id(), current->pid, caller); | ||
466 | 472 | ||
467 | if (args) | 473 | if (args) |
468 | vprintk(args->fmt, args->args); | 474 | vprintk(args->fmt, args->args); |
@@ -479,20 +485,27 @@ static void warn_slowpath_common(const char *file, int line, void *caller, | |||
479 | } | 485 | } |
480 | 486 | ||
481 | print_modules(); | 487 | print_modules(); |
482 | dump_stack(); | 488 | |
489 | if (regs) | ||
490 | show_regs(regs); | ||
491 | else | ||
492 | dump_stack(); | ||
493 | |||
483 | print_oops_end_marker(); | 494 | print_oops_end_marker(); |
495 | |||
484 | /* Just a warning, don't kill lockdep. */ | 496 | /* Just a warning, don't kill lockdep. */ |
485 | add_taint(taint, LOCKDEP_STILL_OK); | 497 | add_taint(taint, LOCKDEP_STILL_OK); |
486 | } | 498 | } |
487 | 499 | ||
500 | #ifdef WANT_WARN_ON_SLOWPATH | ||
488 | void warn_slowpath_fmt(const char *file, int line, const char *fmt, ...) | 501 | void warn_slowpath_fmt(const char *file, int line, const char *fmt, ...) |
489 | { | 502 | { |
490 | struct slowpath_args args; | 503 | struct warn_args args; |
491 | 504 | ||
492 | args.fmt = fmt; | 505 | args.fmt = fmt; |
493 | va_start(args.args, fmt); | 506 | va_start(args.args, fmt); |
494 | warn_slowpath_common(file, line, __builtin_return_address(0), | 507 | __warn(file, line, __builtin_return_address(0), TAINT_WARN, NULL, |
495 | TAINT_WARN, &args); | 508 | &args); |
496 | va_end(args.args); | 509 | va_end(args.args); |
497 | } | 510 | } |
498 | EXPORT_SYMBOL(warn_slowpath_fmt); | 511 | EXPORT_SYMBOL(warn_slowpath_fmt); |
@@ -500,20 +513,18 @@ EXPORT_SYMBOL(warn_slowpath_fmt); | |||
500 | void warn_slowpath_fmt_taint(const char *file, int line, | 513 | void warn_slowpath_fmt_taint(const char *file, int line, |
501 | unsigned taint, const char *fmt, ...) | 514 | unsigned taint, const char *fmt, ...) |
502 | { | 515 | { |
503 | struct slowpath_args args; | 516 | struct warn_args args; |
504 | 517 | ||
505 | args.fmt = fmt; | 518 | args.fmt = fmt; |
506 | va_start(args.args, fmt); | 519 | va_start(args.args, fmt); |
507 | warn_slowpath_common(file, line, __builtin_return_address(0), | 520 | __warn(file, line, __builtin_return_address(0), taint, NULL, &args); |
508 | taint, &args); | ||
509 | va_end(args.args); | 521 | va_end(args.args); |
510 | } | 522 | } |
511 | EXPORT_SYMBOL(warn_slowpath_fmt_taint); | 523 | EXPORT_SYMBOL(warn_slowpath_fmt_taint); |
512 | 524 | ||
513 | void warn_slowpath_null(const char *file, int line) | 525 | void warn_slowpath_null(const char *file, int line) |
514 | { | 526 | { |
515 | warn_slowpath_common(file, line, __builtin_return_address(0), | 527 | __warn(file, line, __builtin_return_address(0), TAINT_WARN, NULL, NULL); |
516 | TAINT_WARN, NULL); | ||
517 | } | 528 | } |
518 | EXPORT_SYMBOL(warn_slowpath_null); | 529 | EXPORT_SYMBOL(warn_slowpath_null); |
519 | #endif | 530 | #endif |