mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/6] vfio: Reset migration device state using dedicated callback
@ 2025-11-20 12:36 Michał Winiarski
  2025-11-20 12:36 ` [PATCH 1/6] vfio: Introduce .migration_reset_state() callback Michał Winiarski
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Michał Winiarski @ 2025-11-20 12:36 UTC (permalink / raw)
  To: Jason Gunthorpe, Alex Williamson, Kevin Tian, Yishai Hadas,
	Longfang Liu, Shameer Kolothum, Brett Creeley, Giovanni Cabiddu,
	kvm, qat-linux, virtualization, linux-kernel
  Cc: Michał Winiarski

Hi,

In a recent discussion [1], an unsafe locking pattern was discovered.
Initially, it was believed that the locking issue is related to calling
copy_from_user()/copy_to_user() under state_mutex [2], but it turns out
that it's a generic issue that has impact on all drivers that are not
implementing a "deferred reset".

This is a first attempt to simplify the migration device state locking,
following a suggestion from Jason to try and solve the issue on core
side rather than duplicating deferred reset in all of the drivers.

Introduce a dedicated .migration_reset_state() callback called outside
vdev->memory_lock to break the locking dependency chain and convert all
of the drivers to use it.

[1] https://lore.kernel.org/intel-xe/7dtl5qum4mfgjosj2mkfqu5u5tu7p2roi2et3env4lhrccmiqi@asemffaeeflr/
[2] https://lore.kernel.org/kvm/20240220132459.GM13330@nvidia.com/

Michał Winiarski (6):
  vfio: Introduce .migration_reset_state() callback
  hisi_acc_vfio_pci: Use .migration_reset_state() callback
  vfio/pds: Use .migration_reset_state() callback
  vfio/qat: Use .migration_reset_state() callback
  vfio/mlx5: Use .migration_reset_state() callback
  vfio/virtio: Use .migration_reset_state() callback

 .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c    |  7 +-
 drivers/vfio/pci/mlx5/cmd.c                   | 15 ++--
 drivers/vfio/pci/mlx5/cmd.h                   |  3 -
 drivers/vfio/pci/mlx5/main.c                  | 59 ++++-----------
 drivers/vfio/pci/pds/pci_drv.c                | 10 ---
 drivers/vfio/pci/pds/vfio_dev.c               | 12 ++++
 drivers/vfio/pci/qat/main.c                   | 36 +++++-----
 drivers/vfio/pci/vfio_pci_core.c              | 25 ++++++-
 drivers/vfio/pci/virtio/common.h              |  3 -
 drivers/vfio/pci/virtio/main.c                |  1 -
 drivers/vfio/pci/virtio/migrate.c             | 71 ++++++-------------
 include/linux/vfio.h                          |  4 ++
 12 files changed, 101 insertions(+), 145 deletions(-)

-- 
2.51.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-11-24 21:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-20 12:36 [PATCH 0/6] vfio: Reset migration device state using dedicated callback Michał Winiarski
2025-11-20 12:36 ` [PATCH 1/6] vfio: Introduce .migration_reset_state() callback Michał Winiarski
2025-11-21  7:13   ` Tian, Kevin
2025-11-24 21:29     ` Winiarski, Michal
2025-11-21 18:16   ` Alex Williamson
2025-11-24 21:44     ` Michał Winiarski
2025-11-20 12:36 ` [PATCH 2/6] hisi_acc_vfio_pci: Use " Michał Winiarski
2025-11-20 12:36 ` [PATCH 3/6] vfio/pds: " Michał Winiarski
2025-11-20 12:36 ` [PATCH 4/6] vfio/qat: " Michał Winiarski
2025-11-20 12:36 ` [PATCH 5/6] vfio/mlx5: " Michał Winiarski
2025-11-20 12:36 ` [PATCH 6/6] vfio/virtio: " Michał Winiarski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®