aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorStephane Eranian <eranian@google.com>2009-11-24 08:27:18 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-24 13:23:48 -0500
commit1261a02a0c0ab8e643125705f0d1d83e5090e4d1 (patch)
treef88fb71a8ef8c80c4d9be6bbee9869dd895fb330 /arch
parentfcf1203a919c3a3d212c0ed01f5240fd592bf5ae (diff)
perf_events, x86: Fix validate_event bug
The validate_event() was failing on valid event combinations. The function was assuming that if x86_schedule_event() returned 0, it meant error. But x86_schedule_event() returns the counter index and 0 is a perfectly valid value. An error is returned if the function returns a negative value. Furthermore, validate_event() was also failing for event groups because the event->pmu was not set until after hw_perf_event_init(). Signed-off-by: Stephane Eranian <eranian@google.com> Cc: peterz@infradead.org Cc: paulus@samba.org Cc: perfmon2-devel@lists.sourceforge.net Cc: eranian@gmail.com LKML-Reference: <4b0bdf36.1818d00a.07cc.25ae@mx.google.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> -- arch/x86/kernel/cpu/perf_event.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/cpu/perf_event.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index bd8743024204..c1bbed1021d9 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -2229,10 +2229,10 @@ validate_event(struct cpu_hw_events *cpuc, struct perf_event *event)
2229{ 2229{
2230 struct hw_perf_event fake_event = event->hw; 2230 struct hw_perf_event fake_event = event->hw;
2231 2231
2232 if (event->pmu != &pmu) 2232 if (event->pmu && event->pmu != &pmu)
2233 return 0; 2233 return 0;
2234 2234
2235 return x86_schedule_event(cpuc, &fake_event); 2235 return x86_schedule_event(cpuc, &fake_event) >= 0;
2236} 2236}
2237 2237
2238static int validate_group(struct perf_event *event) 2238static int validate_group(struct perf_event *event)