]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
x86/oprofile: Implement op_x86_virt_to_phys()
authorRobert Richter <robert.richter@amd.com>
Fri, 10 Jul 2009 13:47:17 +0000 (15:47 +0200)
committerRobert Richter <robert.richter@amd.com>
Mon, 20 Jul 2009 14:43:21 +0000 (16:43 +0200)
This patch implements a common x86 function to convert virtual counter
numbers to physical.

Signed-off-by: Robert Richter <robert.richter@amd.com>
arch/x86/oprofile/nmi_int.c
arch/x86/oprofile/op_model_amd.c
arch/x86/oprofile/op_x86_model.h

index 7b3362f9abdb6aeb0c6e073ab79630ade015f28d..5856e61cb098ffbdc5c86a0f645e3473d8c991bd 100644 (file)
@@ -129,6 +129,11 @@ inline int op_x86_phys_to_virt(int phys)
        return __get_cpu_var(switch_index) + phys;
 }
 
+inline int op_x86_virt_to_phys(int virt)
+{
+       return virt % model->num_counters;
+}
+
 static void nmi_shutdown_mux(void)
 {
        int i;
@@ -270,6 +275,7 @@ static void mux_clone(int cpu)
 #else
 
 inline int op_x86_phys_to_virt(int phys) { return phys; }
+inline int op_x86_virt_to_phys(int virt) { return virt; }
 static inline void nmi_shutdown_mux(void) { }
 static inline int nmi_setup_mux(void) { return 1; }
 static inline void
index dce69b5979e6554836dbd52d85d3f3f79d1ca140..1ea19829d9853771059563bdba66538f9417487a 100644 (file)
@@ -81,7 +81,7 @@ static void op_mux_fill_in_addresses(struct op_msrs * const msrs)
        int i;
 
        for (i = 0; i < NUM_VIRT_COUNTERS; i++) {
-               int hw_counter = i % NUM_COUNTERS;
+               int hw_counter = op_x86_virt_to_phys(i);
                if (reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i))
                        msrs->multiplex[i].addr = MSR_K7_PERFCTR0 + hw_counter;
                else
index 4e2e7c2c519f58a6a89cf73d9b44d85892650e7b..b83776180c7f0d7b6f321421fcf68241562419b3 100644 (file)
@@ -60,6 +60,7 @@ struct op_counter_config;
 extern u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
                           struct op_counter_config *counter_config);
 extern int op_x86_phys_to_virt(int phys);
+extern int op_x86_virt_to_phys(int virt);
 
 extern struct op_x86_model_spec op_ppro_spec;
 extern struct op_x86_model_spec op_p4_spec;