Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 57ecde42 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Ingo Molnar
Browse files

powerpc/perf: Convert book3s 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: 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: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160713153334.345786236@linutronix.de


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent a409f5ee
Loading
Loading
Loading
Loading
+7 −23
Original line number Original line Diff line number Diff line
@@ -2158,31 +2158,15 @@ static void perf_event_interrupt(struct pt_regs *regs)
		irq_exit();
		irq_exit();
}
}


static void power_pmu_setup(int cpu)
int power_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);


	if (!ppmu)
	if (ppmu) {
		return;
		memset(cpuhw, 0, sizeof(*cpuhw));
		memset(cpuhw, 0, sizeof(*cpuhw));
		cpuhw->mmcr[0] = MMCR0_FC;
		cpuhw->mmcr[0] = MMCR0_FC;
	}
	}

	return 0;
static int
power_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:
		power_pmu_setup(cpu);
		break;

	default:
		break;
	}

	return NOTIFY_OK;
}
}


int register_power_pmu(struct power_pmu *pmu)
int register_power_pmu(struct power_pmu *pmu)
@@ -2205,7 +2189,7 @@ int register_power_pmu(struct power_pmu *pmu)
#endif /* CONFIG_PPC64 */
#endif /* CONFIG_PPC64 */


	perf_pmu_register(&power_pmu, "cpu", PERF_TYPE_RAW);
	perf_pmu_register(&power_pmu, "cpu", PERF_TYPE_RAW);
	perf_cpu_notifier(power_pmu_notifier);
	cpuhp_setup_state(CPUHP_PERF_POWER, "PERF_POWER",

			  power_pmu_prepare_cpu, NULL);
	return 0;
	return 0;
}
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -10,6 +10,7 @@ enum cpuhp_state {
	CPUHP_PERF_X86_AMD_UNCORE_PREP,
	CPUHP_PERF_X86_AMD_UNCORE_PREP,
	CPUHP_PERF_X86_RAPL_PREP,
	CPUHP_PERF_X86_RAPL_PREP,
	CPUHP_PERF_BFIN,
	CPUHP_PERF_BFIN,
	CPUHP_PERF_POWER,
	CPUHP_NOTIFY_PREPARE,
	CPUHP_NOTIFY_PREPARE,
	CPUHP_BRINGUP_CPU,
	CPUHP_BRINGUP_CPU,
	CPUHP_AP_IDLE_DEAD,
	CPUHP_AP_IDLE_DEAD,