diff options
author | Robert Richter <robert.richter@amd.com> | 2008-09-24 11:25:31 +0200 |
---|---|---|
committer | Robert Richter <robert.richter@amd.com> | 2008-09-24 11:25:31 +0200 |
commit | f78e80209cf143be49f268c340431ae9fa3abb74 (patch) | |
tree | 820fa64b688099dfdd93d27ba03252738ca5c7e2 /arch/x86/oprofile | |
parent | 4c168eaf7ea39f25a45a3d8c7eebc3fedb633a1d (diff) | |
parent | 24342c34a022ee90839873d91396045e12ef1090 (diff) | |
download | op-kernel-dev-f78e80209cf143be49f268c340431ae9fa3abb74.zip op-kernel-dev-f78e80209cf143be49f268c340431ae9fa3abb74.tar.gz |
Merge commit 'v2.6.27-rc5' into tip/oprofile
Conflicts:
arch/x86/oprofile/nmi_int.c
Diffstat (limited to 'arch/x86/oprofile')
-rw-r--r-- | arch/x86/oprofile/nmi_int.c | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c index 287513a..d988574 100644 --- a/arch/x86/oprofile/nmi_int.c +++ b/arch/x86/oprofile/nmi_int.c @@ -16,6 +16,7 @@ #include <linux/slab.h> #include <linux/moduleparam.h> #include <linux/kdebug.h> +#include <linux/cpu.h> #include <asm/nmi.h> #include <asm/msr.h> #include <asm/apic.h> @@ -29,23 +30,48 @@ static DEFINE_PER_CPU(unsigned long, saved_lvtpc); static int nmi_start(void); static void nmi_stop(void); +static void nmi_cpu_start(void *dummy); +static void nmi_cpu_stop(void *dummy); /* 0 == registered but off, 1 == registered and on */ static int nmi_enabled = 0; +#ifdef CONFIG_SMP +static int oprofile_cpu_notifier(struct notifier_block *b, unsigned long action, + void *data) +{ + int cpu = (unsigned long)data; + switch (action) { + case CPU_DOWN_FAILED: + case CPU_ONLINE: + smp_call_function_single(cpu, nmi_cpu_start, NULL, 0); + break; + case CPU_DOWN_PREPARE: + smp_call_function_single(cpu, nmi_cpu_stop, NULL, 1); + break; + } + return NOTIFY_DONE; +} + +static struct notifier_block oprofile_cpu_nb = { + .notifier_call = oprofile_cpu_notifier +}; +#endif + #ifdef CONFIG_PM static int nmi_suspend(struct sys_device *dev, pm_message_t state) { + /* Only one CPU left, just stop that one */ if (nmi_enabled == 1) - nmi_stop(); + nmi_cpu_stop(NULL); return 0; } static int nmi_resume(struct sys_device *dev) { if (nmi_enabled == 1) - nmi_start(); + nmi_cpu_start(NULL); return 0; } @@ -468,6 +494,9 @@ int __init op_nmi_init(struct oprofile_operations *ops) return -ENODEV; } +#ifdef CONFIG_SMP + register_cpu_notifier(&oprofile_cpu_nb); +#endif /* default values, can be overwritten by model */ ops->create_files = nmi_create_files; ops->setup = nmi_setup; @@ -489,8 +518,12 @@ int __init op_nmi_init(struct oprofile_operations *ops) void op_nmi_exit(void) { - if (using_nmi) + if (using_nmi) { exit_sysfs(); +#ifdef CONFIG_SMP + unregister_cpu_notifier(&oprofile_cpu_nb); +#endif + } if (model->exit) model->exit(); } |