summary refs log tree commit diff
path: root/kernel
diff options
context:
space:
mode:
authorOliver Upton <oliver.upton@linux.dev>2023-03-27 16:47:47 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-05-11 23:03:03 +0900
commit569f33c3c2f9f3ab17e64abf9fa6472697058648 (patch)
treed77e774df70730ac8deb0757b851a6bca16b8e11 /kernel
parent2b57af7bb9f1b7df54908d5010ab8dd1146247bf (diff)
downloadlinux-569f33c3c2f9f3ab17e64abf9fa6472697058648.tar.gz
KVM: arm64: Use config_lock to protect vgic state
commit f00327731131d1b5aa6a1aa9f50bcf8d620ace4c upstream.

Almost all of the vgic state is VM-scoped but accessed from the context
of a vCPU. These accesses were serialized on the kvm->lock which cannot
be nested within a vcpu->mutex critical section.

Move over the vgic state to using the config_lock. Tweak the lock
ordering where necessary to ensure that the config_lock is acquired
after the vcpu->mutex. Acquire the config_lock in kvm_vgic_create() to
avoid a race between the converted flows and GIC creation. Where
necessary, continue to acquire kvm->lock to avoid a race with vCPU
creation (i.e. flows that use lock_all_vcpus()).

Finally, promote the locking expectations in comments to lockdep
assertions and update the locking documentation for the config_lock as
well as vcpu->mutex.

Cc: stable@vger.kernel.org
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230327164747.2466958-5-oliver.upton@linux.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions