aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/oprofile/nmi_int.c
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2009-07-09 08:38:49 -0400
committerRobert Richter <robert.richter@amd.com>2009-07-20 10:43:20 -0400
commit48fb4b46712c7d3e8adc79826311abd9ccbf7f1d (patch)
treef76c9ef2ff2916d56cbfcc71190841bff97a5868 /arch/x86/oprofile/nmi_int.c
parent6ab82f958a5dca591a6ea17a3ca6f2aca06f4f2f (diff)
x86/oprofile: Moving nmi_setup_cpu_mux() in nmi_int.c
This patch moves some code in nmi_int.c to get a single separate multiplexing code section. Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'arch/x86/oprofile/nmi_int.c')
-rw-r--r--arch/x86/oprofile/nmi_int.c45
1 files changed, 19 insertions, 26 deletions
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 674fa37d1502..b1edfc922e7f 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -130,11 +130,30 @@ static int nmi_setup_mux(void)
130 return 1; 130 return 1;
131} 131}
132 132
133static void nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs)
134{
135 int i;
136 struct op_msr *multiplex = msrs->multiplex;
137
138 for (i = 0; i < model->num_virt_counters; ++i) {
139 if (counter_config[i].enabled) {
140 multiplex[i].saved = -(u64)counter_config[i].count;
141 } else {
142 multiplex[i].addr = 0;
143 multiplex[i].saved = 0;
144 }
145 }
146
147 per_cpu(switch_index, cpu) = 0;
148}
149
133#else 150#else
134 151
135inline int op_x86_phys_to_virt(int phys) { return phys; } 152inline int op_x86_phys_to_virt(int phys) { return phys; }
136static inline void nmi_shutdown_mux(void) { } 153static inline void nmi_shutdown_mux(void) { }
137static inline int nmi_setup_mux(void) { return 1; } 154static inline int nmi_setup_mux(void) { return 1; }
155static inline void
156nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs) { }
138 157
139#endif 158#endif
140 159
@@ -169,32 +188,6 @@ static int allocate_msrs(void)
169 return 1; 188 return 1;
170} 189}
171 190
172#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
173
174static void nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs)
175{
176 int i;
177 struct op_msr *multiplex = msrs->multiplex;
178
179 for (i = 0; i < model->num_virt_counters; ++i) {
180 if (counter_config[i].enabled) {
181 multiplex[i].saved = -(u64)counter_config[i].count;
182 } else {
183 multiplex[i].addr = 0;
184 multiplex[i].saved = 0;
185 }
186 }
187
188 per_cpu(switch_index, cpu) = 0;
189}
190
191#else
192
193static inline void
194nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs) { }
195
196#endif
197
198static void nmi_cpu_setup(void *dummy) 191static void nmi_cpu_setup(void *dummy)
199{ 192{
200 int cpu = smp_processor_id(); 193 int cpu = smp_processor_id();