Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 191043
b: refs/heads/master
c: d30d64c
h: refs/heads/master
i:
  191041: 33c4e57
  191039: fc0de9e
v: v3
  • Loading branch information
Robert Richter committed May 4, 2010
1 parent 5b3a3af commit 6ff5562
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 68 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: de654649737696ecf32873c341b305e30f3dc777
refs/heads/master: d30d64c6da3ec7a0708bfffa7e05752d5b9a1093
134 changes: 67 additions & 67 deletions trunk/arch/x86/oprofile/nmi_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,56 +364,6 @@ static struct notifier_block profile_exceptions_nb = {
.priority = 2
};

static int nmi_setup(void)
{
int err = 0;
int cpu;

if (!allocate_msrs())
return -ENOMEM;

/* We need to serialize save and setup for HT because the subset
* of msrs are distinct for save and setup operations
*/

/* Assume saved/restored counters are the same on all CPUs */
err = model->fill_in_addresses(&per_cpu(cpu_msrs, 0));
if (err)
goto fail;

for_each_possible_cpu(cpu) {
if (!cpu)
continue;

memcpy(per_cpu(cpu_msrs, cpu).counters,
per_cpu(cpu_msrs, 0).counters,
sizeof(struct op_msr) * model->num_counters);

memcpy(per_cpu(cpu_msrs, cpu).controls,
per_cpu(cpu_msrs, 0).controls,
sizeof(struct op_msr) * model->num_controls);

mux_clone(cpu);
}

nmi_enabled = 0;
ctr_running = 0;
barrier();
err = register_die_notifier(&profile_exceptions_nb);
if (err)
goto fail;

get_online_cpus();
on_each_cpu(nmi_cpu_setup, NULL, 1);
nmi_enabled = 1;
put_online_cpus();

return 0;
fail:
free_msrs();
return err;
}

static void nmi_cpu_restore_registers(struct op_msrs *msrs)
{
struct op_msr *counters = msrs->counters;
Expand Down Expand Up @@ -449,23 +399,6 @@ static void nmi_cpu_shutdown(void *dummy)
nmi_cpu_restore_registers(msrs);
}

static void nmi_shutdown(void)
{
struct op_msrs *msrs;

get_online_cpus();
on_each_cpu(nmi_cpu_shutdown, NULL, 1);
nmi_enabled = 0;
ctr_running = 0;
put_online_cpus();
barrier();
unregister_die_notifier(&profile_exceptions_nb);
msrs = &get_cpu_var(cpu_msrs);
model->shutdown(msrs);
free_msrs();
put_cpu_var(cpu_msrs);
}

static void nmi_cpu_up(void *dummy)
{
if (nmi_enabled)
Expand Down Expand Up @@ -531,6 +464,73 @@ static struct notifier_block oprofile_cpu_nb = {
.notifier_call = oprofile_cpu_notifier
};

static int nmi_setup(void)
{
int err = 0;
int cpu;

if (!allocate_msrs())
return -ENOMEM;

/* We need to serialize save and setup for HT because the subset
* of msrs are distinct for save and setup operations
*/

/* Assume saved/restored counters are the same on all CPUs */
err = model->fill_in_addresses(&per_cpu(cpu_msrs, 0));
if (err)
goto fail;

for_each_possible_cpu(cpu) {
if (!cpu)
continue;

memcpy(per_cpu(cpu_msrs, cpu).counters,
per_cpu(cpu_msrs, 0).counters,
sizeof(struct op_msr) * model->num_counters);

memcpy(per_cpu(cpu_msrs, cpu).controls,
per_cpu(cpu_msrs, 0).controls,
sizeof(struct op_msr) * model->num_controls);

mux_clone(cpu);
}

nmi_enabled = 0;
ctr_running = 0;
barrier();
err = register_die_notifier(&profile_exceptions_nb);
if (err)
goto fail;

get_online_cpus();
on_each_cpu(nmi_cpu_setup, NULL, 1);
nmi_enabled = 1;
put_online_cpus();

return 0;
fail:
free_msrs();
return err;
}

static void nmi_shutdown(void)
{
struct op_msrs *msrs;

get_online_cpus();
on_each_cpu(nmi_cpu_shutdown, NULL, 1);
nmi_enabled = 0;
ctr_running = 0;
put_online_cpus();
barrier();
unregister_die_notifier(&profile_exceptions_nb);
msrs = &get_cpu_var(cpu_msrs);
model->shutdown(msrs);
free_msrs();
put_cpu_var(cpu_msrs);
}

#ifdef CONFIG_PM

static int nmi_suspend(struct sys_device *dev, pm_message_t state)
Expand Down

0 comments on commit 6ff5562

Please sign in to comment.