diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2016-07-13 13:16:26 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-07-14 03:34:41 -0400 |
commit | 25a77b55e74c46c79f838a97e782a45c33588ca6 (patch) | |
tree | 36101813df1709267fb9bc93d4d78a82022d19b7 | |
parent | fdc15a36d84eeb52f58b907f03fd8f77f5648235 (diff) |
xtensa/perf: Convert the hotplug notifier 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: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Chris Zankel <chris@zankel.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-xtensa@linux-xtensa.org
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160713153334.852575891@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/xtensa/kernel/perf_event.c | 26 | ||||
-rw-r--r-- | include/linux/cpuhotplug.h | 1 |
2 files changed, 10 insertions, 17 deletions
diff --git a/arch/xtensa/kernel/perf_event.c b/arch/xtensa/kernel/perf_event.c index ef90479e0397..0fecc8a2c0b5 100644 --- a/arch/xtensa/kernel/perf_event.c +++ b/arch/xtensa/kernel/perf_event.c | |||
@@ -404,7 +404,7 @@ static struct pmu xtensa_pmu = { | |||
404 | .read = xtensa_pmu_read, | 404 | .read = xtensa_pmu_read, |
405 | }; | 405 | }; |
406 | 406 | ||
407 | static void xtensa_pmu_setup(void) | 407 | static int xtensa_pmu_setup(int cpu) |
408 | { | 408 | { |
409 | unsigned i; | 409 | unsigned i; |
410 | 410 | ||
@@ -413,21 +413,7 @@ static void xtensa_pmu_setup(void) | |||
413 | set_er(0, XTENSA_PMU_PMCTRL(i)); | 413 | set_er(0, XTENSA_PMU_PMCTRL(i)); |
414 | set_er(get_er(XTENSA_PMU_PMSTAT(i)), XTENSA_PMU_PMSTAT(i)); | 414 | set_er(get_er(XTENSA_PMU_PMSTAT(i)), XTENSA_PMU_PMSTAT(i)); |
415 | } | 415 | } |
416 | } | 416 | return 0; |
417 | |||
418 | static int xtensa_pmu_notifier(struct notifier_block *self, | ||
419 | unsigned long action, void *data) | ||
420 | { | ||
421 | switch (action & ~CPU_TASKS_FROZEN) { | ||
422 | case CPU_STARTING: | ||
423 | xtensa_pmu_setup(); | ||
424 | break; | ||
425 | |||
426 | default: | ||
427 | break; | ||
428 | } | ||
429 | |||
430 | return NOTIFY_OK; | ||
431 | } | 417 | } |
432 | 418 | ||
433 | static int __init xtensa_pmu_init(void) | 419 | static int __init xtensa_pmu_init(void) |
@@ -435,7 +421,13 @@ static int __init xtensa_pmu_init(void) | |||
435 | int ret; | 421 | int ret; |
436 | int irq = irq_create_mapping(NULL, XCHAL_PROFILING_INTERRUPT); | 422 | int irq = irq_create_mapping(NULL, XCHAL_PROFILING_INTERRUPT); |
437 | 423 | ||
438 | perf_cpu_notifier(xtensa_pmu_notifier); | 424 | ret = cpuhp_setup_state(CPUHP_AP_PERF_XTENSA_STARTING, |
425 | "AP_PERF_XTENSA_STARTING", xtensa_pmu_setup, | ||
426 | NULL); | ||
427 | if (ret) { | ||
428 | pr_err("xtensa_pmu: failed to register CPU-hotplug.\n"); | ||
429 | return ret; | ||
430 | } | ||
439 | #if XTENSA_FAKE_NMI | 431 | #if XTENSA_FAKE_NMI |
440 | enable_irq(irq); | 432 | enable_irq(irq); |
441 | #else | 433 | #else |
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 2ee3c0edcc2d..f187c46eb7a1 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h | |||
@@ -30,6 +30,7 @@ enum cpuhp_state { | |||
30 | CPUHP_AP_PERF_X86_AMD_IBS_STARTING, | 30 | CPUHP_AP_PERF_X86_AMD_IBS_STARTING, |
31 | CPUHP_AP_PERF_X86_CQM_STARTING, | 31 | CPUHP_AP_PERF_X86_CQM_STARTING, |
32 | CPUHP_AP_PERF_X86_CSTATE_STARTING, | 32 | CPUHP_AP_PERF_X86_CSTATE_STARTING, |
33 | CPUHP_AP_PERF_XTENSA_STARTING, | ||
33 | CPUHP_AP_NOTIFY_STARTING, | 34 | CPUHP_AP_NOTIFY_STARTING, |
34 | CPUHP_AP_ONLINE, | 35 | CPUHP_AP_ONLINE, |
35 | CPUHP_TEARDOWN_CPU, | 36 | CPUHP_TEARDOWN_CPU, |