Re: [PATCH 2/3] rcu: Equip sleepable RCU with lockdep dependency graph checks

From: Paolo Bonzini
Date: Mon Jan 16 2023 - 12:58:10 EST


On 1/13/23 20:11, Paul E. McKenney wrote:
On Fri, Jan 13, 2023 at 10:05:22AM -0800, Boqun Feng wrote:
On Fri, Jan 13, 2023 at 03:29:49AM -0800, Paul E. McKenney wrote:
I prefer that the first two patches go through your tree, because it
reduces the synchronization among locking, rcu and KVM trees to the
synchronization betwen rcu and KVM trees.

Very well, I have queued and pushed these with the usual wordsmithing,
thank you!

I'm worried about this case:

CPU 0 CPU 1
-------------------- ------------------
lock A srcu lock B
srcu lock B lock A
srcu unlock B unlock A
unlock A srcu unlock B

While a bit unclean, there is nothing that downright forbids this; as long as synchronize_srcu does not happen inside lock A, no deadlock can occur.

However, if srcu is replaced with an rwlock then lockdep should and does report a deadlock. Boqun, do you get a false positive or do your patches correctly suppress this?

Paolo