vfio: fix deadlock between group lock and kvm lock
Status from this message: Applied to vfio next branch for v6.3. Thanks,
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest2 patches 8 repliesApplied
- v31 patch 15 repliesSuperseded
- v21 patch 7 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 1 patch | 8 replies | Superseded |
Changes in v4 from the cover letter
* Remove device->group->kvm reference in vfio_main by passing the kvm in (Kevin)
* Slight re-organization to make it easier for cdev to build upon this later and keep symmetry between get/put (Alex)
* Add follow-on patch that removes unused kvm argument (Yi)
Patches in v4 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | vfio: fix deadlock between group lock and kvm lockdrivers/ drivers/ drivers/ +1 more | +109 | 4 replies | |
| 2/2 | vfio: no need to pass kvm pointer during device opendrivers/ drivers/ drivers/ | +5 | 3 replies |
Reviews trailers per patch
All 2 patches have a Reviewed-by or Acked-by.
| Patch | Yi Liu | Kevin Tian | Tony Krowiak |
|---|---|---|---|
| 1/2 | R-b | R-b | T-b |
| 2/2 | R-b | R-b | T-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH v4 0/2] vfio: fix deadlock between group lock and kvm lock
Hi Alex,
Here is the latest group_lock vs kvm lock deadlock fix + a non-fix follow-on to remove the kvm argument from vfio_device_open and vfio_device_first_open.
Changes from v3:
* Remove device->group->kvm reference in vfio_main by passing the kvm in (Kevin)
* Slight re-organization to make it easier for cdev to build upon this later and keep symmetry between get/put (Alex)
* Add follow-on patch that removes unused kvm argument (Yi)
Changes from v2:
* Relocate the new functions back to vfio_main and externalize to call from group (Kevin) since cdev will need this too
* s/vfio_kvm_*_kvm/vfio_device_*_kvm/ and only pass device as input. Handle new kvm_ref_lock directly inside vfio_device_get_kvm (Alex)
* Add assert_lockdep_held for dev_set lock (Alex)
* Internalize error paths for vfio_device_get_kvm_safe and now return void - either device->kvm is set with a ref taken or is NULL (Alex)
* Other flow suggestions to make the call path cleaner - Thanks! (Alex)
* Can't pass group->kvm to vfio_device_open, as it references the value outside of new lock. Pass device->kvm to minimize changes in this fix (Alex, Yi)
Changes from v1:
* use spin_lock instead of spin_lock_irqsave (Jason)
* clear device->kvm_put as part of vfio_kvm_put_kvm (Yi)
* Re-arrange code to avoid referencing the group contents from within vfio_main (Kevin) which meant moving most of the code in this patch to group.c along with getting/dropping of the dev_set lock
Matthew Rosato (2):
vfio: fix deadlock between group lock and kvm lock
vfio: no need to pass kvm pointer during device open
drivers/vfio/group.c | 44 +++++++++++++++++++++---- drivers/vfio/vfio.h | 18 +++++++++-- drivers/vfio/vfio_main.c | 70 +++++++++++++++++++++++++++++++++------- include/linux/vfio.h | 2 +- 4 files changed, 113 insertions(+), 21 deletions(-)
Signature · 1 line
2.39.1