From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753162AbcGSHGa (ORCPT ); Tue, 19 Jul 2016 03:06:30 -0400 Received: from terminus.zytor.com ([198.137.202.10]:45076 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753148AbcGSHGX (ORCPT ); Tue, 19 Jul 2016 03:06:23 -0400 Date: Tue, 19 Jul 2016 00:05:53 -0700 From: tip-bot for Thomas Gleixner Message-ID: Cc: hpa@zytor.com, linux-kernel@vger.kernel.org, acme@kernel.org, alexander.shishkin@linux.intel.com, bigeasy@linutronix.de, mingo@kernel.org, tglx@linutronix.de, peterz@infradead.org, realmz6@gmail.com, torvalds@linux-foundation.org, anna-maria@linutronix.de Reply-To: alexander.shishkin@linux.intel.com, acme@kernel.org, bigeasy@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, anna-maria@linutronix.de, tglx@linutronix.de, mingo@kernel.org, realmz6@gmail.com, peterz@infradead.org In-Reply-To: <20160713153334.265797537@linutronix.de> References: <20160713153334.265797537@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:smp/hotplug] blackfin/perf: Convert hotplug notifier to state machine Git-Commit-ID: a409f5ee2937cb15b4af485fa98b90946d9bea3a 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: a409f5ee2937cb15b4af485fa98b90946d9bea3a Gitweb: http://git.kernel.org/tip/a409f5ee2937cb15b4af485fa98b90946d9bea3a Author: Thomas Gleixner AuthorDate: Wed, 13 Jul 2016 17:16:19 +0000 Committer: Ingo Molnar CommitDate: Thu, 14 Jul 2016 09:34:36 +0200 blackfin/perf: Convert hotplug notifier to state machine Install the callback 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: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Steven Miao Cc: adi-buildroot-devel@lists.sourceforge.net Cc: rt@linutronix.de Link: http://lkml.kernel.org/r/20160713153334.265797537@linutronix.de Signed-off-by: Ingo Molnar --- arch/blackfin/kernel/perf_event.c | 26 +++++--------------------- include/linux/cpuhotplug.h | 1 + 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/arch/blackfin/kernel/perf_event.c b/arch/blackfin/kernel/perf_event.c index 170d786..6355e97 100644 --- a/arch/blackfin/kernel/perf_event.c +++ b/arch/blackfin/kernel/perf_event.c @@ -453,29 +453,13 @@ static struct pmu pmu = { .read = bfin_pmu_read, }; -static void bfin_pmu_setup(int cpu) +static int bfin_pmu_prepare_cpu(unsigned int cpu) { struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu); + bfin_write_PFCTL(0); memset(cpuhw, 0, sizeof(struct cpu_hw_events)); -} - -static int -bfin_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: - bfin_write_PFCTL(0); - bfin_pmu_setup(cpu); - break; - - default: - break; - } - - return NOTIFY_OK; + return 0; } static int __init bfin_pmu_init(void) @@ -491,8 +475,8 @@ static int __init bfin_pmu_init(void) ret = perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW); if (!ret) - perf_cpu_notifier(bfin_pmu_notifier); - + cpuhp_setup_state(CPUHP_PERF_BFIN, "PERF_BFIN", + bfin_pmu_prepare_cpu, NULL); return ret; } early_initcall(bfin_pmu_init); diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 68f4495..d54973e 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -9,6 +9,7 @@ enum cpuhp_state { CPUHP_PERF_X86_UNCORE_PREP, CPUHP_PERF_X86_AMD_UNCORE_PREP, CPUHP_PERF_X86_RAPL_PREP, + CPUHP_PERF_BFIN, CPUHP_NOTIFY_PREPARE, CPUHP_BRINGUP_CPU, CPUHP_AP_IDLE_DEAD,