]> err.no Git - linux-2.6/commitdiff
[PATCH] x86: Add abilty to enable/disable nmi watchdog from procfs (update)
authorDon Zickus <dzickus@redhat.com>
Tue, 26 Sep 2006 08:52:27 +0000 (10:52 +0200)
committerAndi Kleen <andi@basil.nowhere.org>
Tue, 26 Sep 2006 08:52:27 +0000 (10:52 +0200)
Adds a new /proc/sys/kernel/nmi_watchdog call that will enable/disable the
nmi watchdog.

By entering a non-zero value here, a user can enable the nmi watchdog to
monitor the online cpus in the system.  By entering a zero value here, a
user can disable the nmi watchdog and free up a performance counter which
could then be utilized by the oprofile subsystem, otherwise oprofile may be
short a counter when in use.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Documentation/filesystems/proc.txt
arch/i386/kernel/nmi.c
arch/x86_64/kernel/nmi.c

index 99902ae6804e6edb0550fac53ce34b9070842895..7db71d6fba824bc92f08785578d7dc8fefb4c5aa 100644 (file)
@@ -1124,11 +1124,15 @@ debugging information is displayed on console.
 NMI switch that most IA32 servers have fires unknown NMI up, for example.
 If a system hangs up, try pressing the NMI switch.
 
-[NOTE]
-   This function and oprofile share a NMI callback. Therefore this function
-   cannot be enabled when oprofile is activated.
-   And NMI watchdog will be disabled when the value in this file is set to
-   non-zero.
+nmi_watchdog
+------------
+
+Enables/Disables the NMI watchdog on x86 systems.  When the value is non-zero
+the NMI watchdog is enabled and will continuously test all online cpus to
+determine whether or not they are still functioning properly.
+
+Because the NMI watchdog shares registers with oprofile, by disabling the NMI
+watchdog, oprofile may have more registers to utilize.
 
 
 2.4 /proc/sys/vm - The virtual memory subsystem
index 28065d0b71a99ee29fb031869dbff156d7b189bd..6241e4448cab174883ad190f6a67660840a21540 100644 (file)
@@ -847,7 +847,7 @@ static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu)
 }
 
 /*
- * proc handler for /proc/sys/kernel/nmi_watchdog
+ * proc handler for /proc/sys/kernel/nmi
  */
 int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
                        void __user *buffer, size_t *length, loff_t *ppos)
@@ -861,8 +861,8 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
                return 0;
 
        if (atomic_read(&nmi_active) < 0) {
-               printk(KERN_WARNING "NMI watchdog is permanently disabled\n");
-               return -EINVAL;
+               printk( KERN_WARNING "NMI watchdog is permanently disabled\n");
+               return -EIO;
        }
 
        if (nmi_watchdog == NMI_DEFAULT) {
@@ -872,24 +872,11 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
                        nmi_watchdog = NMI_IO_APIC;
        }
 
-       if (nmi_watchdog == NMI_LOCAL_APIC)
-       {
+       if (nmi_watchdog == NMI_LOCAL_APIC) {
                if (nmi_watchdog_enabled)
                        enable_lapic_nmi_watchdog();
                else
                        disable_lapic_nmi_watchdog();
-       } else if (nmi_watchdog == NMI_IO_APIC) {
-               /* FIXME
-                * for some reason these functions don't work
-                */
-               printk("Can not enable/disable NMI on IO APIC\n");
-               return -EINVAL;
-#if 0
-               if (nmi_watchdog_enabled)
-                       enable_timer_nmi_watchdog();
-               else
-                       disable_timer_nmi_watchdog();
-#endif
        } else {
                printk( KERN_WARNING
                        "NMI watchdog doesn't know what hardware to touch\n");
index 3a17411a9a19cfa9eb4331f38e7734e436663e8a..dd57410dad511cfbab6b91e23e0e87a6a62d7c77 100644 (file)
@@ -167,7 +167,7 @@ static __cpuinit inline int nmi_known_cpu(void)
 }
 
 /* Run after command line and cpu_init init, but before all other checks */
-void __cpuinit nmi_watchdog_default(void)
+void nmi_watchdog_default(void)
 {
        if (nmi_watchdog != NMI_DEFAULT)
                return;
@@ -766,32 +766,19 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
 
        if (atomic_read(&nmi_active) < 0) {
                printk( KERN_WARNING "NMI watchdog is permanently disabled\n");
-               return -EINVAL;
+               return -EIO;
        }
 
        /* if nmi_watchdog is not set yet, then set it */
        nmi_watchdog_default();
 
-       if (nmi_watchdog == NMI_LOCAL_APIC)
-       {
+       if (nmi_watchdog == NMI_LOCAL_APIC) {
                if (nmi_watchdog_enabled)
                        enable_lapic_nmi_watchdog();
                else
                        disable_lapic_nmi_watchdog();
-       } else if (nmi_watchdog == NMI_IO_APIC) {
-               /* FIXME
-                * for some reason these functions don't work
-                */
-               printk("Can not enable/disable NMI on IO APIC\n");
-               return -EIO;
-#if 0
-               if (nmi_watchdog_enabled)
-                       enable_timer_nmi_watchdog();
-               else
-                       disable_timer_nmi_watchdog();
-#endif
        } else {
-               printk(KERN_WARNING
+               printk( KERN_WARNING
                        "NMI watchdog doesn't know what hardware to touch\n");
                return -EIO;
        }