aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/rcupdate.h
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2011-10-07 12:22:02 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2011-12-11 13:31:31 -0500
commit00f49e5729af602deb559b0cf293a00b625e8636 (patch)
tree3e3d5162d8a62bf6aa91b546f5760512637e6cf6 /include/linux/rcupdate.h
parent0464e937485f15d2add78e3b0f498469f4e6600d (diff)
rcu: Warn when rcu_read_lock() is used in extended quiescent state
We are currently able to detect uses of rcu_dereference_check() inside extended quiescent states (such as the RCU-free window in idle). 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 RCU idle mode miss some error conditions. This commit therefore adds extended quiescent state checking to rcu_read_lock() and friends. Uses of RCU from within RCU-idle mode are totally ignored by RCU, hence the importance of these checks. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Diffstat (limited to 'include/linux/rcupdate.h')
-rw-r--r--include/linux/rcupdate.h52
1 files changed, 42 insertions, 10 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index bf91fcfe181c..d201c155f70c 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -237,21 +237,53 @@ static inline int rcu_is_cpu_idle(void)
237} 237}
238#endif /* else !CONFIG_PROVE_RCU */ 238#endif /* else !CONFIG_PROVE_RCU */
239 239
240static inline void rcu_lock_acquire(struct lockdep_map *map)
241{
242 WARN_ON_ONCE(rcu_is_cpu_idle());
243 lock_acquire(map, 0, 0, 2, 1, NULL, _THIS_IP_);
244}
245
246static inline void rcu_lock_release(struct lockdep_map *map)
247{
248 WARN_ON_ONCE(rcu_is_cpu_idle());
249 lock_release(map, 1, _THIS_IP_);
250}
251
240extern struct lockdep_map rcu_lock_map; 252extern struct lockdep_map rcu_lock_map;
241# define rcu_read_acquire() \ 253
242 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) 254static inline void rcu_read_acquire(void)
243# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_) 255{
256 rcu_lock_acquire(&rcu_lock_map);
257}
258
259static inline void rcu_read_release(void)
260{
261 rcu_lock_release(&rcu_lock_map);
262}
244 263
245extern struct lockdep_map rcu_bh_lock_map; 264extern struct lockdep_map rcu_bh_lock_map;
246# define rcu_read_acquire_bh() \ 265
247 lock_acquire(&rcu_bh_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) 266static inline void rcu_read_acquire_bh(void)
248# define rcu_read_release_bh() lock_release(&rcu_bh_lock_map, 1, _THIS_IP_) 267{
268 rcu_lock_acquire(&rcu_bh_lock_map);
269}
270
271static inline void rcu_read_release_bh(void)
272{
273 rcu_lock_release(&rcu_bh_lock_map);
274}
249 275
250extern struct lockdep_map rcu_sched_lock_map; 276extern struct lockdep_map rcu_sched_lock_map;
251# define rcu_read_acquire_sched() \ 277
252 lock_acquire(&rcu_sched_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) 278static inline void rcu_read_acquire_sched(void)
253# define rcu_read_release_sched() \ 279{
254 lock_release(&rcu_sched_lock_map, 1, _THIS_IP_) 280 rcu_lock_acquire(&rcu_sched_lock_map);
281}
282
283static inline void rcu_read_release_sched(void)
284{
285 rcu_lock_release(&rcu_sched_lock_map);
286}
255 287
256extern int debug_lockdep_rcu_enabled(void); 288extern int debug_lockdep_rcu_enabled(void);
257 289