Browse Source

x86, NMI watchdog: add support to enable and disable IOAPIC NMI

Impact: change/improve the way /proc/sys/kernel/nmi_watchdog works

This patch adds support to enable/disable IOAPIC NMI watchdog in runtime via
procfs.

Signed-off-by: Aristeu Rozanski <aris@redhat.com>
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Aristeu Rozanski 16 years ago
parent
commit
6f290b4e01
1 changed files with 25 additions and 0 deletions
  1. 25 0
      arch/x86/kernel/nmi.c

+ 25 - 0
arch/x86/kernel/nmi.c

@@ -340,6 +340,8 @@ void stop_apic_nmi_watchdog(void *unused)
 		return;
 		return;
 	if (nmi_watchdog == NMI_LOCAL_APIC)
 	if (nmi_watchdog == NMI_LOCAL_APIC)
 		lapic_watchdog_stop();
 		lapic_watchdog_stop();
+	else
+		__acpi_nmi_disable(NULL);
 	__get_cpu_var(wd_enabled) = 0;
 	__get_cpu_var(wd_enabled) = 0;
 	atomic_dec(&nmi_active);
 	atomic_dec(&nmi_active);
 }
 }
@@ -465,6 +467,24 @@ nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
 
 
 #ifdef CONFIG_SYSCTL
 #ifdef CONFIG_SYSCTL
 
 
+static void enable_ioapic_nmi_watchdog_single(void *unused)
+{
+	__get_cpu_var(wd_enabled) = 1;
+	atomic_inc(&nmi_active);
+	__acpi_nmi_enable(NULL);
+}
+
+static void enable_ioapic_nmi_watchdog(void)
+{
+	on_each_cpu(enable_ioapic_nmi_watchdog_single, NULL, 1);
+	touch_nmi_watchdog();
+}
+
+static void disable_ioapic_nmi_watchdog(void)
+{
+	on_each_cpu(stop_apic_nmi_watchdog, NULL, 1);
+}
+
 static int __init setup_unknown_nmi_panic(char *str)
 static int __init setup_unknown_nmi_panic(char *str)
 {
 {
 	unknown_nmi_panic = 1;
 	unknown_nmi_panic = 1;
@@ -507,6 +527,11 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
 			enable_lapic_nmi_watchdog();
 			enable_lapic_nmi_watchdog();
 		else
 		else
 			disable_lapic_nmi_watchdog();
 			disable_lapic_nmi_watchdog();
+	} else if (nmi_watchdog == NMI_IO_APIC) {
+		if (nmi_watchdog_enabled)
+			enable_ioapic_nmi_watchdog();
+		else
+			disable_ioapic_nmi_watchdog();
 	} else {
 	} else {
 		printk(KERN_WARNING
 		printk(KERN_WARNING
 			"NMI watchdog doesn't know what hardware to touch\n");
 			"NMI watchdog doesn't know what hardware to touch\n");