From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S943486AbdEZIgB (ORCPT ); Fri, 26 May 2017 04:36:01 -0400 Received: from terminus.zytor.com ([65.50.211.136]:56455 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757818AbdEZIf4 (ORCPT ); Fri, 26 May 2017 04:35:56 -0400 Date: Fri, 26 May 2017 01:33:22 -0700 From: tip-bot for Thomas Gleixner Message-ID: Cc: peterz@infradead.org, hpa@zytor.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, bigeasy@linutronix.de, rostedt@goodmis.org, paulmck@linux.vnet.ibm.com, mingo@kernel.org Reply-To: mingo@kernel.org, paulmck@linux.vnet.ibm.com, rostedt@goodmis.org, hpa@zytor.com, peterz@infradead.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, bigeasy@linutronix.de In-Reply-To: <20170524081547.321782217@linutronix.de> References: <20170524081547.321782217@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:smp/hotplug] cpu/hotplug: Add __cpuhp_state_add_instance_cpuslocked() Git-Commit-ID: 9805c6733349ea3ccd22cf75b8ebaabb5290e310 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: 9805c6733349ea3ccd22cf75b8ebaabb5290e310 Gitweb: http://git.kernel.org/tip/9805c6733349ea3ccd22cf75b8ebaabb5290e310 Author: Thomas Gleixner AuthorDate: Wed, 24 May 2017 10:15:15 +0200 Committer: Thomas Gleixner CommitDate: Fri, 26 May 2017 10:10:35 +0200 cpu/hotplug: Add __cpuhp_state_add_instance_cpuslocked() Add cpuslocked() variants for the multi instance registration so this can be called from a cpus_read_lock() protected region. Signed-off-by: Thomas Gleixner Tested-by: Paul E. McKenney Acked-by: Ingo Molnar Cc: Peter Zijlstra Cc: Sebastian Siewior Cc: Steven Rostedt Link: http://lkml.kernel.org/r/20170524081547.321782217@linutronix.de --- include/linux/cpuhotplug.h | 9 +++++++++ kernel/cpu.c | 18 +++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 4fac564..df3d271 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -240,6 +240,8 @@ static inline int cpuhp_setup_state_multi(enum cpuhp_state state, int __cpuhp_state_add_instance(enum cpuhp_state state, struct hlist_node *node, bool invoke); +int __cpuhp_state_add_instance_cpuslocked(enum cpuhp_state state, + struct hlist_node *node, bool invoke); /** * cpuhp_state_add_instance - Add an instance for a state and invoke startup @@ -272,6 +274,13 @@ static inline int cpuhp_state_add_instance_nocalls(enum cpuhp_state state, return __cpuhp_state_add_instance(state, node, false); } +static inline int +cpuhp_state_add_instance_nocalls_cpuslocked(enum cpuhp_state state, + struct hlist_node *node) +{ + return __cpuhp_state_add_instance_cpuslocked(state, node, false); +} + void __cpuhp_remove_state(enum cpuhp_state state, bool invoke); void __cpuhp_remove_state_cpuslocked(enum cpuhp_state state, bool invoke); diff --git a/kernel/cpu.c b/kernel/cpu.c index dc27c5a..e4389ac 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1413,18 +1413,20 @@ static void cpuhp_rollback_install(int failedcpu, enum cpuhp_state state, } } -int __cpuhp_state_add_instance(enum cpuhp_state state, struct hlist_node *node, - bool invoke) +int __cpuhp_state_add_instance_cpuslocked(enum cpuhp_state state, + struct hlist_node *node, + bool invoke) { struct cpuhp_step *sp; int cpu; int ret; + lockdep_assert_cpus_held(); + sp = cpuhp_get_step(state); if (sp->multi_instance == false) return -EINVAL; - cpus_read_lock(); mutex_lock(&cpuhp_state_mutex); if (!invoke || !sp->startup.multi) @@ -1453,6 +1455,16 @@ add_node: hlist_add_head(node, &sp->list); unlock: mutex_unlock(&cpuhp_state_mutex); + return ret; +} + +int __cpuhp_state_add_instance(enum cpuhp_state state, struct hlist_node *node, + bool invoke) +{ + int ret; + + cpus_read_lock(); + ret = __cpuhp_state_add_instance_cpuslocked(state, node, invoke); cpus_read_unlock(); return ret; }