From patchwork Thu Jun 27 19:55:17 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: 255138 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id BE4C82C0660 for ; Fri, 28 Jun 2013 05:59:16 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754629Ab3F0T6y (ORCPT ); Thu, 27 Jun 2013 15:58:54 -0400 Received: from e23smtp02.au.ibm.com ([202.81.31.144]:57345 "EHLO e23smtp02.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754583Ab3F0T6w (ORCPT ); Thu, 27 Jun 2013 15:58:52 -0400 Received: from /spool/local by e23smtp02.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 28 Jun 2013 05:49:10 +1000 Received: from d23dlp02.au.ibm.com (202.81.31.213) by e23smtp02.au.ibm.com (202.81.31.208) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 28 Jun 2013 05:49:08 +1000 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [9.190.235.21]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id D75E02BB0050; Fri, 28 Jun 2013 05:58:47 +1000 (EST) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r5RJwcEK4391394; Fri, 28 Jun 2013 05:58:38 +1000 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r5RJwjb1029443; Fri, 28 Jun 2013 05:58:47 +1000 Received: from srivatsabhat.in.ibm.com ([9.79.209.72]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r5RJwVgY029332; Fri, 28 Jun 2013 05:58:39 +1000 From: "Srivatsa S. Bhat" Subject: [PATCH v3 16/45] rcu: Use cpu_is_offline_nocheck() to avoid false-positive warnings 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 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, Dipankar Sarma , "Paul E. McKenney" , "Srivatsa S. Bhat" Date: Fri, 28 Jun 2013 01:25:17 +0530 Message-ID: <20130627195517.29830.64108.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-Content-Scanned: Fidelis XPS MAILER x-cbid: 13062719-5490-0000-0000-000003BA30EE Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In RCU code, rcu_implicit_dynticks_qs() checks if a CPU is offline, while being protected by a spinlock. At first, it appears as if we need to use the get/put_online_cpus_atomic() APIs to properly synchronize with CPU hotplug, once we get rid of stop_machine(). However, RCU has adequate synchronization with CPU hotplug, making that unnecessary. But since the locking details are non-trivial, it is hard to teach this to the rudimentary hotplug locking validator. So use the _nocheck() variants of the cpu accessor functions to prevent false- positive warnings from the CPU hotplug debug code. Also, add a comment explaining the hotplug synchronization design used in RCU, so that its easy to see why it is justified to use the _nocheck() variants. Cc: Dipankar Sarma Cc: "Paul E. McKenney" Signed-off-by: Srivatsa S. Bhat Reviewed-by: Paul E. McKenney --- kernel/rcutree.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" 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/rcutree.c b/kernel/rcutree.c index cf3adc6..ced28a45 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c @@ -794,7 +794,17 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp) if (ULONG_CMP_GE(rdp->rsp->gp_start + 2, jiffies)) return 0; /* Grace period is not old enough. */ barrier(); - if (cpu_is_offline(rdp->cpu)) { + + /* + * It is safe to use the _nocheck() version of cpu_is_offline() here + * (to avoid false-positive warnings from CPU hotplug debug code), + * because: + * 1. rcu_gp_init() holds off CPU hotplug operations during grace + * period initialization. + * 2. The current grace period has not ended yet. + * So it is safe to sample the offline state without synchronization. + */ + if (cpu_is_offline_nocheck(rdp->cpu)) { trace_rcu_fqs(rdp->rsp->name, rdp->gpnum, rdp->cpu, "ofl"); rdp->offline_fqs++; return 1;