Re: [tip: locking/core] lockdep: Fix lockdep recursion

From: Peter Zijlstra
Date: Thu Oct 15 2020 - 05:52:47 EST


On Thu, Oct 15, 2020 at 11:49:26AM +0200, Peter Zijlstra wrote:
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -1764,8 +1764,7 @@ static bool rcu_gp_init(void)
> smp_mb(); // Pair with barriers used when updating ->ofl_seq to odd values.
> firstseq = READ_ONCE(rnp->ofl_seq);
> if (firstseq & 0x1)
> - while (firstseq == smp_load_acquire(&rnp->ofl_seq))
> - schedule_timeout_idle(1); // Can't wake unless RCU is watching.
> + smp_cond_load_relaxed(&rnp->ofl_seq, VAL == firstseq);

My bad, that should be: VAL != firstseq.

> smp_mb(); // Pair with barriers used when updating ->ofl_seq to even values.
> raw_spin_lock(&rcu_state.ofl_lock);
> raw_spin_lock_irq_rcu_node(rnp);