From: Kurt Garloff Subject: [PATCH] X86: sysctl to allow panic on IOCK NMI error References: bnc427979 This patch introduces a sysctl /proc/sys/kernel/panic_on_io_nmi., which defaults to 0 (off). When enabled, the kernel panics when the kernel receives an NMI caused by an IO error. The IO error triggered NMI indicates a serious system condition, which could result in IO data corruption. Rather than contiuing, panicing and dumping might be a better choice, so one can figure out what's causing the IO error. This could be especially important to companies running IO intensive applications where corruption must be avoided, e.g. a banks databases. Signed-off-by: Roberto Angelino Automatically created from "patches.suse/panic-on-io-nmi.diff" by xen-port-patches.py Index: head-2008-11-25/arch/x86/kernel/traps_32-xen.c =================================================================== --- head-2008-11-25.orig/arch/x86/kernel/traps_32-xen.c 2008-11-25 12:57:05.000000000 +0100 +++ head-2008-11-25/arch/x86/kernel/traps_32-xen.c 2008-11-25 13:13:12.000000000 +0100 @@ -83,6 +83,7 @@ gate_desc idt_table[256] #endif int panic_on_unrecovered_nmi; +int panic_on_io_nmi; int kstack_depth_to_print = 24; static unsigned int code_bytes = 64; static int ignore_nmis; @@ -670,6 +671,9 @@ io_check_error(unsigned char reason, str printk(KERN_EMERG "NMI: IOCK error (debug interrupt?)\n"); show_registers(regs); + if (panic_on_io_nmi) + panic("NMI IOCK error: Not continuing"); + /* Re-enable the IOCK line, wait for a few seconds */ clear_io_check_error(reason); } Index: head-2008-11-25/arch/x86/kernel/traps_64-xen.c =================================================================== --- head-2008-11-25.orig/arch/x86/kernel/traps_64-xen.c 2008-11-25 12:57:05.000000000 +0100 +++ head-2008-11-25/arch/x86/kernel/traps_64-xen.c 2008-11-25 13:13:12.000000000 +0100 @@ -56,6 +56,7 @@ #include int panic_on_unrecovered_nmi; +int panic_on_io_nmi; int kstack_depth_to_print = 12; static unsigned int code_bytes = 64; static int ignore_nmis; @@ -772,6 +773,9 @@ io_check_error(unsigned char reason, str printk("NMI: IOCK error (debug interrupt?)\n"); show_registers(regs); + if (panic_on_io_nmi) + panic("NMI IOCK error: Not continuing"); + /* Re-enable the IOCK line, wait for a few seconds */ clear_io_check_error(reason); }