ia64/xen-unstable

changeset 8591:956bf08c91c3

Ensure watchdog remains disabled unless enabled on the command line.

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>
author Ian.Campbell@xensource.com
date Fri Jan 13 14:09:39 2006 +0000 (2006-01-13)
parents 19f5ffa02154
children e888f9b28a5b
files xen/arch/x86/apic.c xen/arch/x86/nmi.c
line diff
     1.1 --- a/xen/arch/x86/apic.c	Fri Jan 13 11:04:04 2006 +0000
     1.2 +++ b/xen/arch/x86/apic.c	Fri Jan 13 14:09:39 2006 +0000
     1.3 @@ -451,8 +451,7 @@ void __init setup_local_APIC (void)
     1.4              printk("No ESR for 82489DX.\n");
     1.5      }
     1.6  
     1.7 -    if (nmi_watchdog == NMI_LOCAL_APIC)
     1.8 -        setup_apic_nmi_watchdog();
     1.9 +    setup_apic_nmi_watchdog();
    1.10  }
    1.11  
    1.12  /*
     2.1 --- a/xen/arch/x86/nmi.c	Fri Jan 13 11:04:04 2006 +0000
     2.2 +++ b/xen/arch/x86/nmi.c	Fri Jan 13 14:09:39 2006 +0000
     2.3 @@ -31,6 +31,10 @@
     2.4  #include <asm/div64.h>
     2.5  
     2.6  unsigned int nmi_watchdog = NMI_NONE;
     2.7 +static spinlock_t   watchdog_lock = SPIN_LOCK_UNLOCKED;
     2.8 +static unsigned int watchdog_disable_count = 1;
     2.9 +static unsigned int watchdog_on;
    2.10 +
    2.11  static unsigned int nmi_hz = HZ;
    2.12  static unsigned int nmi_perfctr_msr;	/* the MSR to reset in NMI handler */
    2.13  static unsigned int nmi_p4_cccr_val;
    2.14 @@ -310,8 +314,16 @@ void __pminit setup_apic_nmi_watchdog(vo
    2.15  {
    2.16      int cpu = smp_processor_id();
    2.17  
    2.18 -    if (!nmi_watchdog)
    2.19 -        return;
    2.20 +    if ( nmi_active < 0 )
    2.21 +	return;
    2.22 +
    2.23 +    if ( !nmi_watchdog )
    2.24 +    {
    2.25 +	/* Force the watchdog to always be disabled. */
    2.26 +	watchdog_disable_count++;
    2.27 +	nmi_active = -1;
    2.28 +	return;
    2.29 +    }
    2.30  
    2.31      switch (boot_cpu_data.x86_vendor) {
    2.32      case X86_VENDOR_AMD:
    2.33 @@ -352,10 +364,6 @@ static unsigned int
    2.34  last_irq_sums [NR_CPUS],
    2.35      alert_counter [NR_CPUS];
    2.36  
    2.37 -static spinlock_t   watchdog_lock = SPIN_LOCK_UNLOCKED;
    2.38 -static unsigned int watchdog_disable_count = 1;
    2.39 -static unsigned int watchdog_on;
    2.40 -
    2.41  void watchdog_disable(void)
    2.42  {
    2.43      unsigned long flags;