aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2016-07-13 13:16:19 -0400
committerIngo Molnar <mingo@kernel.org>2016-07-14 03:34:36 -0400
commita409f5ee2937cb15b4af485fa98b90946d9bea3a (patch)
tree2026ed8b98990c9e697215929ef7b8dfaa2b005e
parent77c34ef1c3194bfac65883af75baf7dec9fa0d77 (diff)
blackfin/perf: Convert hotplug notifier to state machine
Install the callback via the state machine and let the core invoke the callbacks on the already online CPUs. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de> Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Miao <realmz6@gmail.com> Cc: adi-buildroot-devel@lists.sourceforge.net Cc: rt@linutronix.de Link: http://lkml.kernel.org/r/20160713153334.265797537@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/blackfin/kernel/perf_event.c26
-rw-r--r--include/linux/cpuhotplug.h1
2 files changed, 6 insertions, 21 deletions
diff --git a/arch/blackfin/kernel/perf_event.c b/arch/blackfin/kernel/perf_event.c
index 170d786807c4..6355e97d22b9 100644
--- a/arch/blackfin/kernel/perf_event.c
+++ b/arch/blackfin/kernel/perf_event.c
@@ -453,29 +453,13 @@ static struct pmu pmu = {
453 .read = bfin_pmu_read, 453 .read = bfin_pmu_read,
454}; 454};
455 455
456static void bfin_pmu_setup(int cpu) 456static int bfin_pmu_prepare_cpu(unsigned int cpu)
457{ 457{
458 struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu); 458 struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu);
459 459
460 bfin_write_PFCTL(0);
460 memset(cpuhw, 0, sizeof(struct cpu_hw_events)); 461 memset(cpuhw, 0, sizeof(struct cpu_hw_events));
461} 462 return 0;
462
463static int
464bfin_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
465{
466 unsigned int cpu = (long)hcpu;
467
468 switch (action & ~CPU_TASKS_FROZEN) {
469 case CPU_UP_PREPARE:
470 bfin_write_PFCTL(0);
471 bfin_pmu_setup(cpu);
472 break;
473
474 default:
475 break;
476 }
477
478 return NOTIFY_OK;
479} 463}
480 464
481static int __init bfin_pmu_init(void) 465static int __init bfin_pmu_init(void)
@@ -491,8 +475,8 @@ static int __init bfin_pmu_init(void)
491 475
492 ret = perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW); 476 ret = perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW);
493 if (!ret) 477 if (!ret)
494 perf_cpu_notifier(bfin_pmu_notifier); 478 cpuhp_setup_state(CPUHP_PERF_BFIN, "PERF_BFIN",
495 479 bfin_pmu_prepare_cpu, NULL);
496 return ret; 480 return ret;
497} 481}
498early_initcall(bfin_pmu_init); 482early_initcall(bfin_pmu_init);
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 68f4495f4988..d54973e62366 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -9,6 +9,7 @@ enum cpuhp_state {
9 CPUHP_PERF_X86_UNCORE_PREP, 9 CPUHP_PERF_X86_UNCORE_PREP,
10 CPUHP_PERF_X86_AMD_UNCORE_PREP, 10 CPUHP_PERF_X86_AMD_UNCORE_PREP,
11 CPUHP_PERF_X86_RAPL_PREP, 11 CPUHP_PERF_X86_RAPL_PREP,
12 CPUHP_PERF_BFIN,
12 CPUHP_NOTIFY_PREPARE, 13 CPUHP_NOTIFY_PREPARE,
13 CPUHP_BRINGUP_CPU, 14 CPUHP_BRINGUP_CPU,
14 CPUHP_AP_IDLE_DEAD, 15 CPUHP_AP_IDLE_DEAD,