diff options
author | Robert Richter <robert.richter@amd.com> | 2009-07-09 13:23:50 -0400 |
---|---|---|
committer | Robert Richter <robert.richter@amd.com> | 2009-07-20 10:43:18 -0400 |
commit | 6bfccd099c2841e1c42530f1b6d2553bfa13be3a (patch) | |
tree | 8452ce819376efe5e1d755bb548a886ea09b6219 /arch/x86/oprofile | |
parent | 82a225283fb0d9438549595d9e6f3ecc42b42ad6 (diff) |
x86/oprofile: Fix initialization of switch_index
Variable switch_index must be initialized for each cpu. This patch
fixes the initialization by moving it to the per-cpu init function
nmi_cpu_setup().
Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'arch/x86/oprofile')
-rw-r--r-- | arch/x86/oprofile/nmi_int.c | 16 |
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 | ||
163 | static void nmi_setup_cpu_mux(struct op_msrs const * const msrs) | 163 | static 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 | |||
182 | static inline void | ||
183 | nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs) { } | ||
184 | |||
178 | #endif | 185 | #endif |
179 | 186 | ||
180 | static void nmi_cpu_setup(void *dummy) | 187 | static 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; |