rcu: Make RCU lockdep check the lockdep_recursion variable
authorPaul E. McKenney <[email protected]>
Thu, 15 Apr 2010 19:50:39 +0000 (12:50 -0700)
committerIngo Molnar <[email protected]>
Mon, 19 Apr 2010 06:37:19 +0000 (08:37 +0200)
The lockdep facility temporarily disables lockdep checking by
incrementing the current->lockdep_recursion variable.  Such
disabling happens in NMIs and in other situations where lockdep
might expect to recurse on itself.

This patch therefore checks current->lockdep_recursion, disabling RCU
lockdep splats when this variable is non-zero.  In addition, this patch
removes the "likely()", as suggested by Lai Jiangshan.

Reported-by: Frederic Weisbecker <[email protected]>
Reported-by: David Miller <[email protected]>
Tested-by: Frederic Weisbecker <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
LKML-Reference: <20100415195039[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
include/linux/rcupdate.h
kernel/rcupdate.c

index 9f1ddfef84b50afb41e2ec3239aafbad7991df19..07db2feb857267b0dddf428cad80aa767edc213e 100644 (file)
@@ -101,10 +101,7 @@ extern struct lockdep_map rcu_sched_lock_map;
 # define rcu_read_release_sched() \
                lock_release(&rcu_sched_lock_map, 1, _THIS_IP_)
 
-static inline int debug_lockdep_rcu_enabled(void)
-{
-       return likely(rcu_scheduler_active && debug_locks);
-}
+extern int debug_lockdep_rcu_enabled(void);
 
 /**
  * rcu_read_lock_held - might we be in RCU read-side critical section?
index 63fe25433980a943096634841d0ce5ff0ed33f7f..03a7ea1579f614f6c24ef16384cfe253b9d94918 100644 (file)
@@ -69,6 +69,13 @@ EXPORT_SYMBOL_GPL(rcu_scheduler_active);
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 
+int debug_lockdep_rcu_enabled(void)
+{
+       return rcu_scheduler_active && debug_locks &&
+              current->lockdep_recursion == 0;
+}
+EXPORT_SYMBOL_GPL(debug_lockdep_rcu_enabled);
+
 /**
  * rcu_read_lock_bh_held - might we be in RCU-bh read-side critical section?
  *