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>
#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_)
#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)
*/
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 ||