Commit 5211a242d0cbdded372aee59da18f80552b0a80a

Authored by Kurt Garloff
Committed by Ingo Molnar
1 parent 9c26f52b90

x86: Add sysctl to allow panic on IOCK NMI error

This patch introduces a new 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
bank's databases.

[ SuSE has been shipping it for a while, it was done at the
  request of a large database vendor, for their users. ]

Signed-off-by: Kurt Garloff <garloff@suse.de>
Signed-off-by: Roberto Angelino <robertangelino@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
LKML-Reference: <20090624213211.GA11291@kroah.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

Showing 4 changed files with 13 additions and 0 deletions Side-by-side Diff

arch/x86/kernel/dumpstack.c
... ... @@ -22,6 +22,7 @@
22 22 #include "dumpstack.h"
23 23  
24 24 int panic_on_unrecovered_nmi;
  25 +int panic_on_io_nmi;
25 26 unsigned int code_bytes = 64;
26 27 int kstack_depth_to_print = 3 * STACKSLOTS_PER_LINE;
27 28 static int die_counter;
arch/x86/kernel/traps.c
... ... @@ -346,6 +346,9 @@
346 346 printk(KERN_EMERG "NMI: IOCK error (debug interrupt?)\n");
347 347 show_registers(regs);
348 348  
  349 + if (panic_on_io_nmi)
  350 + panic("NMI IOCK error: Not continuing");
  351 +
349 352 /* Re-enable the IOCK line, wait for a few seconds */
350 353 reason = (reason & 0xf) | 8;
351 354 outb(reason, 0x61);
include/linux/kernel.h
... ... @@ -303,6 +303,7 @@
303 303 extern int panic_timeout;
304 304 extern int panic_on_oops;
305 305 extern int panic_on_unrecovered_nmi;
  306 +extern int panic_on_io_nmi;
306 307 extern const char *print_tainted(void);
307 308 extern void add_taint(unsigned flag);
308 309 extern int test_taint(unsigned flag);
... ... @@ -744,6 +744,14 @@
744 744 .proc_handler = &proc_dointvec,
745 745 },
746 746 {
  747 + .ctl_name = CTL_UNNUMBERED,
  748 + .procname = "panic_on_io_nmi",
  749 + .data = &panic_on_io_nmi,
  750 + .maxlen = sizeof(int),
  751 + .mode = 0644,
  752 + .proc_handler = &proc_dointvec,
  753 + },
  754 + {
747 755 .ctl_name = KERN_BOOTLOADER_TYPE,
748 756 .procname = "bootloader_type",
749 757 .data = &bootloader_type,