[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86 nmi: Enable/disable dynamically on each CPU during hotplug.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1274265548 -3600 # Node ID a6f24be72f667b2a339b6412dcebe72d94d757a9 # Parent abc9f8e809e555b00d16a94fa4a1635803591fc9 x86 nmi: Enable/disable dynamically on each CPU during hotplug. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- xen/arch/x86/nmi.c | 33 +++++++++++++++++++++++++++++---- 1 files changed, 29 insertions(+), 4 deletions(-) diff -r abc9f8e809e5 -r a6f24be72f66 xen/arch/x86/nmi.c --- a/xen/arch/x86/nmi.c Wed May 19 11:15:26 2010 +0100 +++ b/xen/arch/x86/nmi.c Wed May 19 11:39:08 2010 +0100 @@ -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(vo 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) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |