[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <86o6vvfse9.wl-maz@kernel.org>
Date: Wed, 14 May 2025 10:33:50 +0100
From: Marc Zyngier <maz@...nel.org>
To: Maxim Levitsky <mlevitsk@...hat.com>
Cc: kvm@...r.kernel.org,
Suzuki K Poulose <suzuki.poulose@....com>,
Jing Zhang <jingzhangos@...gle.com>,
"H. Peter Anvin" <hpa@...or.com>,
Sebastian Ott <sebott@...hat.com>,
Shusen Li <lishusen2@...wei.com>,
Waiman Long <longman@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
linux-arm-kernel@...ts.infradead.org,
Bjorn Helgaas <bhelgaas@...gle.com>,
Borislav Petkov <bp@...en8.de>,
Anup Patel <anup@...infault.org>,
Will Deacon <will@...nel.org>,
Palmer Dabbelt <palmer@...belt.com>,
Alexander Potapenko <glider@...gle.com>,
kvmarm@...ts.linux.dev,
Keisuke Nishimura <keisuke.nishimura@...ia.fr>,
Zenghui Yu <yuzenghui@...wei.com>,
Peter Zijlstra <peterz@...radead.org>,
Atish Patra <atishp@...shpatra.org>,
Joey Gouly <joey.gouly@....com>,
x86@...nel.org,
Sean Christopherson <seanjc@...gle.com>,
Andre Przywara <andre.przywara@....com>,
Kunkun Jiang <jiangkunkun@...wei.com>,
linux-riscv@...ts.infradead.org,
Randy Dunlap <rdunlap@...radead.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Boqun Feng <boqun.feng@...il.com>,
Catalin Marinas <catalin.marinas@....com>,
Alexandre Ghiti <alex@...ti.fr>,
linux-kernel@...r.kernel.org,
Dave Hansen <dave.hansen@...ux.intel.com>,
Oliver Upton <oliver.upton@...ux.dev>,
kvm-riscv@...ts.infradead.org,
Ingo Molnar <mingo@...hat.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Albert Ou <aou@...s.berkeley.edu>
Subject: Re: [PATCH v5 3/6] KVM: add kvm_lock_all_vcpus and kvm_trylock_all_vcpus
On Mon, 12 May 2025 19:04:04 +0100,
Maxim Levitsky <mlevitsk@...hat.com> wrote:
>
> In a few cases, usually in the initialization code, KVM locks all vCPUs
> of a VM to ensure that userspace doesn't do funny things while KVM performs
> an operation that affects the whole VM.
>
> Until now, all these operations were implemented using custom code,
> and all of them share the same problem:
>
> Lockdep can't cope with simultaneous locking of a large number of locks of
> the same class.
>
> However if these locks are taken while another lock is already held,
> which is luckily the case, it is possible to take advantage of little known
> _nest_lock feature of lockdep which allows in this case to have an
> unlimited number of locks of same class to be taken.
>
> To implement this, create two functions:
> kvm_lock_all_vcpus() and kvm_trylock_all_vcpus()
>
> Both functions are needed because some code that will be replaced in
> the subsequent patches, uses mutex_trylock, instead of regular mutex_lock.
>
> Suggested-by: Paolo Bonzini <pbonzini@...hat.com>
> Signed-off-by: Maxim Levitsky <mlevitsk@...hat.com>
Acked-by: Marc Zyngier <maz@...nel.org>
M.
--
Without deviation from the norm, progress is not possible.
Powered by blists - more mailing lists