Commit f4f38430 authored by Will Deacon's avatar Will Deacon Committed by Russell King

ARM: 6989/1: perf: do not start the PMU when no events are present

armpmu_enable can be called in situations where no events are present
(for example, from the event rotation tick after a profiled task has
exited). In this case, we currently start the PMU anyway which may
leave it active inevitably without any events being monitored.

This patch adds a simple check to the enabling code so that we avoid
starting the PMU when no events are present.

Cc: <stable@kernel.org>
Reported-by: default avatarAshwin Chaugle <ashwinc@codeaurora.org>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 17878362
...@@ -583,7 +583,7 @@ static int armpmu_event_init(struct perf_event *event) ...@@ -583,7 +583,7 @@ static int armpmu_event_init(struct perf_event *event)
static void armpmu_enable(struct pmu *pmu) static void armpmu_enable(struct pmu *pmu)
{ {
/* Enable all of the perf events on hardware. */ /* Enable all of the perf events on hardware. */
int idx; int idx, enabled = 0;
struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
if (!armpmu) if (!armpmu)
...@@ -596,8 +596,10 @@ static void armpmu_enable(struct pmu *pmu) ...@@ -596,8 +596,10 @@ static void armpmu_enable(struct pmu *pmu)
continue; continue;
armpmu->enable(&event->hw, idx); armpmu->enable(&event->hw, idx);
enabled = 1;
} }
if (enabled)
armpmu->start(); armpmu->start();
} }
......
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