aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/nmi.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-05-19 11:39:08 +0100
committerKeir Fraser <keir.fraser@citrix.com>2010-05-19 11:39:08 +0100
commite2da2bcec6ff289bb20f5cb0fb6d4b8593f89fca (patch)
treec03776338954d7a3bb5436956613b9d31015000b /xen/arch/x86/nmi.c
parent1aaeaa05a232cd43b24e0d10f3887971b3d52053 (diff)
downloadxen-e2da2bcec6ff289bb20f5cb0fb6d4b8593f89fca.tar.gz
xen-e2da2bcec6ff289bb20f5cb0fb6d4b8593f89fca.tar.bz2
xen-e2da2bcec6ff289bb20f5cb0fb6d4b8593f89fca.zip
x86 nmi: Enable/disable dynamically on each CPU during hotplug.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/arch/x86/nmi.c')
-rw-r--r--xen/arch/x86/nmi.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c
index 703294329c..6649afa1cc 100644
--- a/xen/arch/x86/nmi.c
+++ b/xen/arch/x86/nmi.c
@@ -24,6 +24,7 @@
#include <xen/console.h>
#include <xen/smp.h>
#include <xen/keyhandler.h>
+#include <xen/cpu.h>
#include <asm/current.h>
#include <asm/mc146818rtc.h>
#include <asm/msr.h>
@@ -353,6 +354,32 @@ void __pminit setup_apic_nmi_watchdog(void)
nmi_active = 1;
}
+static int cpu_nmi_callback(
+ struct notifier_block *nfb, unsigned long action, void *hcpu)
+{
+ unsigned int cpu = (unsigned long)hcpu;
+
+ switch ( action )
+ {
+ case CPU_UP_PREPARE:
+ init_timer(&per_cpu(nmi_timer, cpu), nmi_timer_fn, NULL, cpu);
+ set_timer(&per_cpu(nmi_timer, cpu), NOW());
+ break;
+ case CPU_UP_CANCELED:
+ case CPU_DEAD:
+ kill_timer(&per_cpu(nmi_timer, cpu));
+ break;
+ default:
+ break;
+ }
+
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block cpu_nmi_nfb = {
+ .notifier_call = cpu_nmi_callback
+};
+
static DEFINE_PER_CPU(unsigned int, last_irq_sums);
static DEFINE_PER_CPU(unsigned int, alert_counter);
@@ -377,10 +404,8 @@ void watchdog_enable(void)
* setup because the timer infrastructure is not available.
*/
for_each_online_cpu ( cpu )
- {
- init_timer(&per_cpu(nmi_timer, cpu), nmi_timer_fn, NULL, cpu);
- set_timer(&per_cpu(nmi_timer, cpu), NOW());
- }
+ cpu_nmi_callback(&cpu_nmi_nfb, CPU_UP_PREPARE, (void *)(long)cpu);
+ register_cpu_notifier(&cpu_nmi_nfb);
}
void nmi_watchdog_tick(struct cpu_user_regs * regs)