[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Za_43qOnVsCPauEr@linux.dev>
Date: Tue, 23 Jan 2024 17:35:26 +0000
From: Oliver Upton <oliver.upton@...ux.dev>
To: Sebastian Ene <sebastianene@...gle.com>
Cc: Marc Zyngier <maz@...nel.org>, James Morse <james.morse@....com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Zenghui Yu <yuzenghui@...wei.com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, linux-arm-kernel@...ts.infradead.org,
kvmarm@...ts.linux.dev, linux-kernel@...r.kernel.org,
kernel-team@...roid.com, stable@...r.kernel.org
Subject: Re: [PATCH] KVM: arm64: Fix circular locking dependency
On Tue, Jan 23, 2024 at 04:48:19PM +0000, Sebastian Ene wrote:
> The rule inside kvm enforces that the vcpu->mutex is taken *inside*
> kvm->lock. The rule is violated by the pkvm_create_hyp_vm which acquires
^~~~~~~~~~~~~~~~~~
nit: always suffix function names with '()'
> the kvm->lock while already holding the vcpu->mutex lock from
> kvm_vcpu_ioctl. Follow the rule by taking the config lock while getting the
> VM handle and make sure that this is cleaned on VM destroy under the
> same lock.
It is always better to describe a lock in terms of what data it
protects, the critical section(s) are rather obvious here.
Avoid the circular locking dependency altogether by protecting the hyp
vm handle with the config_lock, much like we already do for other
forms of VM-scoped data.
> Signed-off-by: Sebastian Ene <sebastianene@...gle.com>
> Cc: stable@...r.kernel.org
nitpicks aside, this looks fine.
Reviewed-by: Oliver Upton <oliver.upton@...ux.dev>
--
Thanks,
Oliver
Powered by blists - more mailing lists