aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/oprofile
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2010-03-23 15:01:54 -0400
committerRobert Richter <robert.richter@amd.com>2010-05-04 05:35:27 -0400
commit83300ce0df6b72e156b386457aa0f0902b8c0a98 (patch)
tree0aa77779550808cd1076945b9a698dcbcca02dbe /arch/x86/oprofile
parentd0e4120fda6f87eead438eed4d49032e12060e58 (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.c24
-rw-r--r--arch/x86/oprofile/op_model_p4.c38
-rw-r--r--arch/x86/oprofile/op_model_ppro.c33
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 2e2bc902b867..7e5886d54bd5 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
129static 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
129static void op_amd_fill_in_addresses(struct op_msrs * const msrs) 141static 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
425static 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
437static u8 ibs_eilvt_off; 437static u8 ibs_eilvt_off;
438 438
439static inline void apic_init_ibs_nmi_per_cpu(void *arg) 439static 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 e6a160a4684a..7cc80df330d5 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
386static unsigned long reset_value[NUM_COUNTERS_NON_HT]; 386static unsigned long reset_value[NUM_COUNTERS_NON_HT];
387 387
388static 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
389static void p4_fill_in_addresses(struct op_msrs * const msrs) 407static 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
671static 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
692struct op_x86_model_spec op_p4_ht2_spec = { 690struct 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 f8e268e8e992..b07d25a52f02 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
31static u64 *reset_value; 31static u64 *reset_value;
32 32
33static 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
33static void ppro_fill_in_addresses(struct op_msrs * const msrs) 49static 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
192static 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
209struct op_x86_model_spec op_ppro_spec = { 208struct op_x86_model_spec op_ppro_spec = {
210 .num_counters = 2, 209 .num_counters = 2,
211 .num_controls = 2, 210 .num_controls = 2,