ARM: perf: clean up event group validation
authorMark Rutland <mark.rutland@arm.com>
Wed, 27 Apr 2011 15:22:21 +0000 (16:22 +0100)
committerWill Deacon <will.deacon@arm.com>
Wed, 31 Aug 2011 09:50:01 +0000 (10:50 +0100)
Currently, event group validation compares each event's 'pmu' pointer
against the static 'pmu' pointer. This limits the code to supporting
only 1 PMU.

This patch changes the behaviour to consider an event's group leader's
'pmu' pointer as canonical for validation. This should ease later
generalisation of the code to support multiple PMUs at once.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Will Deacon <will.deacon@arm.com>
Reviewed-by: Jamie Iles <jamie@jamieiles.com>
Reviewed-by: Ashwin Chaugule <ashwinc@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm/kernel/perf_event.c

index 753648cf9af67828c1e9259f3c5b821b1e7c0b2c..dfde9283aec162154b982c191673ced2f5a4b4d6 100644 (file)
@@ -348,8 +348,9 @@ validate_event(struct cpu_hw_events *cpuc,
               struct perf_event *event)
 {
        struct hw_perf_event fake_event = event->hw;
+       struct pmu *leader_pmu = event->group_leader->pmu;
 
-       if (event->pmu != &pmu || event->state <= PERF_EVENT_STATE_OFF)
+       if (event->pmu != leader_pmu || event->state <= PERF_EVENT_STATE_OFF)
                return 1;
 
        return armpmu->get_event_idx(cpuc, &fake_event) >= 0;