From patchwork Tue Sep 6 18:00:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 3939 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 61C8523FB7 for ; Wed, 7 Sep 2011 06:21:08 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 55E62A1817A for ; Wed, 7 Sep 2011 06:21:08 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id 18so398985fxd.11 for ; Tue, 06 Sep 2011 23:21:08 -0700 (PDT) Received: by 10.223.22.16 with SMTP id l16mr665176fab.62.1315376468145; Tue, 06 Sep 2011 23:21:08 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.11.8 with SMTP id m8cs127805lab; Tue, 6 Sep 2011 23:21:07 -0700 (PDT) Received: by 10.150.62.8 with SMTP id k8mr4518227yba.441.1315376466919; Tue, 06 Sep 2011 23:21:06 -0700 (PDT) Received: from e9.ny.us.ibm.com (e9.ny.us.ibm.com [32.97.182.139]) by mx.google.com with ESMTPS id e18si1351456ybm.2.2011.09.06.23.21.06 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 06 Sep 2011 23:21:06 -0700 (PDT) Received-SPF: pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.182.139 as permitted sender) client-ip=32.97.182.139; Authentication-Results: mx.google.com; spf=pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.182.139 as permitted sender) smtp.mail=paulmck@linux.vnet.ibm.com Received: from d01relay06.pok.ibm.com (d01relay06.pok.ibm.com [9.56.227.116]) by e9.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p875kaQo011154 for ; Wed, 7 Sep 2011 01:46:36 -0400 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay06.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p876KtGf1257680 for ; Wed, 7 Sep 2011 02:20:55 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p876Klfo006367 for ; Wed, 7 Sep 2011 02:20:55 -0400 Received: from paulmck-ThinkPad-W500 (dyn9050016039.mts.ibm.com [9.50.16.39] (may be forged)) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p876KYsZ004548; Wed, 7 Sep 2011 02:20:46 -0400 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id 21BC713F895; Tue, 6 Sep 2011 11:00:53 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: mingo@elte.hu, laijs@cn.fujitsu.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca, josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, Valdis.Kletnieks@vt.edu, dhowells@redhat.com, eric.dumazet@gmail.com, darren@dvhart.com, patches@linaro.org, "Paul E. McKenney" Subject: [PATCH tip/core/rcu 45/55] rcu: check for entering dyntick-idle mode while in read-side critical section Date: Tue, 6 Sep 2011 11:00:39 -0700 Message-Id: <1315332049-2604-45-git-send-email-paulmck@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.3.2 In-Reply-To: <20110906180015.GA2560@linux.vnet.ibm.com> References: <20110906180015.GA2560@linux.vnet.ibm.com> CONFIG_RCU_FAST_NO_HZ assumes that all calls to rcu_needs_cpu() are outside of all RCU read-side critical sections. This patch adds diagnostic checks to verify this assumption. Signed-off-by: Paul E. McKenney --- include/linux/rcupdate.h | 3 +++ kernel/rcutree.c | 3 +++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index e86bc28..8d7efc8 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -233,6 +233,8 @@ static inline void destroy_rcu_head_on_stack(struct rcu_head *head) #ifdef CONFIG_DEBUG_LOCK_ALLOC +#define PROVE_RCU(a) a + extern struct lockdep_map rcu_lock_map; # define rcu_read_acquire() \ lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) @@ -311,6 +313,7 @@ static inline int rcu_read_lock_sched_held(void) #else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ +# define PROVE_RCU(a) do { } while (0) # define rcu_read_acquire() do { } while (0) # define rcu_read_release() do { } while (0) # define rcu_read_acquire_bh() do { } while (0) diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 8455043..743a658 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c @@ -1786,6 +1786,9 @@ static int rcu_pending(int cpu) */ static int rcu_needs_cpu_quick_check(int cpu) { + PROVE_RCU(WARN_ON_ONCE(lock_is_held(&rcu_lock_map))); + PROVE_RCU(WARN_ON_ONCE(lock_is_held(&rcu_bh_lock_map))); + PROVE_RCU(WARN_ON_ONCE(lock_is_held(&rcu_sched_lock_map))); /* RCU callbacks either ready or pending? */ return per_cpu(rcu_sched_data, cpu).nxtlist || per_cpu(rcu_bh_data, cpu).nxtlist ||