]> Git Repo - linux.git/commit
s390/vfio-ap: replace open coded locks for VFIO_GROUP_NOTIFY_SET_KVM notification
authorTony Krowiak <[email protected]>
Mon, 23 Aug 2021 21:20:47 +0000 (17:20 -0400)
committerAlex Williamson <[email protected]>
Tue, 24 Aug 2021 18:14:05 +0000 (12:14 -0600)
commit86956e70761b3292156d668e87126844334dd71b
tree1b3ab8ab7490afc04134d5d0ab7d4b4b240a820a
parent1e753732bda6dcf888ea0b90b2a91ac1c1a0bae9
s390/vfio-ap: replace open coded locks for VFIO_GROUP_NOTIFY_SET_KVM notification

It was pointed out during an unrelated patch review that locks should not
be open coded - i.e., writing the algorithm of a standard lock in a
function instead of using a lock from the standard library. The setting and
testing of a busy flag and sleeping on a wait_event is the same thing
a lock does. The open coded locks are invisible to lockdep, so potential
locking problems are not detected.

This patch removes the open coded locks used during
VFIO_GROUP_NOTIFY_SET_KVM notification. The busy flag
and wait queue were introduced to resolve a possible circular locking
dependency reported by lockdep when starting a secure execution guest
configured with AP adapters and domains. Reversing the order in which
the kvm->lock mutex and matrix_dev->lock mutex are locked resolves the
issue reported by lockdep, thus enabling the removal of the open coded
locks.

Signed-off-by: Tony Krowiak <[email protected]>
Acked-by: Halil Pasic <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alex Williamson <[email protected]>
arch/s390/kvm/kvm-s390.c
drivers/s390/crypto/vfio_ap_ops.c
drivers/s390/crypto/vfio_ap_private.h
This page took 0.066009 seconds and 4 git commands to generate.