History

[PATCH] Fix up panic messages for different NMI panics

When a unknown NMI happened the panic would claim a NMI watchdog timeout. Also it would check the variable set by nmi_watchdog=panic and panic then. Fix up the panic message to be generic Unconditionally panic on unknown NMI when panic on unknown nmi is enabled. Noticed by Jan Beulich Cc: jbeulich@novell.com

Andi Kleen committed 20 years ago

Commit fac58551 parent 4038f903 files · +7 −7Browse files

Unified · Split

3 files
  1. arch/x86_64/kernel/nmi.c +3 −2
  2. arch/x86_64/kernel/traps.c +3 −4
  3. include/asm-x86_64/nmi.h +1 −1
arch/x86_64/kernel/nmi.c+3−2
@@ -695,7 +695,8 @@ int __kprobes nmi_watchdog_tick(struct pt_regs * regs, unsigned reason) · 694 unmodified lines
695695 */
696696 local_inc(&__get_cpu_var(alert_counter));
697697 if (local_read(&__get_cpu_var(alert_counter)) == 5*nmi_hz)
698− die_nmi("NMI Watchdog detected LOCKUP on CPU %d\n", regs);
698+ die_nmi("NMI Watchdog detected LOCKUP on CPU %d\n", regs,
699+ panic_on_timeout);
699700 } else {
700701 __get_cpu_var(last_irq_sum) = sum;
701702 local_set(&__get_cpu_var(alert_counter), 0);
@@ -765,7 +766,7 @@ static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu) · 63 unmodified lines
765766 char buf[64];
766767
767768 sprintf(buf, "NMI received for unknown reason %02x\n", reason);
768− die_nmi(buf,regs);
769+ die_nmi(buf, regs, 1); /* Always panic here */
769770 return 0;
770771 }
771772
arch/x86_64/kernel/traps.c+3−4
@@ -570,7 +570,7 @@ void die(const char * str, struct pt_regs * regs, long err) · 569 unmodified lines
570570 do_exit(SIGSEGV);
571571 }
572572
573−void __kprobes die_nmi(char *str, struct pt_regs *regs)
573+void __kprobes die_nmi(char *str, struct pt_regs *regs, int do_panic)
574574 {
575575 unsigned long flags = oops_begin();
576576
@@ -582,9 +582,8 @@ void __kprobes die_nmi(char *str, struct pt_regs *regs) · 5 unmodified lines
582582 show_registers(regs);
583583 if (kexec_should_crash(current))
584584 crash_kexec(regs);
585− if (panic_on_timeout || panic_on_oops)
586− panic("nmi watchdog");
587− printk("console shuts up ...\n");
585+ if (do_panic || panic_on_oops)
586+ panic("Non maskable interrupt");
588587 oops_end(flags);
589588 nmi_exit();
590589 local_irq_enable();
include/asm-x86_64/nmi.h+1−1
@@ -37,7 +37,7 @@ static inline void unset_nmi_pm_callback(struct pm_dev * dev) · 36 unmodified lines
3737 #endif /* CONFIG_PM */
3838
3939 extern void default_do_nmi(struct pt_regs *);
40−extern void die_nmi(char *str, struct pt_regs *regs);
40+extern void die_nmi(char *str, struct pt_regs *regs, int do_panic);
4141
4242 #define get_nmi_reason() inb(0x61)
4343