[<prev] [next>] [day] [month] [year] [list]
Message-ID: <0cfb1f41-381f-6621-0fe7-14a54059a90d@redhat.com>
Date: Fri, 29 Apr 2022 10:48:26 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Hillf Danton <hdanton@...a.com>
Cc: Peter Gonda <pgonda@...gle.com>,
Sean Christopherson <seanjc@...gle.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3] KVM: SEV: Mark nested locking of vcpu->lock
On 4/29/22 03:03, Hillf Danton wrote:
> Wonder if local lock classes [1] help.
>
> [1]https://lore.kernel.org/lkml/165055518776.3745911.9346998911322224736.stgit@dwillia2-desk3.amr.corp.intel.com/
No, they wouldn't. Local lock classes are more of a per-subsystem lock,
while here the issue is that we are taking an arbitrary amount of locks
at the same time.
Technically it would be possible to put a struct lock_class_key in
struct kvm_vcpu, but that wouldn't scale and would actually _reduce_ the
likelihood of lockdep reporting bad things.
The effectiveness of lockdep comes exactly from using the same map for
all locks in the class, so that AB/BA scenarios are caught throughout
the whole life of the system. If each lock has a separate they would be
caught only if the "B" is exactly the same mutex in both AB and BA cases.
Paolo
Powered by blists - more mailing lists