On Wed, Apr 16, 2025 at 8:50 PM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote: > > For the ARM case, which is the actual buggy one (it was complaining > > about too high a depth) it still needs mutex_trylock_nest_lock(); > > the nest_lock is needed to avoid bumping the depth on every > > mutex_trylock(). > > Got a link to the ARM code in question ? lock_all_vcpus() in arch/arm64/kvm/arm.c: lockdep_assert_held(&kvm->lock); kvm_for_each_vcpu(c, tmp_vcpu, kvm) { if (!mutex_trylock(&tmp_vcpu->mutex)) { unlock_vcpus(kvm, c - 1); return false; } } > And I'm assuming you're talking about task_struct::lockdep_depth ? > The nest lock annotation does not in fact increment depth beyond > one of each type. It does a refcount like thing. Yes, exactly - mutex_trylock_nest_lock() is needed so that the code above counts per-lock instead of using the per-task depth. Paolo