aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/perf_event.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2010-03-05 07:01:18 -0500
committerIngo Molnar <mingo@elte.hu>2010-03-10 07:22:24 -0500
commit3f6da3905398826d85731247e7fbcf53400c18bd (patch)
tree3e01248974385999fb8e7f8d5daa53b46228f649 /arch/sh/kernel/perf_event.c
parentdc1d628a67a8f042e711ea5accc0beedc3ef0092 (diff)
perf: Rework and fix the arch CPU-hotplug hooks
Remove the hw_perf_event_*() hotplug hooks in favour of per PMU hotplug notifiers. This has the advantage of reducing the static weak interface as well as exposing all hotplug actions to the PMU. Use this to fix x86 hotplug usage where we did things in ONLINE which should have been done in UP_PREPARE or STARTING. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mundt <lethal@linux-sh.org> Cc: paulus@samba.org Cc: eranian@google.com Cc: robert.richter@amd.com Cc: fweisbec@gmail.com Cc: Arnaldo Carvalho de Melo <acme@infradead.org> LKML-Reference: <20100305154128.736225361@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/sh/kernel/perf_event.c')
-rw-r--r--arch/sh/kernel/perf_event.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/arch/sh/kernel/perf_event.c b/arch/sh/kernel/perf_event.c
index 7ff0943e7a08..9f253e9cce01 100644
--- a/arch/sh/kernel/perf_event.c
+++ b/arch/sh/kernel/perf_event.c
@@ -275,13 +275,30 @@ const struct pmu *hw_perf_event_init(struct perf_event *event)
275 return &pmu; 275 return &pmu;
276} 276}
277 277
278void hw_perf_event_setup(int cpu) 278static void sh_pmu_setup(int cpu)
279{ 279{
280 struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu); 280 struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu);
281 281
282 memset(cpuhw, 0, sizeof(struct cpu_hw_events)); 282 memset(cpuhw, 0, sizeof(struct cpu_hw_events));
283} 283}
284 284
285static int __cpuinit
286sh_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
287{
288 unsigned int cpu = (long)hcpu;
289
290 switch (action & ~CPU_TASKS_FROZEN) {
291 case CPU_UP_PREPARE:
292 sh_pmu_setup(cpu);
293 break;
294
295 default:
296 break;
297 }
298
299 return NOTIFY_OK;
300}
301
285void hw_perf_enable(void) 302void hw_perf_enable(void)
286{ 303{
287 if (!sh_pmu_initialized()) 304 if (!sh_pmu_initialized())
@@ -308,5 +325,6 @@ int register_sh_pmu(struct sh_pmu *pmu)
308 325
309 WARN_ON(pmu->num_events > MAX_HWEVENTS); 326 WARN_ON(pmu->num_events > MAX_HWEVENTS);
310 327
328 perf_cpu_notifier(sh_pmu_notifier);
311 return 0; 329 return 0;
312} 330}