From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753047AbcGSHHV (ORCPT ); Tue, 19 Jul 2016 03:07:21 -0400 Received: from terminus.zytor.com ([198.137.202.10]:45136 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752531AbcGSHHR (ORCPT ); Tue, 19 Jul 2016 03:07:17 -0400 Date: Tue, 19 Jul 2016 00:06:28 -0700 From: tip-bot for Thomas Gleixner Message-ID: Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, maddy@linux.vnet.ibm.com, khandual@linux.vnet.ibm.com, mingo@kernel.org, anna-maria@linutronix.de, torvalds@linux-foundation.org, paulus@samba.org, sukadev@linux.vnet.ibm.com, mpe@ellerman.id.au, peterz@infradead.org, tglx@linutronix.de, bigeasy@linutronix.de, benh@kernel.crashing.org Reply-To: benh@kernel.crashing.org, bigeasy@linutronix.de, mpe@ellerman.id.au, peterz@infradead.org, tglx@linutronix.de, sukadev@linux.vnet.ibm.com, torvalds@linux-foundation.org, anna-maria@linutronix.de, paulus@samba.org, mingo@kernel.org, khandual@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, maddy@linux.vnet.ibm.com, hpa@zytor.com In-Reply-To: <20160713153334.345786236@linutronix.de> References: <20160713153334.345786236@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:smp/hotplug] powerpc/perf: Convert book3s notifier to state machine callbacks Git-Commit-ID: 57ecde42cc7493fb74029918d0a8f97aec854876 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 57ecde42cc7493fb74029918d0a8f97aec854876 Gitweb: http://git.kernel.org/tip/57ecde42cc7493fb74029918d0a8f97aec854876 Author: Thomas Gleixner AuthorDate: Wed, 13 Jul 2016 17:16:20 +0000 Committer: Ingo Molnar CommitDate: Thu, 14 Jul 2016 09:34:37 +0200 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: Thomas Gleixner Signed-off-by: Anna-Maria Gleixner Reviewed-by: Sebastian Andrzej Siewior Cc: Anshuman Khandual Cc: Benjamin Herrenschmidt Cc: Linus Torvalds Cc: Madhavan Srinivasan Cc: Michael Ellerman Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Sukadev Bhattiprolu Cc: linuxppc-dev@lists.ozlabs.org Cc: rt@linutronix.de Link: http://lkml.kernel.org/r/20160713153334.345786236@linutronix.de Signed-off-by: Ingo Molnar --- arch/powerpc/perf/core-book3s.c | 30 +++++++----------------------- include/linux/cpuhotplug.h | 1 + 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index 97a1d40..ffd61d5 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c @@ -2158,31 +2158,15 @@ static void perf_event_interrupt(struct pt_regs *regs) 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); - if (!ppmu) - return; - memset(cpuhw, 0, sizeof(*cpuhw)); - cpuhw->mmcr[0] = MMCR0_FC; -} - -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; + if (ppmu) { + memset(cpuhw, 0, sizeof(*cpuhw)); + cpuhw->mmcr[0] = MMCR0_FC; } - - return NOTIFY_OK; + return 0; } int register_power_pmu(struct power_pmu *pmu) @@ -2205,7 +2189,7 @@ int register_power_pmu(struct power_pmu *pmu) #endif /* CONFIG_PPC64 */ 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; } diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index d54973e..b265e99 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -10,6 +10,7 @@ enum cpuhp_state { CPUHP_PERF_X86_AMD_UNCORE_PREP, CPUHP_PERF_X86_RAPL_PREP, CPUHP_PERF_BFIN, + CPUHP_PERF_POWER, CPUHP_NOTIFY_PREPARE, CPUHP_BRINGUP_CPU, CPUHP_AP_IDLE_DEAD,