perf, x86: Call x86_setup_perfctr() from .hw_config()
authorRobert Richter <robert.richter@amd.com>
Tue, 13 Apr 2010 20:23:12 +0000 (22:23 +0200)
committerIngo Molnar <mingo@elte.hu>
Fri, 7 May 2010 09:31:00 +0000 (11:31 +0200)
The perfctr setup calls are in the corresponding .hw_config()
functions now. This makes it possible to introduce config functions
for other pmu events that are not perfctr specific.

Also, all of a sudden the code looks much nicer.

Signed-off-by: Robert Richter <robert.richter@amd.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1271190201-25705-4-git-send-email-robert.richter@amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/cpu/perf_event.c
arch/x86/kernel/cpu/perf_event_p4.c

index 3d3bceb9e830efd3b9b8962915d19e5539a21cf5..c2c1e10f7b037d746feb10115132a9fa117f672d 100644 (file)
@@ -505,7 +505,7 @@ static int x86_pmu_hw_config(struct perf_event *event)
        if (event->attr.type == PERF_TYPE_RAW)
                event->hw.config |= event->attr.config & X86_RAW_EVENT_MASK;
 
-       return 0;
+       return x86_setup_perfctr(event);
 }
 
 /*
@@ -543,12 +543,7 @@ static int __hw_perf_event_init(struct perf_event *event)
        event->hw.last_cpu = -1;
        event->hw.last_tag = ~0ULL;
 
-       /* Processor specifics */
-       err = x86_pmu.hw_config(event);
-       if (err)
-               return err;
-
-       return x86_setup_perfctr(event);
+       return x86_pmu.hw_config(event);
 }
 
 static void x86_pmu_disable_all(void)
index 15367cce66bd85c35a6b44edf06063ecdf51ec25..9e002054cb5f37dfcb7ce2feccda40c369764ba8 100644 (file)
@@ -455,7 +455,7 @@ static int p4_hw_config(struct perf_event *event)
                (p4_config_pack_escr(P4_ESCR_MASK_HT) |
                 p4_config_pack_cccr(P4_CCCR_MASK_HT));
 
-       return 0;
+       return x86_setup_perfctr(event);
 }
 
 static inline void p4_pmu_clear_cccr_ovf(struct hw_perf_event *hwc)