From patchwork Tue Sep 6 18:00:45 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: 3947 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 18A8023EFA for ; Wed, 7 Sep 2011 06:22:02 +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 09A23A181E3 for ; Wed, 7 Sep 2011 06:22:02 +0000 (UTC) Received: by fxd18 with SMTP id 18so399686fxd.11 for ; Tue, 06 Sep 2011 23:22:01 -0700 (PDT) Received: by 10.223.76.201 with SMTP id d9mr1586134fak.119.1315376521856; Tue, 06 Sep 2011 23:22:01 -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 m8cs127837lab; Tue, 6 Sep 2011 23:22:01 -0700 (PDT) Received: by 10.236.195.99 with SMTP id o63mr11064651yhn.45.1315376520781; Tue, 06 Sep 2011 23:22:00 -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 b29si11193167yhe.38.2011.09.06.23.22.00 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 06 Sep 2011 23:22:00 -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 d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e9.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p875lUKk011322 for ; Wed, 7 Sep 2011 01:47:30 -0400 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p876KhCE265940 for ; Wed, 7 Sep 2011 02:20:43 -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 p876Kdfp004772 for ; Wed, 7 Sep 2011 02:20:43 -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 p876KWDA004433; Wed, 7 Sep 2011 02:20:35 -0400 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id 6086513F89B; 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, Frederic Weisbecker , "Paul E. McKenney" , Peter Zijlstra Subject: [PATCH tip/core/rcu 51/55] rcu: Warn when rcu_read_lock() is used in extended quiescent state Date: Tue, 6 Sep 2011 11:00:45 -0700 Message-Id: <1315332049-2604-51-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> From: Frederic Weisbecker We are currently able to detect uses of rcu_dereference_check() inside extended quiescent states (such as dyntick-idle mode). But rcu_read_lock() and friends can be used without rcu_dereference(), so that the earlier commit checking for use of rcu_dereference() and friends while in dyntick-idle mode miss some error conditions. This commit therefore adds dyntick-idle checking to rcu_read_lock() and friends. Signed-off-by: Frederic Weisbecker Cc: Paul E. McKenney Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Lai Jiangshan Signed-off-by: Paul E. McKenney --- include/linux/rcupdate.h | 52 +++++++++++++++++++++++++++++++++++++-------- 1 files changed, 42 insertions(+), 10 deletions(-) diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 7d8fa7c..a9bc36d 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -243,21 +243,53 @@ static inline bool rcu_check_extended_qs(void) { return false; } #define PROVE_RCU(a) a +static inline void rcu_lock_acquire(struct lockdep_map *map) +{ + WARN_ON_ONCE(rcu_check_extended_qs()); + lock_acquire(map, 0, 0, 2, 1, NULL, _THIS_IP_); +} + +static inline void rcu_lock_release(struct lockdep_map *map) +{ + WARN_ON_ONCE(rcu_check_extended_qs()); + lock_release(map, 1, _THIS_IP_); +} + extern struct lockdep_map rcu_lock_map; -# define rcu_read_acquire() \ - lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) -# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_) + +static inline void rcu_read_acquire(void) +{ + rcu_lock_acquire(&rcu_lock_map); +} + +static inline void rcu_read_release(void) +{ + rcu_lock_release(&rcu_lock_map); +} extern struct lockdep_map rcu_bh_lock_map; -# define rcu_read_acquire_bh() \ - lock_acquire(&rcu_bh_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) -# define rcu_read_release_bh() lock_release(&rcu_bh_lock_map, 1, _THIS_IP_) + +static inline void rcu_read_acquire_bh(void) +{ + rcu_lock_acquire(&rcu_bh_lock_map); +} + +static inline void rcu_read_release_bh(void) +{ + rcu_lock_release(&rcu_bh_lock_map); +} extern struct lockdep_map rcu_sched_lock_map; -# define rcu_read_acquire_sched() \ - lock_acquire(&rcu_sched_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) -# define rcu_read_release_sched() \ - lock_release(&rcu_sched_lock_map, 1, _THIS_IP_) + +static inline void rcu_read_acquire_sched(void) +{ + rcu_lock_acquire(&rcu_sched_lock_map); +} + +static inline void rcu_read_release_sched(void) +{ + rcu_lock_release(&rcu_sched_lock_map); +} extern int debug_lockdep_rcu_enabled(void);