Commit 65b4711f authored by Will Deacon's avatar Will Deacon Committed by Russell King

ARM: 6352/1: perf: fix event validation

The validate_event function in the ARM perf events backend has the
following problems:

1.) Events that are disabled count towards the cost.
2.) Events associated with other PMUs [for example, software events or
    breakpoints] do not count towards the cost, but do fail validation,
    causing the group to fail.

This patch changes validate_event so that it ignores events in the
PERF_EVENT_STATE_OFF state or that are scheduled for other PMUs.
Reported-by: default avatarPawel Moll <pawel.moll@arm.com>
Acked-by: default avatarJamie Iles <jamie.iles@picochip.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 026b5ca3
...@@ -319,8 +319,8 @@ validate_event(struct cpu_hw_events *cpuc, ...@@ -319,8 +319,8 @@ validate_event(struct cpu_hw_events *cpuc,
{ {
struct hw_perf_event fake_event = event->hw; struct hw_perf_event fake_event = event->hw;
if (event->pmu && event->pmu != &pmu) if (event->pmu != &pmu || event->state <= PERF_EVENT_STATE_OFF)
return 0; return 1;
return armpmu->get_event_idx(cpuc, &fake_event) >= 0; return armpmu->get_event_idx(cpuc, &fake_event) >= 0;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment