]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
rcu: Check for entering dyntick-idle mode while in read-side critical section
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Fri, 19 Aug 2011 22:23:19 +0000 (15:23 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 13 Sep 2011 15:46:35 +0000 (08:46 -0700)
CONFIG_RCU_FAST_NO_HZ assumes that all calls to rcu_needs_cpu() are
outside of all RCU read-side critical sections.  This patch adds diagnostic
checks to verify this assumption.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
include/linux/rcupdate.h
kernel/rcutree.c

index e86bc28233ea2222fe44ee3a3338ffc45169b9ec..8d7efc8a062f34fa980e777a49e7a12501e0a4ad 100644 (file)
@@ -233,6 +233,8 @@ static inline void destroy_rcu_head_on_stack(struct rcu_head *head)
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 
+#define PROVE_RCU(a) a
+
 extern struct lockdep_map rcu_lock_map;
 # define rcu_read_acquire() \
                lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
@@ -311,6 +313,7 @@ static inline int rcu_read_lock_sched_held(void)
 
 #else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
 
+# define PROVE_RCU(a)                  do { } while (0)
 # define rcu_read_acquire()            do { } while (0)
 # define rcu_read_release()            do { } while (0)
 # define rcu_read_acquire_bh()         do { } while (0)
index 8455043c9250200d96e68ace1115c5b55aed6bc4..743a658e3df1137815b6383a3e7a63db56b774aa 100644 (file)
@@ -1786,6 +1786,9 @@ static int rcu_pending(int cpu)
  */
 static int rcu_needs_cpu_quick_check(int cpu)
 {
+       PROVE_RCU(WARN_ON_ONCE(lock_is_held(&rcu_lock_map)));
+       PROVE_RCU(WARN_ON_ONCE(lock_is_held(&rcu_bh_lock_map)));
+       PROVE_RCU(WARN_ON_ONCE(lock_is_held(&rcu_sched_lock_map)));
        /* RCU callbacks either ready or pending? */
        return per_cpu(rcu_sched_data, cpu).nxtlist ||
               per_cpu(rcu_bh_data, cpu).nxtlist ||