diff options
author | Mark Rutland <mark.rutland@arm.com> | 2011-08-23 06:59:49 -0400 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2011-08-31 05:50:13 -0400 |
commit | 7325eaec439cd0cc8c9b61b59d41d99abace1b23 (patch) | |
tree | 802b05381659791a59db17827702f60202a4afbd /arch | |
parent | 0ce47080dfffe71edd433b35dcdada24c61079eb (diff) |
ARM: perf: Remove unnecessary armpmu->enable()s
Currently, armpmu_enable iterates through the events for a given
counter set, calling armpmu->enable on each before calling
armpmu->start to start the PMU's counters.
As armpmu->enable is called when each event is added, each event is
already configured in hardware. Due to this, calling armpmu->enable
in armpmu_enable is unnecessary and confusing.
This patch removes the unnecessary calls to armpmu->enable.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/kernel/perf_event.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index aaa631b8cbc2..e6e5d7c84f1a 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | #define pr_fmt(fmt) "hw perfevents: " fmt | 13 | #define pr_fmt(fmt) "hw perfevents: " fmt |
14 | 14 | ||
15 | #include <linux/bitmap.h> | ||
15 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
16 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
17 | #include <linux/module.h> | 18 | #include <linux/module.h> |
@@ -557,20 +558,9 @@ static int armpmu_event_init(struct perf_event *event) | |||
557 | 558 | ||
558 | static void armpmu_enable(struct pmu *pmu) | 559 | static void armpmu_enable(struct pmu *pmu) |
559 | { | 560 | { |
560 | /* Enable all of the perf events on hardware. */ | ||
561 | struct arm_pmu *armpmu = to_arm_pmu(pmu); | 561 | struct arm_pmu *armpmu = to_arm_pmu(pmu); |
562 | int idx, enabled = 0; | ||
563 | struct pmu_hw_events *hw_events = armpmu->get_hw_events(); | 562 | struct pmu_hw_events *hw_events = armpmu->get_hw_events(); |
564 | 563 | int enabled = bitmap_weight(hw_events->used_mask, armpmu->num_events); | |
565 | for (idx = 0; idx < armpmu->num_events; ++idx) { | ||
566 | struct perf_event *event = hw_events->events[idx]; | ||
567 | |||
568 | if (!event) | ||
569 | continue; | ||
570 | |||
571 | armpmu->enable(&event->hw, idx); | ||
572 | enabled = 1; | ||
573 | } | ||
574 | 564 | ||
575 | if (enabled) | 565 | if (enabled) |
576 | armpmu->start(); | 566 | armpmu->start(); |