aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/oprofile/nmi_int.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 8cd4658370be..b211d335e075 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -160,7 +160,7 @@ static int allocate_msrs(void)
160 160
161#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX 161#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
162 162
163static void nmi_setup_cpu_mux(struct op_msrs const * const msrs) 163static void nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs)
164{ 164{
165 int i; 165 int i;
166 struct op_msr *multiplex = msrs->multiplex; 166 struct op_msr *multiplex = msrs->multiplex;
@@ -173,8 +173,15 @@ static void nmi_setup_cpu_mux(struct op_msrs const * const msrs)
173 multiplex[i].saved = 0; 173 multiplex[i].saved = 0;
174 } 174 }
175 } 175 }
176
177 per_cpu(switch_index, cpu) = 0;
176} 178}
177 179
180#else
181
182static inline void
183nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs) { }
184
178#endif 185#endif
179 186
180static void nmi_cpu_setup(void *dummy) 187static void nmi_cpu_setup(void *dummy)
@@ -184,9 +191,7 @@ static void nmi_cpu_setup(void *dummy)
184 nmi_cpu_save_registers(msrs); 191 nmi_cpu_save_registers(msrs);
185 spin_lock(&oprofilefs_lock); 192 spin_lock(&oprofilefs_lock);
186 model->setup_ctrs(model, msrs); 193 model->setup_ctrs(model, msrs);
187#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX 194 nmi_cpu_setup_mux(cpu, msrs);
188 nmi_setup_cpu_mux(msrs);
189#endif
190 spin_unlock(&oprofilefs_lock); 195 spin_unlock(&oprofilefs_lock);
191 per_cpu(saved_lvtpc, cpu) = apic_read(APIC_LVTPC); 196 per_cpu(saved_lvtpc, cpu) = apic_read(APIC_LVTPC);
192 apic_write(APIC_LVTPC, APIC_DM_NMI); 197 apic_write(APIC_LVTPC, APIC_DM_NMI);
@@ -662,9 +667,6 @@ int __init op_nmi_init(struct oprofile_operations *ops)
662 register_cpu_notifier(&oprofile_cpu_nb); 667 register_cpu_notifier(&oprofile_cpu_nb);
663#endif 668#endif
664 /* default values, can be overwritten by model */ 669 /* default values, can be overwritten by model */
665#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
666 __raw_get_cpu_var(switch_index) = 0;
667#endif
668 ops->create_files = nmi_create_files; 670 ops->create_files = nmi_create_files;
669 ops->setup = nmi_setup; 671 ops->setup = nmi_setup;
670 ops->shutdown = nmi_shutdown; 672 ops->shutdown = nmi_shutdown;