diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-03-06 07:24:58 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-10 07:22:35 -0500 |
commit | f3d46b2e6fa57547f9884330798792afc83f4b04 (patch) | |
tree | 1c695a1706daf6ef67c940c20a558fb7b9acbfb7 /arch/x86/kernel | |
parent | 19925ce778f9fc371b9607625de3bff04c60121e (diff) |
perf, x86: Fix double enable calls
hw_perf_enable() would enable already enabled events.
This causes problems with code that assumes that ->enable/->disable calls
are balanced (like the LBR code does).
What happens is that events that were already running and left in place
would get enabled again.
Avoid this by only enabling new events that match their previous
assignment.
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/kernel')
-rw-r--r-- | arch/x86/kernel/cpu/perf_event.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 045cc0bb4c17..1d665a0b202c 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -835,6 +835,10 @@ void hw_perf_enable(void) | |||
835 | event = cpuc->event_list[i]; | 835 | event = cpuc->event_list[i]; |
836 | hwc = &event->hw; | 836 | hwc = &event->hw; |
837 | 837 | ||
838 | if (i < n_running && | ||
839 | match_prev_assignment(hwc, cpuc, i)) | ||
840 | continue; | ||
841 | |||
838 | if (hwc->idx == -1) | 842 | if (hwc->idx == -1) |
839 | x86_assign_hw_event(event, cpuc, i); | 843 | x86_assign_hw_event(event, cpuc, i); |
840 | 844 | ||