diff options
author | Will Deacon <will.deacon@arm.com> | 2011-07-01 14:38:12 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-07-05 12:37:23 +0100 |
commit | f4f38430c94c38187db73a2cf3892cc8b12a2713 (patch) | |
tree | e8101e5202bfe600f928f3f2400dfd5afa4b54f6 /arch | |
parent | 178783622ce0fd629fad21b33b8f8f56b64c5e45 (diff) | |
download | linux-f4f38430c94c38187db73a2cf3892cc8b12a2713.tar.gz linux-f4f38430c94c38187db73a2cf3892cc8b12a2713.tar.bz2 linux-f4f38430c94c38187db73a2cf3892cc8b12a2713.zip |
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: Ashwin Chaugle <ashwinc@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/kernel/perf_event.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index d53c0abc4dd3..2b5b1421596c 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c @@ -583,7 +583,7 @@ static int armpmu_event_init(struct perf_event *event) static void armpmu_enable(struct pmu *pmu) { /* 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); if (!armpmu) @@ -596,9 +596,11 @@ static void armpmu_enable(struct pmu *pmu) continue; armpmu->enable(&event->hw, idx); + enabled = 1; } - armpmu->start(); + if (enabled) + armpmu->start(); } static void armpmu_disable(struct pmu *pmu) |