oprofile/x86: moving shutdown functions
Moving some code in preparation of the next patch. Signed-off-by: Robert Richter <robert.richter@amd.com>
This commit is contained in:
parent
d0e4120fda
commit
83300ce0df
3 changed files with 46 additions and 49 deletions
|
@ -126,6 +126,18 @@ static void op_mux_switch_ctrl(struct op_x86_model_spec const *model,
|
||||||
|
|
||||||
/* functions for op_amd_spec */
|
/* functions for op_amd_spec */
|
||||||
|
|
||||||
|
static void op_amd_shutdown(struct op_msrs const * const msrs)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < NUM_COUNTERS; ++i) {
|
||||||
|
if (!msrs->counters[i].addr)
|
||||||
|
continue;
|
||||||
|
release_perfctr_nmi(MSR_K7_PERFCTR0 + i);
|
||||||
|
release_evntsel_nmi(MSR_K7_EVNTSEL0 + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void op_amd_fill_in_addresses(struct op_msrs * const msrs)
|
static void op_amd_fill_in_addresses(struct op_msrs * const msrs)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -422,18 +434,6 @@ static void op_amd_stop(struct op_msrs const * const msrs)
|
||||||
op_amd_stop_ibs();
|
op_amd_stop_ibs();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void op_amd_shutdown(struct op_msrs const * const msrs)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < NUM_COUNTERS; ++i) {
|
|
||||||
if (!msrs->counters[i].addr)
|
|
||||||
continue;
|
|
||||||
release_perfctr_nmi(MSR_K7_PERFCTR0 + i);
|
|
||||||
release_evntsel_nmi(MSR_K7_EVNTSEL0 + i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static u8 ibs_eilvt_off;
|
static u8 ibs_eilvt_off;
|
||||||
|
|
||||||
static inline void apic_init_ibs_nmi_per_cpu(void *arg)
|
static inline void apic_init_ibs_nmi_per_cpu(void *arg)
|
||||||
|
|
|
@ -385,6 +385,24 @@ static unsigned int get_stagger(void)
|
||||||
|
|
||||||
static unsigned long reset_value[NUM_COUNTERS_NON_HT];
|
static unsigned long reset_value[NUM_COUNTERS_NON_HT];
|
||||||
|
|
||||||
|
static void p4_shutdown(struct op_msrs const * const msrs)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < num_counters; ++i) {
|
||||||
|
if (msrs->counters[i].addr)
|
||||||
|
release_perfctr_nmi(msrs->counters[i].addr);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* some of the control registers are specially reserved in
|
||||||
|
* conjunction with the counter registers (hence the starting offset).
|
||||||
|
* This saves a few bits.
|
||||||
|
*/
|
||||||
|
for (i = num_counters; i < num_controls; ++i) {
|
||||||
|
if (msrs->controls[i].addr)
|
||||||
|
release_evntsel_nmi(msrs->controls[i].addr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void p4_fill_in_addresses(struct op_msrs * const msrs)
|
static void p4_fill_in_addresses(struct op_msrs * const msrs)
|
||||||
{
|
{
|
||||||
|
@ -668,26 +686,6 @@ static void p4_stop(struct op_msrs const * const msrs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void p4_shutdown(struct op_msrs const * const msrs)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < num_counters; ++i) {
|
|
||||||
if (msrs->counters[i].addr)
|
|
||||||
release_perfctr_nmi(msrs->counters[i].addr);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* some of the control registers are specially reserved in
|
|
||||||
* conjunction with the counter registers (hence the starting offset).
|
|
||||||
* This saves a few bits.
|
|
||||||
*/
|
|
||||||
for (i = num_counters; i < num_controls; ++i) {
|
|
||||||
if (msrs->controls[i].addr)
|
|
||||||
release_evntsel_nmi(msrs->controls[i].addr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
struct op_x86_model_spec op_p4_ht2_spec = {
|
struct op_x86_model_spec op_p4_ht2_spec = {
|
||||||
.num_counters = NUM_COUNTERS_HT2,
|
.num_counters = NUM_COUNTERS_HT2,
|
||||||
|
|
|
@ -30,6 +30,22 @@ static int counter_width = 32;
|
||||||
|
|
||||||
static u64 *reset_value;
|
static u64 *reset_value;
|
||||||
|
|
||||||
|
static void ppro_shutdown(struct op_msrs const * const msrs)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < num_counters; ++i) {
|
||||||
|
if (!msrs->counters[i].addr)
|
||||||
|
continue;
|
||||||
|
release_perfctr_nmi(MSR_P6_PERFCTR0 + i);
|
||||||
|
release_evntsel_nmi(MSR_P6_EVNTSEL0 + i);
|
||||||
|
}
|
||||||
|
if (reset_value) {
|
||||||
|
kfree(reset_value);
|
||||||
|
reset_value = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void ppro_fill_in_addresses(struct op_msrs * const msrs)
|
static void ppro_fill_in_addresses(struct op_msrs * const msrs)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -189,23 +205,6 @@ static void ppro_stop(struct op_msrs const * const msrs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ppro_shutdown(struct op_msrs const * const msrs)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < num_counters; ++i) {
|
|
||||||
if (!msrs->counters[i].addr)
|
|
||||||
continue;
|
|
||||||
release_perfctr_nmi(MSR_P6_PERFCTR0 + i);
|
|
||||||
release_evntsel_nmi(MSR_P6_EVNTSEL0 + i);
|
|
||||||
}
|
|
||||||
if (reset_value) {
|
|
||||||
kfree(reset_value);
|
|
||||||
reset_value = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
struct op_x86_model_spec op_ppro_spec = {
|
struct op_x86_model_spec op_ppro_spec = {
|
||||||
.num_counters = 2,
|
.num_counters = 2,
|
||||||
.num_controls = 2,
|
.num_controls = 2,
|
||||||
|
|
Loading…
Add table
Reference in a new issue