Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 191032
b: refs/heads/master
c: 8f5a2dd
h: refs/heads/master
v: v3
  • Loading branch information
Robert Richter committed May 4, 2010
1 parent 3546807 commit 87e61e1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 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: 81c4a8a6733ad2ff49c0e077b51403367601b3e7
refs/heads/master: 8f5a2dd83a1f8e89fdc17eb0f2f07c2e713e635a
33 changes: 19 additions & 14 deletions trunk/arch/x86/oprofile/nmi_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ static void free_msrs(void)
kfree(per_cpu(cpu_msrs, i).controls);
per_cpu(cpu_msrs, i).controls = NULL;
}
nmi_shutdown_mux();
}

static int allocate_msrs(void)
Expand All @@ -307,14 +308,21 @@ static int allocate_msrs(void)
per_cpu(cpu_msrs, i).counters = kzalloc(counters_size,
GFP_KERNEL);
if (!per_cpu(cpu_msrs, i).counters)
return 0;
goto fail;
per_cpu(cpu_msrs, i).controls = kzalloc(controls_size,
GFP_KERNEL);
if (!per_cpu(cpu_msrs, i).controls)
return 0;
goto fail;
}

if (!nmi_setup_mux())
goto fail;

return 1;

fail:
free_msrs();
return 0;
}

static void nmi_cpu_setup(void *dummy)
Expand Down Expand Up @@ -342,17 +350,7 @@ static int nmi_setup(void)
int cpu;

if (!allocate_msrs())
err = -ENOMEM;
else if (!nmi_setup_mux())
err = -ENOMEM;
else
err = register_die_notifier(&profile_exceptions_nb);

if (err) {
free_msrs();
nmi_shutdown_mux();
return err;
}
return -ENOMEM;

/* We need to serialize save and setup for HT because the subset
* of msrs are distinct for save and setup operations
Expand All @@ -374,9 +372,17 @@ static int nmi_setup(void)

mux_clone(cpu);
}

err = register_die_notifier(&profile_exceptions_nb);
if (err)
goto fail;

on_each_cpu(nmi_cpu_setup, NULL, 1);
nmi_enabled = 1;
return 0;
fail:
free_msrs();
return err;
}

static void nmi_cpu_restore_registers(struct op_msrs *msrs)
Expand Down Expand Up @@ -421,7 +427,6 @@ static void nmi_shutdown(void)
nmi_enabled = 0;
on_each_cpu(nmi_cpu_shutdown, NULL, 1);
unregister_die_notifier(&profile_exceptions_nb);
nmi_shutdown_mux();
msrs = &get_cpu_var(cpu_msrs);
model->shutdown(msrs);
free_msrs();
Expand Down

0 comments on commit 87e61e1

Please sign in to comment.