diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-03-06 07:47:07 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-10 07:23:36 -0500 |
commit | 4807e3d5dc7bb7057dd6ca3abb09f3da2eb8c323 (patch) | |
tree | 408ad33e37e9c0c75e3d8084e6f995d3ba91c342 /arch/x86 | |
parent | 8f4aebd2be9892bf8fb79a2d8576d3f3ee7f00f6 (diff) |
perf, x86: Fix PEBS enable/disable vs cpuc->enabled
We should never call ->enable with the pmu enabled, and we _can_ have
->disable called with the pmu enabled.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel_ds.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c index 66c6962f15f9..9ad0e67b9c82 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c | |||
@@ -338,7 +338,7 @@ static void intel_pmu_pebs_enable(struct perf_event *event) | |||
338 | hwc->config &= ~ARCH_PERFMON_EVENTSEL_INT; | 338 | hwc->config &= ~ARCH_PERFMON_EVENTSEL_INT; |
339 | 339 | ||
340 | val |= 1ULL << hwc->idx; | 340 | val |= 1ULL << hwc->idx; |
341 | wrmsrl(MSR_IA32_PEBS_ENABLE, val); | 341 | WARN_ON_ONCE(cpuc->enabled); |
342 | 342 | ||
343 | if (x86_pmu.intel_cap.pebs_trap) | 343 | if (x86_pmu.intel_cap.pebs_trap) |
344 | intel_pmu_lbr_enable(event); | 344 | intel_pmu_lbr_enable(event); |
@@ -351,7 +351,8 @@ static void intel_pmu_pebs_disable(struct perf_event *event) | |||
351 | u64 val = cpuc->pebs_enabled; | 351 | u64 val = cpuc->pebs_enabled; |
352 | 352 | ||
353 | val &= ~(1ULL << hwc->idx); | 353 | val &= ~(1ULL << hwc->idx); |
354 | wrmsrl(MSR_IA32_PEBS_ENABLE, val); | 354 | if (cpuc->enabled) |
355 | wrmsrl(MSR_IA32_PEBS_ENABLE, val); | ||
355 | 356 | ||
356 | hwc->config |= ARCH_PERFMON_EVENTSEL_INT; | 357 | hwc->config |= ARCH_PERFMON_EVENTSEL_INT; |
357 | 358 | ||