diff options
Diffstat (limited to 'arch/x86/kernel/cpu/perf_event.c')
-rw-r--r-- | arch/x86/kernel/cpu/perf_event.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 7b4f1e871f7c..3eb88ebcec5a 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -178,7 +178,7 @@ static void release_pmc_hardware(void) {} | |||
178 | 178 | ||
179 | static bool check_hw_exists(void) | 179 | static bool check_hw_exists(void) |
180 | { | 180 | { |
181 | u64 val, val_new = 0; | 181 | u64 val, val_new = ~0; |
182 | int i, reg, ret = 0; | 182 | int i, reg, ret = 0; |
183 | 183 | ||
184 | /* | 184 | /* |
@@ -211,8 +211,9 @@ static bool check_hw_exists(void) | |||
211 | * that don't trap on the MSR access and always return 0s. | 211 | * that don't trap on the MSR access and always return 0s. |
212 | */ | 212 | */ |
213 | val = 0xabcdUL; | 213 | val = 0xabcdUL; |
214 | ret = wrmsrl_safe(x86_pmu_event_addr(0), val); | 214 | reg = x86_pmu_event_addr(0); |
215 | ret |= rdmsrl_safe(x86_pmu_event_addr(0), &val_new); | 215 | ret = wrmsrl_safe(reg, val); |
216 | ret |= rdmsrl_safe(reg, &val_new); | ||
216 | if (ret || val != val_new) | 217 | if (ret || val != val_new) |
217 | goto msr_fail; | 218 | goto msr_fail; |
218 | 219 | ||
@@ -229,6 +230,7 @@ bios_fail: | |||
229 | 230 | ||
230 | msr_fail: | 231 | msr_fail: |
231 | printk(KERN_CONT "Broken PMU hardware detected, using software events only.\n"); | 232 | printk(KERN_CONT "Broken PMU hardware detected, using software events only.\n"); |
233 | printk(KERN_ERR "Failed to access perfctr msr (MSR %x is %Lx)\n", reg, val_new); | ||
232 | 234 | ||
233 | return false; | 235 | return false; |
234 | } | 236 | } |