From: "Michał Winiarski" <michal.winiarski@intel.com>
To: Jason Gunthorpe <jgg@ziepe.ca>,
Alex Williamson <alex@shazbot.org>,
"Kevin Tian" <kevin.tian@intel.com>,
Yishai Hadas <yishaih@nvidia.com>,
Longfang Liu <liulongfang@huawei.com>,
Shameer Kolothum <skolothumtho@nvidia.com>,
"Brett Creeley" <brett.creeley@amd.com>,
Giovanni Cabiddu <giovanni.cabiddu@intel.com>,
<kvm@vger.kernel.org>, <qat-linux@intel.com>,
<virtualization@lists.linux.dev>, <linux-kernel@vger.kernel.org>
Cc: "Michał Winiarski" <michal.winiarski@intel.com>
Subject: [PATCH 0/6] vfio: Reset migration device state using dedicated callback
Date: Thu, 20 Nov 2025 13:36:41 +0100 [thread overview]
Message-ID: <20251120123647.3522082-1-michal.winiarski@intel.com> (raw)
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
next reply other threads:[~2025-11-20 12:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 12:36 Michał Winiarski [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251120123647.3522082-1-michal.winiarski@intel.com \
--to=michal.winiarski@intel.com \
--cc=alex@shazbot.org \
--cc=brett.creeley@amd.com \
--cc=giovanni.cabiddu@intel.com \
--cc=jgg@ziepe.ca \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liulongfang@huawei.com \
--cc=qat-linux@intel.com \
--cc=skolothumtho@nvidia.com \
--cc=virtualization@lists.linux.dev \
--cc=yishaih@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®