Commit e3cfce17 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Ingo Molnar

sh/perf: Convert the hotplug notifiers to state machine callbacks

Install the callbacks via the state machine and let the core invoke
the callbacks on the already online CPUs.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarAnna-Maria Gleixner <anna-maria@linutronix.de>
Reviewed-by: default avatarSebastian 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: Rich Felker <dalias@libc.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: linux-sh@vger.kernel.org
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160713153334.597790464@linutronix.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent e3d617fe
...@@ -352,28 +352,12 @@ static struct pmu pmu = { ...@@ -352,28 +352,12 @@ static struct pmu pmu = {
.read = sh_pmu_read, .read = sh_pmu_read,
}; };
static void sh_pmu_setup(int cpu) static int sh_pmu_prepare_cpu(unsigned int cpu)
{ {
struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu); struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu);
memset(cpuhw, 0, sizeof(struct cpu_hw_events)); memset(cpuhw, 0, sizeof(struct cpu_hw_events));
} return 0;
static int
sh_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
{
unsigned int cpu = (long)hcpu;
switch (action & ~CPU_TASKS_FROZEN) {
case CPU_UP_PREPARE:
sh_pmu_setup(cpu);
break;
default:
break;
}
return NOTIFY_OK;
} }
int register_sh_pmu(struct sh_pmu *_pmu) int register_sh_pmu(struct sh_pmu *_pmu)
...@@ -394,6 +378,7 @@ int register_sh_pmu(struct sh_pmu *_pmu) ...@@ -394,6 +378,7 @@ int register_sh_pmu(struct sh_pmu *_pmu)
WARN_ON(_pmu->num_events > MAX_HWEVENTS); WARN_ON(_pmu->num_events > MAX_HWEVENTS);
perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW); perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW);
perf_cpu_notifier(sh_pmu_notifier); cpuhp_setup_state(CPUHP_PERF_SUPERH, "PERF_SUPERH", sh_pmu_prepare_cpu,
NULL);
return 0; return 0;
} }
...@@ -11,6 +11,7 @@ enum cpuhp_state { ...@@ -11,6 +11,7 @@ enum cpuhp_state {
CPUHP_PERF_X86_RAPL_PREP, CPUHP_PERF_X86_RAPL_PREP,
CPUHP_PERF_BFIN, CPUHP_PERF_BFIN,
CPUHP_PERF_POWER, CPUHP_PERF_POWER,
CPUHP_PERF_SUPERH,
CPUHP_NOTIFY_PREPARE, CPUHP_NOTIFY_PREPARE,
CPUHP_BRINGUP_CPU, CPUHP_BRINGUP_CPU,
CPUHP_AP_IDLE_DEAD, CPUHP_AP_IDLE_DEAD,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment