Ensure watchdog remains disabled unless enabled on the command line.
authorIan.Campbell@xensource.com <Ian.Campbell@xensource.com>
Fri, 13 Jan 2006 14:09:39 +0000 (14:09 +0000)
committerIan.Campbell@xensource.com <Ian.Campbell@xensource.com>
Fri, 13 Jan 2006 14:09:39 +0000 (14:09 +0000)
Bail out of setup_apic_nmi_watchdog() early if watchdog is not
enabled. Is the watchdog is disabled then increment
watchdog_disable_count to prevent it ever becoming enabled.

Unconditionally call setup_apic_nmi_watchdog() from setup_local_APIC()
so that the above is guaranteed to have occurred before the first call
of watchdog_enable().

Signed-off-by: Ian Campbell <Ian.Campbell@XenSource.com>
xen/arch/x86/apic.c
xen/arch/x86/nmi.c

index 7eb6000b379d419fe3ed172686a0976d0f8f84c8..f1a5f0b96d65b28a153a04285fbaba44930b2d73 100644 (file)
@@ -451,8 +451,7 @@ void __init setup_local_APIC (void)
             printk("No ESR for 82489DX.\n");
     }
 
-    if (nmi_watchdog == NMI_LOCAL_APIC)
-        setup_apic_nmi_watchdog();
+    setup_apic_nmi_watchdog();
 }
 
 /*
index 6c969701a3e8d7f24da772854048950b1359ddb6..d2ccd4e7e498ac4ae23751f7280b60e43103a36e 100644 (file)
 #include <asm/div64.h>
 
 unsigned int nmi_watchdog = NMI_NONE;
+static spinlock_t   watchdog_lock = SPIN_LOCK_UNLOCKED;
+static unsigned int watchdog_disable_count = 1;
+static unsigned int watchdog_on;
+
 static unsigned int nmi_hz = HZ;
 static unsigned int nmi_perfctr_msr;   /* the MSR to reset in NMI handler */
 static unsigned int nmi_p4_cccr_val;
@@ -310,8 +314,16 @@ void __pminit setup_apic_nmi_watchdog(void)
 {
     int cpu = smp_processor_id();
 
-    if (!nmi_watchdog)
-        return;
+    if ( nmi_active < 0 )
+       return;
+
+    if ( !nmi_watchdog )
+    {
+       /* Force the watchdog to always be disabled. */
+       watchdog_disable_count++;
+       nmi_active = -1;
+       return;
+    }
 
     switch (boot_cpu_data.x86_vendor) {
     case X86_VENDOR_AMD:
@@ -352,10 +364,6 @@ static unsigned int
 last_irq_sums [NR_CPUS],
     alert_counter [NR_CPUS];
 
-static spinlock_t   watchdog_lock = SPIN_LOCK_UNLOCKED;
-static unsigned int watchdog_disable_count = 1;
-static unsigned int watchdog_on;
-
 void watchdog_disable(void)
 {
     unsigned long flags;