diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-05-16 09:49:48 +0000 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-05-16 09:49:48 +0000 |
commit | 778b651cc3c83880a793f1bea964f4387337671f (patch) | |
tree | 77c8f86335b507592b1568950334547cb6f26cb4 /xen/arch/x86/nmi.c | |
parent | 73d5db0ee7b1cacd88b32503f59e8bb3624669b5 (diff) | |
download | xen-778b651cc3c83880a793f1bea964f4387337671f.tar.gz xen-778b651cc3c83880a793f1bea964f4387337671f.tar.bz2 xen-778b651cc3c83880a793f1bea964f4387337671f.zip |
bitkeeper revision 1.1413 (42886cbcgOQRttqbKGwhoGUdvq0jbg)
Fix the watchdog disable/enable interface. This cleans up common code
somewhat.
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/arch/x86/nmi.c')
-rw-r--r-- | xen/arch/x86/nmi.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c index afdf8051bb..aef14645e4 100644 --- a/xen/arch/x86/nmi.c +++ b/xen/arch/x86/nmi.c @@ -28,7 +28,6 @@ #include <asm/debugger.h> unsigned int nmi_watchdog = NMI_NONE; -unsigned int watchdog_on = 0; static unsigned int nmi_hz = HZ; unsigned int nmi_perfctr_msr; /* the MSR to reset in NMI handler */ @@ -256,6 +255,28 @@ 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; + spin_lock_irqsave(&watchdog_lock, flags); + if ( watchdog_disable_count++ == 0 ) + watchdog_on = 0; + spin_unlock_irqrestore(&watchdog_lock, flags); +} + +void watchdog_enable(void) +{ + unsigned long flags; + spin_lock_irqsave(&watchdog_lock, flags); + if ( --watchdog_disable_count == 0 ) + watchdog_on = 1; + spin_unlock_irqrestore(&watchdog_lock, flags); +} + void touch_nmi_watchdog (void) { int i; |