From patchwork Fri Jul 8 15:43:50 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: 2608 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 8475323F41 for ; Fri, 8 Jul 2011 15:45:45 +0000 (UTC) Received: from mail-qy0-f180.google.com (mail-qy0-f180.google.com [209.85.216.180]) by fiordland.canonical.com (Postfix) with ESMTP id 3EAA3A187A2 for ; Fri, 8 Jul 2011 15:45:45 +0000 (UTC) Received: by qyk30 with SMTP id 30so1430729qyk.11 for ; Fri, 08 Jul 2011 08:45:44 -0700 (PDT) Received: by 10.229.102.98 with SMTP id f34mr1705721qco.42.1310139851119; Fri, 08 Jul 2011 08:44:11 -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.229.48.135 with SMTP id r7cs139261qcf; Fri, 8 Jul 2011 08:44:10 -0700 (PDT) Received: by 10.52.111.131 with SMTP id ii3mr2976186vdb.235.1310139849974; Fri, 08 Jul 2011 08:44:09 -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 y7si12854853vdt.40.2011.07.08.08.44.08 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 08 Jul 2011 08:44:08 -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 d01relay05.pok.ibm.com (d01relay05.pok.ibm.com [9.56.227.237]) by e9.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p68FCPEl013174 for ; Fri, 8 Jul 2011 11:12:25 -0400 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay05.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p68Fi84X162582 for ; Fri, 8 Jul 2011 11:44:08 -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 p68Fi4hf028117 for ; Fri, 8 Jul 2011 11:44:08 -0400 Received: from paulmck-ThinkPad-W500 (sig-9-65-152-173.mts.ibm.com [9.65.152.173]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p68Fi1Dr027963; Fri, 8 Jul 2011 11:44:02 -0400 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id B786313F804; Fri, 8 Jul 2011 08:43:54 -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 RFC tip/core/rcu 3/6] rcu: Warn when rcu_read_lock() is used in extended quiescent state Date: Fri, 8 Jul 2011 08:43:50 -0700 Message-Id: <1310139833-20804-3-git-send-email-paulmck@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.3.2 In-Reply-To: <20110708154331.GA20161@linux.vnet.ibm.com> References: <20110708154331.GA20161@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 0a33075..bf2c316 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -189,21 +189,53 @@ static inline bool rcu_check_extended_qs(void) { return false; } #ifdef CONFIG_DEBUG_LOCK_ALLOC +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);