oprofile/x86: notify cpus only when daemon is running
This patch moves the cpu notifier registration from nmi_init() to nmi_setup(). The corresponding unregistration function is now in nmi_shutdown(). Thus, the hotplug code is only active, if the oprofile daemon is running. Cc: Andi Kleen <andi@firstfloor.org> Signed-off-by: Robert Richter <robert.richter@amd.com>
This commit is contained in:
parent
d30d64c6da
commit
3de668ee8d
1 changed files with 3 additions and 13 deletions
|
@ -504,6 +504,7 @@ static int nmi_setup(void)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
get_online_cpus();
|
get_online_cpus();
|
||||||
|
register_cpu_notifier(&oprofile_cpu_nb);
|
||||||
on_each_cpu(nmi_cpu_setup, NULL, 1);
|
on_each_cpu(nmi_cpu_setup, NULL, 1);
|
||||||
nmi_enabled = 1;
|
nmi_enabled = 1;
|
||||||
put_online_cpus();
|
put_online_cpus();
|
||||||
|
@ -519,6 +520,7 @@ static void nmi_shutdown(void)
|
||||||
struct op_msrs *msrs;
|
struct op_msrs *msrs;
|
||||||
|
|
||||||
get_online_cpus();
|
get_online_cpus();
|
||||||
|
unregister_cpu_notifier(&oprofile_cpu_nb);
|
||||||
on_each_cpu(nmi_cpu_shutdown, NULL, 1);
|
on_each_cpu(nmi_cpu_shutdown, NULL, 1);
|
||||||
nmi_enabled = 0;
|
nmi_enabled = 0;
|
||||||
ctr_running = 0;
|
ctr_running = 0;
|
||||||
|
@ -739,12 +741,6 @@ int __init op_nmi_init(struct oprofile_operations *ops)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
get_online_cpus();
|
|
||||||
register_cpu_notifier(&oprofile_cpu_nb);
|
|
||||||
nmi_enabled = 0;
|
|
||||||
ctr_running = 0;
|
|
||||||
put_online_cpus();
|
|
||||||
|
|
||||||
/* default values, can be overwritten by model */
|
/* default values, can be overwritten by model */
|
||||||
ops->create_files = nmi_create_files;
|
ops->create_files = nmi_create_files;
|
||||||
ops->setup = nmi_setup;
|
ops->setup = nmi_setup;
|
||||||
|
@ -771,14 +767,8 @@ int __init op_nmi_init(struct oprofile_operations *ops)
|
||||||
|
|
||||||
void op_nmi_exit(void)
|
void op_nmi_exit(void)
|
||||||
{
|
{
|
||||||
if (using_nmi) {
|
if (using_nmi)
|
||||||
exit_sysfs();
|
exit_sysfs();
|
||||||
get_online_cpus();
|
|
||||||
unregister_cpu_notifier(&oprofile_cpu_nb);
|
|
||||||
nmi_enabled = 0;
|
|
||||||
ctr_running = 0;
|
|
||||||
put_online_cpus();
|
|
||||||
}
|
|
||||||
if (model->exit)
|
if (model->exit)
|
||||||
model->exit();
|
model->exit();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue