From patchwork Thu Jun 27 19:52:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Srivatsa S. Bhat" X-Patchwork-Id: 255134 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id D258E2C0534 for ; Fri, 28 Jun 2013 05:58:18 +1000 (EST) Received: from e28smtp09.in.ibm.com (e28smtp09.in.ibm.com [122.248.162.9]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e28smtp09.in.ibm.com", Issuer "GeoTrust SSL CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 87A1B2C0329 for ; Fri, 28 Jun 2013 05:56:08 +1000 (EST) Received: from /spool/local by e28smtp09.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 28 Jun 2013 01:21:23 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp09.in.ibm.com (192.168.1.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 28 Jun 2013 01:21:21 +0530 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id C02761258054 for ; Fri, 28 Jun 2013 01:25:07 +0530 (IST) Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r5RJuKXb28573826 for ; Fri, 28 Jun 2013 01:26:20 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r5RJu0oD008245 for ; Fri, 28 Jun 2013 05:56:02 +1000 Received: from srivatsabhat.in.ibm.com ([9.79.209.72]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r5RJtx6Y008185; Fri, 28 Jun 2013 05:55:59 +1000 From: "Srivatsa S. Bhat" Subject: [PATCH v3 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, David.Laight@aculab.com Date: Fri, 28 Jun 2013 01:22:45 +0530 Message-ID: <20130627195245.29830.75515.stgit@srivatsabhat.in.ibm.com> In-Reply-To: <20130627195136.29830.10445.stgit@srivatsabhat.in.ibm.com> References: <20130627195136.29830.10445.stgit@srivatsabhat.in.ibm.com> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13062719-2674-0000-0000-00000997B1F8 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 S. Bhat" , netdev@vger.kernel.org, Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, Andrew Morton X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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) {