diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2012-01-04 16:30:33 -0500 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2012-02-21 12:03:23 -0500 |
commit | fe15d706cfc1cb321dbe2329b04b5ca185edff60 (patch) | |
tree | bec14ab52167f4f0210e8c207c93922c8270402f /kernel/rcutree.c | |
parent | 18fec7d8758dd416904da205375e6fa667defc80 (diff) |
rcu: Add lockdep-RCU checks for simple self-deadlock
It is illegal to have a grace period within a same-flavor RCU read-side
critical section, so this commit adds lockdep-RCU checks to splat when
such abuse is encountered. This commit does not detect more elaborate
RCU deadlock situations. These situations might be a job for lockdep
enhancements.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcutree.c')
-rw-r--r-- | kernel/rcutree.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 6c4a6722abfd..3cf713a724c1 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c | |||
@@ -1816,6 +1816,10 @@ EXPORT_SYMBOL_GPL(call_rcu_bh); | |||
1816 | */ | 1816 | */ |
1817 | void synchronize_sched(void) | 1817 | void synchronize_sched(void) |
1818 | { | 1818 | { |
1819 | rcu_lockdep_assert(!lock_is_held(&rcu_bh_lock_map) && | ||
1820 | !lock_is_held(&rcu_lock_map) && | ||
1821 | !lock_is_held(&rcu_sched_lock_map), | ||
1822 | "Illegal synchronize_sched() in RCU-sched read-side critical section"); | ||
1819 | if (rcu_blocking_is_gp()) | 1823 | if (rcu_blocking_is_gp()) |
1820 | return; | 1824 | return; |
1821 | wait_rcu_gp(call_rcu_sched); | 1825 | wait_rcu_gp(call_rcu_sched); |
@@ -1833,6 +1837,10 @@ EXPORT_SYMBOL_GPL(synchronize_sched); | |||
1833 | */ | 1837 | */ |
1834 | void synchronize_rcu_bh(void) | 1838 | void synchronize_rcu_bh(void) |
1835 | { | 1839 | { |
1840 | rcu_lockdep_assert(!lock_is_held(&rcu_bh_lock_map) && | ||
1841 | !lock_is_held(&rcu_lock_map) && | ||
1842 | !lock_is_held(&rcu_sched_lock_map), | ||
1843 | "Illegal synchronize_rcu_bh() in RCU-bh read-side critical section"); | ||
1836 | if (rcu_blocking_is_gp()) | 1844 | if (rcu_blocking_is_gp()) |
1837 | return; | 1845 | return; |
1838 | wait_rcu_gp(call_rcu_bh); | 1846 | wait_rcu_gp(call_rcu_bh); |