diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2011-10-07 12:22:02 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-12-11 13:31:31 -0500 |
commit | 00f49e5729af602deb559b0cf293a00b625e8636 (patch) | |
tree | 3e3d5162d8a62bf6aa91b546f5760512637e6cf6 /include | |
parent | 0464e937485f15d2add78e3b0f498469f4e6600d (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')
-rw-r--r-- | 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 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 | ||
240 | static 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 | |||
246 | static 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 | |||
240 | extern struct lockdep_map rcu_lock_map; | 252 | extern 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_) | 254 | static 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 | |||
259 | static inline void rcu_read_release(void) | ||
260 | { | ||
261 | rcu_lock_release(&rcu_lock_map); | ||
262 | } | ||
244 | 263 | ||
245 | extern struct lockdep_map rcu_bh_lock_map; | 264 | extern 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_) | 266 | static 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 | |||
271 | static inline void rcu_read_release_bh(void) | ||
272 | { | ||
273 | rcu_lock_release(&rcu_bh_lock_map); | ||
274 | } | ||
249 | 275 | ||
250 | extern struct lockdep_map rcu_sched_lock_map; | 276 | extern 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_) | 278 | static 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 | |||
283 | static inline void rcu_read_release_sched(void) | ||
284 | { | ||
285 | rcu_lock_release(&rcu_sched_lock_map); | ||
286 | } | ||
255 | 287 | ||
256 | extern int debug_lockdep_rcu_enabled(void); | 288 | extern int debug_lockdep_rcu_enabled(void); |
257 | 289 | ||