Commit e3d617fe authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Ingo Molnar

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: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarAnna-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.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 4f0f8217
...@@ -1506,37 +1506,28 @@ static void cpumf_measurement_alert(struct ext_code ext_code, ...@@ -1506,37 +1506,28 @@ static void cpumf_measurement_alert(struct ext_code ext_code,
sf_disable(); sf_disable();
} }
} }
static int cpusf_pmu_setup(unsigned int cpu, int flags)
static int cpumf_pmu_notifier(struct notifier_block *self,
unsigned long action, void *hcpu)
{ {
int flags;
/* Ignore the notification if no events are scheduled on the PMU. /* Ignore the notification if no events are scheduled on the PMU.
* This might be racy... * This might be racy...
*/ */
if (!atomic_read(&num_events)) if (!atomic_read(&num_events))
return NOTIFY_OK; return 0;
switch (action & ~CPU_TASKS_FROZEN) {
case CPU_ONLINE:
case CPU_DOWN_FAILED:
flags = PMC_INIT;
local_irq_disable(); local_irq_disable();
setup_pmc_cpu(&flags); setup_pmc_cpu(&flags);
local_irq_enable(); local_irq_enable();
break; return 0;
case CPU_DOWN_PREPARE: }
flags = PMC_RELEASE;
local_irq_disable();
setup_pmc_cpu(&flags);
local_irq_enable();
break;
default:
break;
}
return NOTIFY_OK; static int s390_pmu_sf_online_cpu(unsigned int cpu)
{
return cpusf_pmu_setup(cpu, PMC_INIT);
}
static int s390_pmu_sf_offline_cpu(unsigned int cpu)
{
return cpusf_pmu_setup(cpu, PMC_RELEASE);
} }
static int param_get_sfb_size(char *buffer, const struct kernel_param *kp) 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,7 +1627,9 @@ static int __init init_cpum_sampling_pmu(void)
cpumf_measurement_alert); cpumf_measurement_alert);
goto out; goto out;
} }
perf_cpu_notifier(cpumf_pmu_notifier);
cpuhp_setup_state(CPUHP_AP_PERF_S390_SF_ONLINE, "AP_PERF_S390_SF_ONLINE",
s390_pmu_sf_online_cpu, s390_pmu_sf_offline_cpu);
out: out:
return err; return err;
} }
......
...@@ -43,6 +43,7 @@ enum cpuhp_state { ...@@ -43,6 +43,7 @@ enum cpuhp_state {
CPUHP_AP_PERF_X86_CQM_ONLINE, CPUHP_AP_PERF_X86_CQM_ONLINE,
CPUHP_AP_PERF_X86_CSTATE_ONLINE, CPUHP_AP_PERF_X86_CSTATE_ONLINE,
CPUHP_AP_PERF_S390_CF_ONLINE, CPUHP_AP_PERF_S390_CF_ONLINE,
CPUHP_AP_PERF_S390_SF_ONLINE,
CPUHP_AP_NOTIFY_ONLINE, CPUHP_AP_NOTIFY_ONLINE,
CPUHP_AP_ONLINE_DYN, CPUHP_AP_ONLINE_DYN,
CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30, CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30,
......
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