From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753377AbcGSHZF (ORCPT ); Tue, 19 Jul 2016 03:25:05 -0400 Received: from terminus.zytor.com ([198.137.202.10]:46152 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753074AbcGSHZA (ORCPT ); Tue, 19 Jul 2016 03:25:00 -0400 Date: Tue, 19 Jul 2016 00:24:25 -0700 From: tip-bot for Richard Cochran Message-ID: Cc: rric@kernel.org, torvalds@linux-foundation.org, rcochran@linutronix.de, mingo@kernel.org, ralf@linux-mips.org, anna-maria@linutronix.de, bigeasy@linutronix.de, tglx@linutronix.de, linux-kernel@vger.kernel.org, hpa@zytor.com, peterz@infradead.org Reply-To: rric@kernel.org, rcochran@linutronix.de, torvalds@linux-foundation.org, ralf@linux-mips.org, anna-maria@linutronix.de, mingo@kernel.org, bigeasy@linutronix.de, tglx@linutronix.de, linux-kernel@vger.kernel.org, peterz@infradead.org, hpa@zytor.com In-Reply-To: <20160713153337.054827168@linutronix.de> References: <20160713153337.054827168@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:smp/hotplug] MIPS/Loongson-3: Convert oprofile to hotplug state machine Git-Commit-ID: 65264e3bc3d479a87a3a9dbc6f3daee6439ce5c0 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: 65264e3bc3d479a87a3a9dbc6f3daee6439ce5c0 Gitweb: http://git.kernel.org/tip/65264e3bc3d479a87a3a9dbc6f3daee6439ce5c0 Author: Richard Cochran AuthorDate: Wed, 13 Jul 2016 17:16:53 +0000 Committer: Ingo Molnar CommitDate: Fri, 15 Jul 2016 10:40:29 +0200 MIPS/Loongson-3: Convert oprofile to hotplug state machine Install the callbacks via the state machine and let the core invoke the callbacks on the already online CPUs. Signed-off-by: Richard Cochran Signed-off-by: Anna-Maria Gleixner Reviewed-by: Sebastian Andrzej Siewior Acked-by: Ralf Baechle Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Robert Richter Cc: Thomas Gleixner Cc: linux-mips@linux-mips.org Cc: oprofile-list@lists.sf.net Cc: rt@linutronix.de Link: http://lkml.kernel.org/r/20160713153337.054827168@linutronix.de Signed-off-by: Ingo Molnar --- arch/mips/oprofile/op_model_loongson3.c | 35 +++++++++++++-------------------- include/linux/cpuhotplug.h | 1 + 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/arch/mips/oprofile/op_model_loongson3.c b/arch/mips/oprofile/op_model_loongson3.c index 8bcf7fc..85f3ee4 100644 --- a/arch/mips/oprofile/op_model_loongson3.c +++ b/arch/mips/oprofile/op_model_loongson3.c @@ -168,33 +168,26 @@ static int loongson3_perfcount_handler(void) return handled; } -static int loongson3_cpu_callback(struct notifier_block *nfb, - unsigned long action, void *hcpu) +static int loongson3_starting_cpu(unsigned int cpu) { - switch (action) { - case CPU_STARTING: - case CPU_STARTING_FROZEN: - write_c0_perflo1(reg.control1); - write_c0_perflo2(reg.control2); - break; - case CPU_DYING: - case CPU_DYING_FROZEN: - write_c0_perflo1(0xc0000000); - write_c0_perflo2(0x40000000); - break; - } - - return NOTIFY_OK; + write_c0_perflo1(reg.control1); + write_c0_perflo2(reg.control2); + return 0; } -static struct notifier_block loongson3_notifier_block = { - .notifier_call = loongson3_cpu_callback -}; +static int loongson3_dying_cpu(unsigned int cpu) +{ + write_c0_perflo1(0xc0000000); + write_c0_perflo2(0x40000000); + return 0; +} static int __init loongson3_init(void) { on_each_cpu(reset_counters, NULL, 1); - register_hotcpu_notifier(&loongson3_notifier_block); + cpuhp_setup_state_nocalls(CPUHP_AP_MIPS_OP_LOONGSON3_STARTING, + "AP_MIPS_OP_LOONGSON3_STARTING", + loongson3_starting_cpu, loongson3_dying_cpu); save_perf_irq = perf_irq; perf_irq = loongson3_perfcount_handler; @@ -204,7 +197,7 @@ static int __init loongson3_init(void) static void loongson3_exit(void) { on_each_cpu(reset_counters, NULL, 1); - unregister_hotcpu_notifier(&loongson3_notifier_block); + cpuhp_remove_state_nocalls(CPUHP_AP_MIPS_OP_LOONGSON3_STARTING); perf_irq = save_perf_irq; } diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 4c02b52..ad26e35 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -35,6 +35,7 @@ enum cpuhp_state { CPUHP_AP_PERF_X86_CSTATE_STARTING, CPUHP_AP_PERF_XTENSA_STARTING, CPUHP_AP_PERF_METAG_STARTING, + CPUHP_AP_MIPS_OP_LOONGSON3_STARTING, CPUHP_AP_ARM_VFP_STARTING, CPUHP_AP_PERF_ARM_STARTING, CPUHP_AP_ARM_L2X0_STARTING,