From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e23smtp06.au.ibm.com (e23smtp06.au.ibm.com [202.81.31.148]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e23smtp06.au.ibm.com", Issuer "GeoTrust SSL CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id A8A692C05AB for ; Sun, 23 Jun 2013 23:41:36 +1000 (EST) Received: from /spool/local by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 23 Jun 2013 23:34:25 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 6F8753578051 for ; Sun, 23 Jun 2013 23:41:33 +1000 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r5NDQbi67602496 for ; Sun, 23 Jun 2013 23:26:37 +1000 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r5NDfVD0028268 for ; Sun, 23 Jun 2013 23:41:32 +1000 From: "Srivatsa S. Bhat" Subject: [PATCH 02/45] CPU hotplug: Clarify the usage of different synchronization APIs To: tglx@linutronix.de, peterz@infradead.org, tj@kernel.org, oleg@redhat.com, paulmck@linux.vnet.ibm.com, rusty@rustcorp.com.au, mingo@kernel.org, akpm@linux-foundation.org, namhyung@kernel.org, walken@google.com, vincent.guittot@linaro.org, laijs@cn.fujitsu.com Date: Sun, 23 Jun 2013 19:08:12 +0530 Message-ID: <20130623133808.19094.62963.stgit@srivatsabhat.in.ibm.com> In-Reply-To: <20130623133642.19094.16038.stgit@srivatsabhat.in.ibm.com> References: <20130623133642.19094.16038.stgit@srivatsabhat.in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Cc: linux-arch@vger.kernel.org, nikunj@linux.vnet.ibm.com, zhong@linux.vnet.ibm.com, linux-pm@vger.kernel.org, fweisbec@gmail.com, "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, rostedt@goodmis.org, xiaoguangrong@linux.vnet.ibm.com, sbw@mit.edu, Yasuaki Ishimatsu , wangyun@linux.vnet.ibm.com, srivatsa.bhat@linux.vnet.ibm.com, netdev@vger.kernel.org, Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, Andrew Morton List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , We have quite a few APIs now which help synchronize with CPU hotplug. Among them, get/put_online_cpus() is the oldest and the most well-known, so no problems there. By extension, its easy to comprehend the new set : get/put_online_cpus_atomic(). But there is yet another set, which might appear tempting to use: cpu_hotplug_disable()/cpu_hotplug_enable(). Add comments to clarify that this latter set is NOT for general use and must be used only in specific cases where the requirement is really to _disable_ hotplug and not just to synchronize with it. Cc: Thomas Gleixner Cc: Andrew Morton Cc: Yasuaki Ishimatsu Cc: "Rafael J. Wysocki" Signed-off-by: Srivatsa S. Bhat --- kernel/cpu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/cpu.c b/kernel/cpu.c index 2d03398..860f51a 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -139,6 +139,13 @@ static void cpu_hotplug_done(void) * the 'cpu_hotplug_disabled' flag. The same lock is also acquired by the * hotplug path before performing hotplug operations. So acquiring that lock * guarantees mutual exclusion from any currently running hotplug operations. + * + * Note: In most cases, this is *NOT* the function you need. If you simply + * want to avoid racing with CPU hotplug operations, use get/put_online_cpus() + * or get/put_online_cpus_atomic(), depending on the situation. + * + * This set of functions is reserved for cases where you really wish to + * _disable_ CPU hotplug and not just synchronize with it. */ void cpu_hotplug_disable(void) {