diff options
author | Tony Krowiak <akrowiak@linux.ibm.com> | 2021-09-23 22:21:58 -0400 |
---|---|---|
committer | Alexander Gordeev <agordeev@linux.ibm.com> | 2022-07-19 16:18:10 +0200 |
commit | 21195eb038bcb4c21daef761e8b18f3cc9f22020 (patch) | |
tree | 16f95d33323c32113f220b0b8421bf6dae8cc615 /sound/i2c | |
parent | d0786556caa1a9b63a7bee321546c6cac1e84e96 (diff) | |
download | linux-21195eb038bcb4c21daef761e8b18f3cc9f22020.tar.bz2 |
s390/vfio-ap: introduce new mutex to control access to the KVM pointer
The vfio_ap device driver registers for notification when the pointer to
the KVM object for a guest is set. Recall that the KVM lock (kvm->lock)
mutex must be taken outside of the matrix_dev->lock mutex to prevent the
reporting by lockdep of a circular locking dependency (a.k.a., a lockdep
splat):
* see commit 0cc00c8d4050 ("Fix circular lockdep when setting/clearing
crypto masks")
* see commit 86956e70761b ("replace open coded locks for
VFIO_GROUP_NOTIFY_SET_KVM notification")
With the introduction of support for hot plugging/unplugging AP devices
passed through to a KVM guest, a new guests_lock mutex is introduced to
ensure the proper locking order is maintained:
struct ap_matrix_dev {
...
struct mutex guests_lock;
...
}
The matrix_dev->guests_lock controls access to the matrix_mdev instances
that hold the state for AP devices that have been passed through to a
KVM guest. This lock must be held to control access to the KVM pointer
(matrix_mdev->kvm) while the vfio_ap device driver is using it to
plug/unplug AP devices passed through to the KVM guest.
Keep in mind, the proper locking order must be maintained whenever
dynamically updating a KVM guest's APCB to plug/unplug adapters, domains
and control domains:
1. matrix_dev->guests_lock: required to use the KVM pointer - stored in
a struct ap_matrix_mdev instance - to update a KVM guest's APCB
2. matrix_mdev->kvm->lock: required to update a guest's APCB
3. matrix_dev->mdevs_lock: required to access data stored in a
struct ap_matrix_mdev instance.
Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Diffstat (limited to 'sound/i2c')
0 files changed, 0 insertions, 0 deletions