Commit fac58550 authored by Andi Kleen's avatar Andi Kleen Committed by Andi Kleen
Browse files

[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
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
parent 4038f901
...@@ -695,7 +695,8 @@ int __kprobes nmi_watchdog_tick(struct pt_regs * regs, unsigned reason) ...@@ -695,7 +695,8 @@ int __kprobes nmi_watchdog_tick(struct pt_regs * regs, unsigned reason)
*/ */
local_inc(&__get_cpu_var(alert_counter)); local_inc(&__get_cpu_var(alert_counter));
if (local_read(&__get_cpu_var(alert_counter)) == 5*nmi_hz) if (local_read(&__get_cpu_var(alert_counter)) == 5*nmi_hz)
die_nmi("NMI Watchdog detected LOCKUP on CPU %d\n", regs); die_nmi("NMI Watchdog detected LOCKUP on CPU %d\n", regs,
panic_on_timeout);
} else { } else {
__get_cpu_var(last_irq_sum) = sum; __get_cpu_var(last_irq_sum) = sum;
local_set(&__get_cpu_var(alert_counter), 0); local_set(&__get_cpu_var(alert_counter), 0);
...@@ -765,7 +766,7 @@ static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu) ...@@ -765,7 +766,7 @@ static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu)
char buf[64]; char buf[64];
sprintf(buf, "NMI received for unknown reason %02x\n", reason); sprintf(buf, "NMI received for unknown reason %02x\n", reason);
die_nmi(buf,regs); die_nmi(buf, regs, 1); /* Always panic here */
return 0; return 0;
} }
......
...@@ -570,7 +570,7 @@ void die(const char * str, struct pt_regs * regs, long err) ...@@ -570,7 +570,7 @@ void die(const char * str, struct pt_regs * regs, long err)
do_exit(SIGSEGV); do_exit(SIGSEGV);
} }
void __kprobes die_nmi(char *str, struct pt_regs *regs) void __kprobes die_nmi(char *str, struct pt_regs *regs, int do_panic)
{ {
unsigned long flags = oops_begin(); unsigned long flags = oops_begin();
...@@ -582,9 +582,8 @@ void __kprobes die_nmi(char *str, struct pt_regs *regs) ...@@ -582,9 +582,8 @@ void __kprobes die_nmi(char *str, struct pt_regs *regs)
show_registers(regs); show_registers(regs);
if (kexec_should_crash(current)) if (kexec_should_crash(current))
crash_kexec(regs); crash_kexec(regs);
if (panic_on_timeout || panic_on_oops) if (do_panic || panic_on_oops)
panic("nmi watchdog"); panic("Non maskable interrupt");
printk("console shuts up ...\n");
oops_end(flags); oops_end(flags);
nmi_exit(); nmi_exit();
local_irq_enable(); local_irq_enable();
......
...@@ -37,7 +37,7 @@ static inline void unset_nmi_pm_callback(struct pm_dev * dev) ...@@ -37,7 +37,7 @@ static inline void unset_nmi_pm_callback(struct pm_dev * dev)
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
extern void default_do_nmi(struct pt_regs *); extern void default_do_nmi(struct pt_regs *);
extern void die_nmi(char *str, struct pt_regs *regs); extern void die_nmi(char *str, struct pt_regs *regs, int do_panic);
#define get_nmi_reason() inb(0x61) #define get_nmi_reason() inb(0x61)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment