public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: sysctl to allow panic on IOCK NMI error
@ 2009-06-24 21:32 Greg KH
  2009-06-25  9:16 ` [tip:x86/urgent] x86: Add " tip-bot for Kurt Garloff
                   ` (4 more replies)
  0 siblings, 5 replies; 20+ messages in thread
From: Greg KH @ 2009-06-24 21:32 UTC (permalink / raw)
  To: x86
  Cc: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, Kurt Garloff,
	linux-kernel

From: Kurt Garloff <garloff@suse.de>

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: Kurt Garloff <garloff@suse.de>
Signed-off-by: Roberto Angelino <robertangelino@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---

I don't know why this wasn't sent to you before now, sorry about that.
SuSE has been shipping it for a while, it was done at the request of a
large database vendor, for their users.  Can you queue it up for .32?
  - gregkh

 arch/x86/kernel/dumpstack.c |    1 +
 arch/x86/kernel/traps.c     |    3 +++
 include/linux/kernel.h      |    1 +
 include/linux/sysctl.h      |    1 +
 kernel/sysctl.c             |    8 ++++++++
 kernel/sysctl_check.c       |    1 +
 6 files changed, 15 insertions(+)

--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -22,6 +22,7 @@
 #include "dumpstack.h"
 
 int panic_on_unrecovered_nmi;
+int panic_on_io_nmi;
 unsigned int code_bytes = 64;
 int kstack_depth_to_print = 3 * STACKSLOTS_PER_LINE;
 static int die_counter;
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -346,6 +346,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 */
 	reason = (reason & 0xf) | 8;
 	outb(reason, 0x61);
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -303,6 +303,7 @@ extern int oops_in_progress;		/* If set,
 extern int panic_timeout;
 extern int panic_on_oops;
 extern int panic_on_unrecovered_nmi;
+extern int panic_on_io_nmi;
 extern const char *print_tainted(void);
 extern void add_taint(unsigned flag);
 extern int test_taint(unsigned flag);
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -163,6 +163,7 @@ enum
 	KERN_MAX_LOCK_DEPTH=74,
 	KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */
 	KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */
+	KERN_PANIC_ON_IO_NMI=77, /* int: whether we will panic on an io NMI */
 };
 
 
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -744,6 +744,14 @@ static struct ctl_table kern_table[] = {
 		.proc_handler	= &proc_dointvec,
 	},
 	{
+		.ctl_name	= KERN_PANIC_ON_IO_NMI,
+		.procname	= "panic_on_io_nmi",
+		.data		= &panic_on_io_nmi,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
 		.ctl_name	= KERN_BOOTLOADER_TYPE,
 		.procname	= "bootloader_type",
 		.data		= &bootloader_type,
--- a/kernel/sysctl_check.c
+++ b/kernel/sysctl_check.c
@@ -104,6 +104,7 @@ static const struct trans_ctl_table tran
 	{ KERN_MAX_LOCK_DEPTH,		"max_lock_depth" },
 	{ KERN_NMI_WATCHDOG,		"nmi_watchdog" },
 	{ KERN_PANIC_ON_NMI,		"panic_on_unrecovered_nmi" },
+	{ KERN_PANIC_ON_IO_NMI,		"panic_on_io_nmi" },
 	{}
 };
 


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2009-07-03 21:29 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-24 21:32 [PATCH] x86: sysctl to allow panic on IOCK NMI error Greg KH
2009-06-25  9:16 ` [tip:x86/urgent] x86: Add " tip-bot for Kurt Garloff
2009-06-25 18:15 ` [PATCH] x86: " Eric W. Biederman
2009-06-25 20:07   ` Greg KH
2009-06-25 20:18     ` Ingo Molnar
2009-06-25 20:16       ` Greg KH
2009-06-25 20:06 ` [tip:x86/urgent] x86: Add " tip-bot for Kurt Garloff
2009-06-25 20:09 ` tip-bot for Kurt Garloff
2009-06-30 22:27 ` [PATCH] x86: " Maciej W. Rozycki
2009-06-30 22:30   ` Greg KH
2009-07-01  0:50     ` Maciej W. Rozycki
2009-07-01 11:10       ` Ingo Molnar
2009-07-01 17:30         ` Jesse Barnes
2009-07-01 17:37         ` Maciej W. Rozycki
2009-07-02  7:53           ` Ingo Molnar
2009-07-02 10:41             ` Borislav Petkov
2009-07-03  7:59               ` Ingo Molnar
2009-07-03 21:35             ` Maciej W. Rozycki
2009-07-03  9:19         ` Kurt Garloff
2009-07-03  9:24           ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox