From patchwork Sun Jun 23 13:38:12 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: 2768171 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 67183C0AB1 for ; Sun, 23 Jun 2013 13:56:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7A10920142 for ; Sun, 23 Jun 2013 13:56:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9431C20137 for ; Sun, 23 Jun 2013 13:56:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751805Ab3FWNls (ORCPT ); Sun, 23 Jun 2013 09:41:48 -0400 Received: from e23smtp05.au.ibm.com ([202.81.31.147]:59183 "EHLO e23smtp05.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751737Ab3FWNlh (ORCPT ); Sun, 23 Jun 2013 09:41:37 -0400 Received: from /spool/local by e23smtp05.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 23 Jun 2013 23:35:30 +1000 Received: from d23dlp02.au.ibm.com (202.81.31.213) by e23smtp05.au.ibm.com (202.81.31.211) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 23 Jun 2013 23:35:29 +1000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [9.190.234.120]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id F01602BB0050; Sun, 23 Jun 2013 23:41:33 +1000 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r5NDQkQU30736554; Sun, 23 Jun 2013 23:26:46 +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 r5NDfVD8028268; Sun, 23 Jun 2013 23:41:33 +1000 Received: from srivatsabhat.in.ibm.com ([9.79.195.141]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r5NDfOfZ027557; Sun, 23 Jun 2013 23:41:25 +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 Cc: rostedt@goodmis.org, wangyun@linux.vnet.ibm.com, xiaoguangrong@linux.vnet.ibm.com, sbw@mit.edu, fweisbec@gmail.com, zhong@linux.vnet.ibm.com, nikunj@linux.vnet.ibm.com, srivatsa.bhat@linux.vnet.ibm.com, linux-pm@vger.kernel.org, linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Andrew Morton , Yasuaki Ishimatsu , "Rafael J. Wysocki" 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> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13062313-1396-0000-0000-00000328585B Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(+) -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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) {