]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
rcu: Inform the user about dynticks-idle mode on PROVE_RCU warning
authorFrederic Weisbecker <fweisbec@gmail.com>
Thu, 23 Jun 2011 23:12:39 +0000 (01:12 +0200)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 13 Sep 2011 15:46:38 +0000 (08:46 -0700)
Inform the user if an RCU usage error is detected by lockdep while in
an extended quiescent state (in this case, dyntick-idle mode).  This
is accomplished by adding a line to the RCU lockdep splat indicating
whether or not the splat occurred in dyntick-idle mode.

Uses of RCU from within dyntick-idle mode are totally ignored by
RCU, hence the importance of this diagnostic.

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>
kernel/lockdep.c

index df2ad3727a8a8c8e0ab43da4ea780b1d6c7f7d60..ef5dd692ac49f7ddf85c7a1ee4b0fd417fdbf990 100644 (file)
@@ -4008,6 +4008,26 @@ void lockdep_rcu_suspicious(const char *file, const int line, const char *s)
        printk("%s:%d %s!\n", file, line, s);
        printk("\nother info that might help us debug this:\n\n");
        printk("\nrcu_scheduler_active = %d, debug_locks = %d\n", rcu_scheduler_active, debug_locks);
+
+       /*
+        * If a CPU is in dyntick-idle mode (CONFIG_NO_HZ), then RCU
+        * considers that CPU to be in an "extended quiescent state",
+        * which means that RCU will be completely ignoring that CPU.
+        * Therefore, rcu_read_lock() and friends have absolutely no
+        * effect on a dyntick-idle CPU.  In other words, even if a
+        * dyntick-idle CPU has called rcu_read_lock(), RCU might well
+        * delete data structures out from under it.  RCU really has no
+        * choice here: if it were to consult the CPU, that would wake
+        * the CPU up, and the whole point of dyntick-idle mode is to
+        * allow CPUs to enter extremely deep sleep states.
+        *
+        * So complain bitterly if someone does call rcu_read_lock(),
+        * rcu_read_lock_bh() and so on from extended quiescent states
+        * such as dyntick-idle mode.
+        */
+       if (rcu_check_extended_qs())
+               printk("RCU used illegally from extended quiescent state!\n");
+
        lockdep_print_held_locks(curr);
        printk("\nstack backtrace:\n");
        dump_stack();