diff options
author | Robert Richter <robert.richter@amd.com> | 2010-03-23 15:01:54 -0400 |
---|---|---|
committer | Robert Richter <robert.richter@amd.com> | 2010-05-04 05:35:27 -0400 |
commit | 83300ce0df6b72e156b386457aa0f0902b8c0a98 (patch) | |
tree | 0aa77779550808cd1076945b9a698dcbcca02dbe /arch/x86/oprofile | |
parent | d0e4120fda6f87eead438eed4d49032e12060e58 (diff) |
oprofile/x86: moving shutdown functions
Moving some code in preparation of the next patch.
Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'arch/x86/oprofile')
-rw-r--r-- | arch/x86/oprofile/op_model_amd.c | 24 | ||||
-rw-r--r-- | arch/x86/oprofile/op_model_p4.c | 38 | ||||
-rw-r--r-- | arch/x86/oprofile/op_model_ppro.c | 33 |
3 files changed, 46 insertions, 49 deletions
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c index 2e2bc902b86..7e5886d54bd 100644 --- a/arch/x86/oprofile/op_model_amd.c +++ b/arch/x86/oprofile/op_model_amd.c | |||
@@ -126,6 +126,18 @@ static void op_mux_switch_ctrl(struct op_x86_model_spec const *model, | |||
126 | 126 | ||
127 | /* functions for op_amd_spec */ | 127 | /* functions for op_amd_spec */ |
128 | 128 | ||
129 | static void op_amd_shutdown(struct op_msrs const * const msrs) | ||
130 | { | ||
131 | int i; | ||
132 | |||
133 | for (i = 0; i < NUM_COUNTERS; ++i) { | ||
134 | if (!msrs->counters[i].addr) | ||
135 | continue; | ||
136 | release_perfctr_nmi(MSR_K7_PERFCTR0 + i); | ||
137 | release_evntsel_nmi(MSR_K7_EVNTSEL0 + i); | ||
138 | } | ||
139 | } | ||
140 | |||
129 | static void op_amd_fill_in_addresses(struct op_msrs * const msrs) | 141 | static void op_amd_fill_in_addresses(struct op_msrs * const msrs) |
130 | { | 142 | { |
131 | int i; | 143 | int i; |
@@ -422,18 +434,6 @@ static void op_amd_stop(struct op_msrs const * const msrs) | |||
422 | op_amd_stop_ibs(); | 434 | op_amd_stop_ibs(); |
423 | } | 435 | } |
424 | 436 | ||
425 | static void op_amd_shutdown(struct op_msrs const * const msrs) | ||
426 | { | ||
427 | int i; | ||
428 | |||
429 | for (i = 0; i < NUM_COUNTERS; ++i) { | ||
430 | if (!msrs->counters[i].addr) | ||
431 | continue; | ||
432 | release_perfctr_nmi(MSR_K7_PERFCTR0 + i); | ||
433 | release_evntsel_nmi(MSR_K7_EVNTSEL0 + i); | ||
434 | } | ||
435 | } | ||
436 | |||
437 | static u8 ibs_eilvt_off; | 437 | static u8 ibs_eilvt_off; |
438 | 438 | ||
439 | static inline void apic_init_ibs_nmi_per_cpu(void *arg) | 439 | static inline void apic_init_ibs_nmi_per_cpu(void *arg) |
diff --git a/arch/x86/oprofile/op_model_p4.c b/arch/x86/oprofile/op_model_p4.c index e6a160a4684..7cc80df330d 100644 --- a/arch/x86/oprofile/op_model_p4.c +++ b/arch/x86/oprofile/op_model_p4.c | |||
@@ -385,6 +385,24 @@ static unsigned int get_stagger(void) | |||
385 | 385 | ||
386 | static unsigned long reset_value[NUM_COUNTERS_NON_HT]; | 386 | static unsigned long reset_value[NUM_COUNTERS_NON_HT]; |
387 | 387 | ||
388 | static void p4_shutdown(struct op_msrs const * const msrs) | ||
389 | { | ||
390 | int i; | ||
391 | |||
392 | for (i = 0; i < num_counters; ++i) { | ||
393 | if (msrs->counters[i].addr) | ||
394 | release_perfctr_nmi(msrs->counters[i].addr); | ||
395 | } | ||
396 | /* | ||
397 | * some of the control registers are specially reserved in | ||
398 | * conjunction with the counter registers (hence the starting offset). | ||
399 | * This saves a few bits. | ||
400 | */ | ||
401 | for (i = num_counters; i < num_controls; ++i) { | ||
402 | if (msrs->controls[i].addr) | ||
403 | release_evntsel_nmi(msrs->controls[i].addr); | ||
404 | } | ||
405 | } | ||
388 | 406 | ||
389 | static void p4_fill_in_addresses(struct op_msrs * const msrs) | 407 | static void p4_fill_in_addresses(struct op_msrs * const msrs) |
390 | { | 408 | { |
@@ -668,26 +686,6 @@ static void p4_stop(struct op_msrs const * const msrs) | |||
668 | } | 686 | } |
669 | } | 687 | } |
670 | 688 | ||
671 | static void p4_shutdown(struct op_msrs const * const msrs) | ||
672 | { | ||
673 | int i; | ||
674 | |||
675 | for (i = 0; i < num_counters; ++i) { | ||
676 | if (msrs->counters[i].addr) | ||
677 | release_perfctr_nmi(msrs->counters[i].addr); | ||
678 | } | ||
679 | /* | ||
680 | * some of the control registers are specially reserved in | ||
681 | * conjunction with the counter registers (hence the starting offset). | ||
682 | * This saves a few bits. | ||
683 | */ | ||
684 | for (i = num_counters; i < num_controls; ++i) { | ||
685 | if (msrs->controls[i].addr) | ||
686 | release_evntsel_nmi(msrs->controls[i].addr); | ||
687 | } | ||
688 | } | ||
689 | |||
690 | |||
691 | #ifdef CONFIG_SMP | 689 | #ifdef CONFIG_SMP |
692 | struct op_x86_model_spec op_p4_ht2_spec = { | 690 | struct op_x86_model_spec op_p4_ht2_spec = { |
693 | .num_counters = NUM_COUNTERS_HT2, | 691 | .num_counters = NUM_COUNTERS_HT2, |
diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c index f8e268e8e99..b07d25a52f0 100644 --- a/arch/x86/oprofile/op_model_ppro.c +++ b/arch/x86/oprofile/op_model_ppro.c | |||
@@ -30,6 +30,22 @@ static int counter_width = 32; | |||
30 | 30 | ||
31 | static u64 *reset_value; | 31 | static u64 *reset_value; |
32 | 32 | ||
33 | static void ppro_shutdown(struct op_msrs const * const msrs) | ||
34 | { | ||
35 | int i; | ||
36 | |||
37 | for (i = 0; i < num_counters; ++i) { | ||
38 | if (!msrs->counters[i].addr) | ||
39 | continue; | ||
40 | release_perfctr_nmi(MSR_P6_PERFCTR0 + i); | ||
41 | release_evntsel_nmi(MSR_P6_EVNTSEL0 + i); | ||
42 | } | ||
43 | if (reset_value) { | ||
44 | kfree(reset_value); | ||
45 | reset_value = NULL; | ||
46 | } | ||
47 | } | ||
48 | |||
33 | static void ppro_fill_in_addresses(struct op_msrs * const msrs) | 49 | static void ppro_fill_in_addresses(struct op_msrs * const msrs) |
34 | { | 50 | { |
35 | int i; | 51 | int i; |
@@ -189,23 +205,6 @@ static void ppro_stop(struct op_msrs const * const msrs) | |||
189 | } | 205 | } |
190 | } | 206 | } |
191 | 207 | ||
192 | static void ppro_shutdown(struct op_msrs const * const msrs) | ||
193 | { | ||
194 | int i; | ||
195 | |||
196 | for (i = 0; i < num_counters; ++i) { | ||
197 | if (!msrs->counters[i].addr) | ||
198 | continue; | ||
199 | release_perfctr_nmi(MSR_P6_PERFCTR0 + i); | ||
200 | release_evntsel_nmi(MSR_P6_EVNTSEL0 + i); | ||
201 | } | ||
202 | if (reset_value) { | ||
203 | kfree(reset_value); | ||
204 | reset_value = NULL; | ||
205 | } | ||
206 | } | ||
207 | |||
208 | |||
209 | struct op_x86_model_spec op_ppro_spec = { | 208 | struct op_x86_model_spec op_ppro_spec = { |
210 | .num_counters = 2, | 209 | .num_counters = 2, |
211 | .num_controls = 2, | 210 | .num_controls = 2, |