diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2016-07-13 13:16:22 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-07-14 03:34:38 -0400 |
commit | e3d617fe6ac7294974fc513dc5e4d8ada8080fd1 (patch) | |
tree | 9ada7d57019fe7bce35807face130306b4c41b87 | |
parent | 4f0f8217e69a0f6ff727913aa49cb64632ff7b6a (diff) |
s390/perf: Convert the hotplug notifier to state machine callbacks (Sampling)
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: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-s390@vger.kernel.org
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160713153334.518084858@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/s390/kernel/perf_cpum_sf.c | 45 | ||||
-rw-r--r-- | include/linux/cpuhotplug.h | 1 |
2 files changed, 20 insertions, 26 deletions
diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c index a8e832166417..f4a4c118f8b4 100644 --- a/arch/s390/kernel/perf_cpum_sf.c +++ b/arch/s390/kernel/perf_cpum_sf.c | |||
@@ -1506,37 +1506,28 @@ static void cpumf_measurement_alert(struct ext_code ext_code, | |||
1506 | sf_disable(); | 1506 | sf_disable(); |
1507 | } | 1507 | } |
1508 | } | 1508 | } |
1509 | 1509 | static int cpusf_pmu_setup(unsigned int cpu, int flags) | |
1510 | static int cpumf_pmu_notifier(struct notifier_block *self, | ||
1511 | unsigned long action, void *hcpu) | ||
1512 | { | 1510 | { |
1513 | int flags; | ||
1514 | |||
1515 | /* Ignore the notification if no events are scheduled on the PMU. | 1511 | /* Ignore the notification if no events are scheduled on the PMU. |
1516 | * This might be racy... | 1512 | * This might be racy... |
1517 | */ | 1513 | */ |
1518 | if (!atomic_read(&num_events)) | 1514 | if (!atomic_read(&num_events)) |
1519 | return NOTIFY_OK; | 1515 | return 0; |
1520 | |||
1521 | switch (action & ~CPU_TASKS_FROZEN) { | ||
1522 | case CPU_ONLINE: | ||
1523 | case CPU_DOWN_FAILED: | ||
1524 | flags = PMC_INIT; | ||
1525 | local_irq_disable(); | ||
1526 | setup_pmc_cpu(&flags); | ||
1527 | local_irq_enable(); | ||
1528 | break; | ||
1529 | case CPU_DOWN_PREPARE: | ||
1530 | flags = PMC_RELEASE; | ||
1531 | local_irq_disable(); | ||
1532 | setup_pmc_cpu(&flags); | ||
1533 | local_irq_enable(); | ||
1534 | break; | ||
1535 | default: | ||
1536 | break; | ||
1537 | } | ||
1538 | 1516 | ||
1539 | return NOTIFY_OK; | 1517 | local_irq_disable(); |
1518 | setup_pmc_cpu(&flags); | ||
1519 | local_irq_enable(); | ||
1520 | return 0; | ||
1521 | } | ||
1522 | |||
1523 | static int s390_pmu_sf_online_cpu(unsigned int cpu) | ||
1524 | { | ||
1525 | return cpusf_pmu_setup(cpu, PMC_INIT); | ||
1526 | } | ||
1527 | |||
1528 | static int s390_pmu_sf_offline_cpu(unsigned int cpu) | ||
1529 | { | ||
1530 | return cpusf_pmu_setup(cpu, PMC_RELEASE); | ||
1540 | } | 1531 | } |
1541 | 1532 | ||
1542 | static int param_get_sfb_size(char *buffer, const struct kernel_param *kp) | 1533 | static int param_get_sfb_size(char *buffer, const struct kernel_param *kp) |
@@ -1636,7 +1627,9 @@ static int __init init_cpum_sampling_pmu(void) | |||
1636 | cpumf_measurement_alert); | 1627 | cpumf_measurement_alert); |
1637 | goto out; | 1628 | goto out; |
1638 | } | 1629 | } |
1639 | perf_cpu_notifier(cpumf_pmu_notifier); | 1630 | |
1631 | cpuhp_setup_state(CPUHP_AP_PERF_S390_SF_ONLINE, "AP_PERF_S390_SF_ONLINE", | ||
1632 | s390_pmu_sf_online_cpu, s390_pmu_sf_offline_cpu); | ||
1640 | out: | 1633 | out: |
1641 | return err; | 1634 | return err; |
1642 | } | 1635 | } |
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index d4e09cb0c100..fea66667d190 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h | |||
@@ -43,6 +43,7 @@ enum cpuhp_state { | |||
43 | CPUHP_AP_PERF_X86_CQM_ONLINE, | 43 | CPUHP_AP_PERF_X86_CQM_ONLINE, |
44 | CPUHP_AP_PERF_X86_CSTATE_ONLINE, | 44 | CPUHP_AP_PERF_X86_CSTATE_ONLINE, |
45 | CPUHP_AP_PERF_S390_CF_ONLINE, | 45 | CPUHP_AP_PERF_S390_CF_ONLINE, |
46 | CPUHP_AP_PERF_S390_SF_ONLINE, | ||
46 | CPUHP_AP_NOTIFY_ONLINE, | 47 | CPUHP_AP_NOTIFY_ONLINE, |
47 | CPUHP_AP_ONLINE_DYN, | 48 | CPUHP_AP_ONLINE_DYN, |
48 | CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30, | 49 | CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30, |