aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/rcupdate.h
diff options
context:
space:
mode:
authorPaul E. McKenney <paul.mckenney@linaro.org>2012-01-12 16:49:19 -0500
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2012-02-21 12:03:46 -0500
commit50406b98b6372e7de21d903d2cf3914e9d64e094 (patch)
treed53077fbca12714e1af5f9982e08efb923a550c6 /include/linux/rcupdate.h
parentc44e2cddacc2cf299186bad5697d738ea19668b7 (diff)
rcu: Make rcu_sleep_check() also check rcu_lock_map
Although it is OK to be preempted in an RCU read-side critical section for TREE_PREEMPT_RCU, it is definitely not OK to be preempted, block, or might_sleep() within an RCU read-side critical section for TREE_RCU. Unfortunately, rcu_might_sleep() currently only checks for RCU-bh and RCU-sched read-side critical sections. This commit therefore makes rcu_might_sleep() check for RCU read-side critical sections, but only in TREE_RCU builds. Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'include/linux/rcupdate.h')
-rw-r--r--include/linux/rcupdate.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index a67d5f1072ea..6df0ae197810 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -381,8 +381,22 @@ extern int rcu_my_thread_group_empty(void);
381 } \ 381 } \
382 } while (0) 382 } while (0)
383 383
384#if defined(CONFIG_PROVE_RCU) && !defined(CONFIG_PREEMPT_RCU)
385static inline void rcu_preempt_sleep_check(void)
386{
387 rcu_lockdep_assert(!lock_is_held(&rcu_lock_map),
388 "Illegal context switch in RCU read-side "
389 "critical section");
390}
391#else /* #ifdef CONFIG_PROVE_RCU */
392static inline void rcu_preempt_sleep_check(void)
393{
394}
395#endif /* #else #ifdef CONFIG_PROVE_RCU */
396
384#define rcu_sleep_check() \ 397#define rcu_sleep_check() \
385 do { \ 398 do { \
399 rcu_preempt_sleep_check(); \
386 rcu_lockdep_assert(!lock_is_held(&rcu_bh_lock_map), \ 400 rcu_lockdep_assert(!lock_is_held(&rcu_bh_lock_map), \
387 "Illegal context switch in RCU-bh" \ 401 "Illegal context switch in RCU-bh" \
388 " read-side critical section"); \ 402 " read-side critical section"); \