From: David Matlack <dmatlack@google.com>
To: Alex Williamson <alex@shazbot.org>, Bjorn Helgaas <bhelgaas@google.com>
Cc: "Adithya Jayachandran" <ajayachandra@nvidia.com>,
"Alexander Graf" <graf@amazon.com>,
"Alex Mastro" <amastro@fb.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Ankit Agrawal" <ankita@nvidia.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Askar Safin" <safinaskar@gmail.com>,
"Borislav Petkov (AMD)" <bp@alien8.de>,
"Chris Li" <chrisl@kernel.org>,
"Dapeng Mi" <dapeng1.mi@linux.intel.com>,
"David Matlack" <dmatlack@google.com>,
"David Rientjes" <rientjes@google.com>,
"Feng Tang" <feng.tang@linux.alibaba.com>,
"Jacob Pan" <jacob.pan@linux.microsoft.com>,
"Jason Gunthorpe" <jgg@nvidia.com>,
"Jason Gunthorpe" <jgg@ziepe.ca>,
"Jonathan Corbet" <corbet@lwn.net>,
"Josh Hilke" <jrhilke@google.com>, "Kees Cook" <kees@kernel.org>,
"Kevin Tian" <kevin.tian@intel.com>,
kexec@lists.infradead.org, kvm@vger.kernel.org,
"Leon Romanovsky" <leon@kernel.org>,
"Leon Romanovsky" <leonro@nvidia.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-mm@kvack.org,
linux-pci@vger.kernel.org, "Li RongQing" <lirongqing@baidu.com>,
"Lukas Wunner" <lukas@wunner.de>,
"Marco Elver" <elver@google.com>,
"Michał Winiarski" <michal.winiarski@intel.com>,
"Mike Rapoport" <rppt@kernel.org>,
"Parav Pandit" <parav@nvidia.com>,
"Pasha Tatashin" <pasha.tatashin@soleen.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
"Pawan Gupta" <pawan.kumar.gupta@linux.intel.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
"Pranjal Shrivastava" <praan@google.com>,
"Pratyush Yadav" <pratyush@kernel.org>,
"Raghavendra Rao Ananta" <rananta@google.com>,
"Randy Dunlap" <rdunlap@infradead.org>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Saeed Mahameed" <saeedm@nvidia.com>,
"Samiullah Khawaja" <skhawaja@google.com>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Vipin Sharma" <vipinsh@google.com>,
"Vivek Kasireddy" <vivek.kasireddy@intel.com>,
"William Tu" <witu@nvidia.com>, "Yi Liu" <yi.l.liu@intel.com>,
"Zhu Yanjun" <yanjun.zhu@linux.dev>
Subject: [PATCH v3 00/24] vfio/pci: Base Live Update support for VFIO device files
Date: Mon, 23 Mar 2026 23:57:52 +0000 [thread overview]
Message-ID: <20260323235817.1960573-1-dmatlack@google.com> (raw)
This series can be found on GitHub:
https://github.com/dmatlack/linux/tree/liveupdate/vfio/cdev/v3
This series adds the base support to preserve a VFIO device file across
a Live Update. "Base support" means that this allows userspace to
safely preserve a VFIO device file with LIVEUPDATE_SESSION_PRESERVE_FD
and retrieve it with LIVEUPDATE_SESSION_RETRIEVE_FD, but the device
itself is not preserved in a fully running state across Live Update.
This series aims to provide a foundation on which to build the rest of
the device preservation infrastructure, including:
1. Preservation of iommufd files [1]
2. Preservation of IOMMU driver state
3. Preservation of PCI state (BAR resources, device state, bridge state, ...)
4. Preservation of vfio-pci driver state
Steps 1 and 2 are already in-progress on the mailing list. We are
working on a detailed roadmap for steps 3 and 4.
Testing
-------
The patches at the end of this series provide comprehensive selftests
for the new code added by this series. The selftests have been validated
in both a VM environment using a virtio-net PCIe device, and in a
baremetal environment on an Intel EMR server with an Intel DSA PCIe
device.
Here is an example of how to run the new selftests:
vfio_pci_liveupdate_uapi_test:
$ tools/testing/selftests/vfio/scripts/setup.sh 0000:00:04.0
$ tools/testing/selftests/vfio/vfio_pci_liveupdate_uapi_test 0000:00:04.0
$ tools/testing/selftests/vfio/scripts/cleanup.sh
vfio_pci_liveupdate_kexec_test:
$ tools/testing/selftests/vfio/scripts/setup.sh 0000:00:04.0
$ tools/testing/selftests/vfio/vfio_pci_liveupdate_kexec_test --stage 1 0000:00:04.0
$ kexec ...
$ tools/testing/selftests/vfio/scripts/setup.sh 0000:00:04.0
$ tools/testing/selftests/vfio/vfio_pci_liveupdate_kexec_test --stage 2 0000:00:04.0
$ tools/testing/selftests/vfio/scripts/cleanup.sh
It is also possible to run vfio_pci_liveupdate_kexec_test multiple times
to preserve multiple devices simultaneously across a Live Update. This
series has been tested with up to 8 devices concurrently preserved.
Dependencies
------------
This series is built on top of v7.0-rc4 plus a series from Pasha
Tatashin to fix the module refcounting in FLB:
https://lore.kernel.org/lkml/20260318141637.1870220-10-pasha.tatashin@soleen.com/
Changelog
---------
v3:
- Add logging & documentation for pci=assign-busses overrides (Pranjal)
- Use 2026 in drivers/pci/liveupdate.c (Pranjal)
- Use 2026 in drivers/vfio/pci/vfio_pci_liveupdate.c (Pranjal)
- Drop incoming/outgoing from PCI APIs (Sami)
- Eliminate duplicate extern declarations for vfio_device_fops
(Pranjal)
- Keep struct vfio_device_file private (Pranjal)
- Add comment about not supporting hot-plug (Pranjal)
- Add comment about not supporting VFs (Sami)
- Better error handling for liveupdate_flb_get_incoming() (Pranjal)
- Remove liveupdate_enabled() checks (Zhu)
- Remove liveupdate_enabled() checks in vfio_pci_liveupdate_init() (Pranjal)
- Drop IOMMU reference from bus number commit message (Bjorn)
- Add fabric rationale to commit message (Jason)
- Swap incoming ... outgoing ordering in commit message (Bjorn)
- Use vfio_device_cdev_opened() instead of df->group (Alex)
- Add comments for CONFIG_VFIO_PCI_ZDEV_KVM (Alex)
- Add comments for vfio_pci_is_intel_display() (Alex)
- Use pci_dev_try_lock() in freeze (Alex)
- Fix device reset locking in freeze() (me)
- Use u32 for domain in PCI (Bjorn)
- Use u32 for domain in VFIO (Bjorn)
- Make pci_liveupdate_incoming_nr_devices() private to drivers/pci/ (Bjorn)
- Fix dev->liveupdate_incoming readability (Bjorn)
- Take pci_ser_delete() out of WARN_ON_ONCE() (Bjorn)
- Drop reference to userspace & files from PCI commit message (Bjorn)
- Rename __vfio_device_fops_cdev_open() to vfio_device_cdev_open_file() (Alex)
- Fix NULL pointer dereference in release() (Alex)
- Handle return value of pci_liveupdate_outgoing_preserve() (Alex)
- Make pci_liveupdate_unregister_fh() unabe to fail. (Alex)
- Move vfio_liveupdate_incoming_is_preserved() to drivers/vfio/vfio.h (Alex)
- Add vfio_pci_core_probe_reset() (Alex)
- Forward declare ser struct in include/linux/vfio_pci_core.h (Alex)
- Bump compatibility string when adding reset_works (Alex)
- How will userspace detect partial preservation? (Alex)
- Require single device per iommu_group (Jason)
- Rename pci_liveupdate_register_fh() to pci_liveupdate_register_flb() (Vipin)
- Use ksft_exit_skip() and SKIP() (Vipin)
- Move documentation to code (Vipin)
- Use __u64 instead of int for token in Live Update selftest helpers (Gemini)
- Add documentation for drivers/pci/liveupdate.c (me)
v2: https://lore.kernel.org/kvm/20260129212510.967611-1-dmatlack@google.com/
v1: https://lore.kernel.org/kvm/20251126193608.2678510-1-dmatlack@google.com/
rfc: https://lore.kernel.org/kvm/20251018000713.677779-1-vipinsh@google.com/
Cc: Pranjal Shrivastava <praan@google.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>
Cc: Adithya Jayachandran <ajayachandra@nvidia.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: Parav Pandit <parav@nvidia.com>
Cc: Leon Romanovsky <leonro@nvidia.com>
Cc: William Tu <witu@nvidia.com>
Cc: Jacob Pan <jacob.pan@linux.microsoft.com>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Pratyush Yadav <pratyush@kernel.org>
Cc: Samiullah Khawaja <skhawaja@google.com>
Cc: Chris Li <chrisl@kernel.org>
Cc: Josh Hilke <jrhilke@google.com>
Cc: David Rientjes <rientjes@google.com>
[1] https://lore.kernel.org/linux-iommu/20251202230303.1017519-1-skhawaja@google.com/
David Matlack (15):
liveupdate: Export symbols needed by modules
PCI: Add API to track PCI devices preserved across Live Update
PCI: Require Live Update preserved devices are in singleton
iommu_groups
PCI: Inherit bus numbers from previous kernel during Live Update
docs: liveupdate: Add documentation for PCI
vfio/pci: Notify PCI subsystem about devices preserved across Live
Update
vfio: Enforce preserved devices are retrieved via
LIVEUPDATE_SESSION_RETRIEVE_FD
vfio/pci: Store incoming Live Update state in struct
vfio_pci_core_device
docs: liveupdate: Add documentation for VFIO PCI
vfio: selftests: Add Makefile support for TEST_GEN_PROGS_EXTENDED
vfio: selftests: Add vfio_pci_liveupdate_uapi_test
vfio: selftests: Expose iommu_modes to tests
vfio: selftests: Expose low-level helper routines for setting up
struct vfio_pci_device
vfio: selftests: Verify that opening VFIO device fails during Live
Update
vfio: selftests: Add continuous DMA to vfio_pci_liveupdate_kexec_test
Vipin Sharma (9):
vfio/pci: Register a file handler with Live Update Orchestrator
vfio/pci: Preserve vfio-pci device files across Live Update
vfio/pci: Retrieve preserved device files after Live Update
vfio/pci: Skip reset of preserved device after Live Update
selftests/liveupdate: Move luo_test_utils.* into a reusable library
selftests/liveupdate: Add helpers to preserve/retrieve FDs
vfio: selftests: Build liveupdate library in VFIO selftests
vfio: selftests: Initialize vfio_pci_device using a VFIO cdev FD
vfio: selftests: Add vfio_pci_liveupdate_kexec_test
Documentation/PCI/liveupdate.rst | 23 +
.../admin-guide/kernel-parameters.txt | 6 +-
Documentation/core-api/liveupdate.rst | 2 +
.../driver-api/vfio_pci_liveupdate.rst | 23 +
MAINTAINERS | 2 +
drivers/pci/Kconfig | 11 +
drivers/pci/Makefile | 1 +
drivers/pci/liveupdate.c | 415 ++++++++++++++++++
drivers/pci/pci.h | 14 +
drivers/pci/probe.c | 37 +-
drivers/vfio/device_cdev.c | 63 ++-
drivers/vfio/group.c | 9 +
drivers/vfio/pci/Kconfig | 11 +
drivers/vfio/pci/Makefile | 1 +
drivers/vfio/pci/vfio_pci.c | 14 +-
drivers/vfio/pci/vfio_pci_core.c | 90 ++--
drivers/vfio/pci/vfio_pci_liveupdate.c | 328 ++++++++++++++
drivers/vfio/pci/vfio_pci_priv.h | 18 +
drivers/vfio/vfio.h | 18 +
drivers/vfio/vfio_main.c | 16 +-
include/linux/kho/abi/pci.h | 62 +++
include/linux/kho/abi/vfio_pci.h | 45 ++
include/linux/pci.h | 41 ++
include/linux/vfio.h | 13 +
include/linux/vfio_pci_core.h | 2 +
kernel/liveupdate/luo_core.c | 1 +
kernel/liveupdate/luo_file.c | 2 +
tools/testing/selftests/liveupdate/.gitignore | 1 +
tools/testing/selftests/liveupdate/Makefile | 14 +-
.../include/libliveupdate.h} | 11 +-
.../selftests/liveupdate/lib/libliveupdate.mk | 20 +
.../{luo_test_utils.c => lib/liveupdate.c} | 43 +-
.../selftests/liveupdate/luo_kexec_simple.c | 2 +-
.../selftests/liveupdate/luo_multi_session.c | 2 +-
tools/testing/selftests/vfio/Makefile | 23 +-
.../vfio/lib/include/libvfio/iommu.h | 2 +
.../lib/include/libvfio/vfio_pci_device.h | 8 +
tools/testing/selftests/vfio/lib/iommu.c | 4 +-
.../selftests/vfio/lib/vfio_pci_device.c | 60 ++-
.../vfio/vfio_pci_liveupdate_kexec_test.c | 256 +++++++++++
.../vfio/vfio_pci_liveupdate_uapi_test.c | 93 ++++
41 files changed, 1715 insertions(+), 92 deletions(-)
create mode 100644 Documentation/PCI/liveupdate.rst
create mode 100644 Documentation/driver-api/vfio_pci_liveupdate.rst
create mode 100644 drivers/pci/liveupdate.c
create mode 100644 drivers/vfio/pci/vfio_pci_liveupdate.c
create mode 100644 include/linux/kho/abi/pci.h
create mode 100644 include/linux/kho/abi/vfio_pci.h
rename tools/testing/selftests/liveupdate/{luo_test_utils.h => lib/include/libliveupdate.h} (80%)
create mode 100644 tools/testing/selftests/liveupdate/lib/libliveupdate.mk
rename tools/testing/selftests/liveupdate/{luo_test_utils.c => lib/liveupdate.c} (89%)
create mode 100644 tools/testing/selftests/vfio/vfio_pci_liveupdate_kexec_test.c
create mode 100644 tools/testing/selftests/vfio/vfio_pci_liveupdate_uapi_test.c
base-commit: 3251ac3df4374e4e94e4fbecf49ad1573933018a
prerequisite-patch-id: 37ebd38e2247ccb02e6a6c7543a378534d69a038
prerequisite-patch-id: 19c8469a9ae5cd13618481dd75012444330f80f9
prerequisite-patch-id: 2ba04f598993e2c2d941c4cd3f2dc1e98905d68b
prerequisite-patch-id: fcab928f6ee32a145667822ceca5e4f1f567d530
prerequisite-patch-id: 6d11347278609426baa9eacc1726b32b48d09a25
prerequisite-patch-id: 94a9e8a8cb6004e12de90fcc0068e8a8b12652de
prerequisite-patch-id: d658019a7ac7c82ebe4a6c6086457e27460174d3
prerequisite-patch-id: 41e68c9fc8e8c5e493497e87ca13577b3167cf80
--
2.53.0.983.g0bb29b3bc5-goog
next reply other threads:[~2026-03-23 23:58 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 23:57 David Matlack [this message]
2026-03-23 23:57 ` [PATCH v3 01/24] liveupdate: Export symbols needed by modules David Matlack
2026-03-23 23:57 ` [PATCH v3 02/24] PCI: Add API to track PCI devices preserved across Live Update David Matlack
2026-03-25 20:06 ` David Matlack
2026-03-25 23:12 ` Bjorn Helgaas
2026-03-26 21:39 ` David Matlack
2026-03-30 22:54 ` Bjorn Helgaas
2026-03-31 17:33 ` Samiullah Khawaja
2026-04-02 21:28 ` Yanjun.Zhu
2026-04-03 17:24 ` Chris Li
2026-04-03 21:58 ` David Matlack
2026-04-05 16:56 ` Zhu Yanjun
2026-04-06 16:06 ` David Matlack
2026-04-06 18:09 ` Yanjun.Zhu
2026-03-23 23:57 ` [PATCH v3 03/24] PCI: Require Live Update preserved devices are in singleton iommu_groups David Matlack
2026-03-24 13:07 ` Yi Liu
2026-03-24 18:00 ` David Matlack
2026-03-25 11:12 ` Yi Liu
2026-03-25 17:29 ` David Matlack
2026-03-25 23:13 ` Bjorn Helgaas
2026-03-23 23:57 ` [PATCH v3 04/24] PCI: Inherit bus numbers from previous kernel during Live Update David Matlack
2026-03-23 23:57 ` [PATCH v3 05/24] docs: liveupdate: Add documentation for PCI David Matlack
2026-03-23 23:57 ` [PATCH v3 06/24] vfio/pci: Register a file handler with Live Update Orchestrator David Matlack
2026-03-24 13:07 ` Yi Liu
2026-03-24 16:33 ` David Matlack
2026-03-23 23:57 ` [PATCH v3 07/24] vfio/pci: Preserve vfio-pci device files across Live Update David Matlack
2026-03-24 13:08 ` Yi Liu
2026-03-24 16:46 ` David Matlack
2026-03-27 23:39 ` Samiullah Khawaja
2026-04-21 17:40 ` David Matlack
2026-04-21 18:44 ` Jason Gunthorpe
2026-04-21 19:02 ` David Matlack
2026-04-21 19:20 ` Jason Gunthorpe
2026-03-23 23:58 ` [PATCH v3 08/24] vfio/pci: Retrieve preserved device files after " David Matlack
2026-03-24 13:08 ` Yi Liu
2026-03-24 17:05 ` David Matlack
2026-03-23 23:58 ` [PATCH v3 09/24] vfio/pci: Notify PCI subsystem about devices preserved across " David Matlack
2026-03-23 23:58 ` [PATCH v3 10/24] vfio: Enforce preserved devices are retrieved via LIVEUPDATE_SESSION_RETRIEVE_FD David Matlack
2026-03-23 23:58 ` [PATCH v3 11/24] vfio/pci: Store incoming Live Update state in struct vfio_pci_core_device David Matlack
2026-03-23 23:58 ` [PATCH v3 12/24] vfio/pci: Skip reset of preserved device after Live Update David Matlack
2026-03-23 23:58 ` [PATCH v3 13/24] docs: liveupdate: Add documentation for VFIO PCI David Matlack
2026-03-23 23:58 ` [PATCH v3 14/24] selftests/liveupdate: Move luo_test_utils.* into a reusable library David Matlack
2026-03-23 23:58 ` [PATCH v3 15/24] selftests/liveupdate: Add helpers to preserve/retrieve FDs David Matlack
2026-03-23 23:58 ` [PATCH v3 16/24] vfio: selftests: Build liveupdate library in VFIO selftests David Matlack
2026-03-23 23:58 ` [PATCH v3 17/24] vfio: selftests: Add Makefile support for TEST_GEN_PROGS_EXTENDED David Matlack
2026-03-23 23:58 ` [PATCH v3 18/24] vfio: selftests: Add vfio_pci_liveupdate_uapi_test David Matlack
2026-03-23 23:58 ` [PATCH v3 19/24] vfio: selftests: Initialize vfio_pci_device using a VFIO cdev FD David Matlack
2026-03-23 23:58 ` [PATCH v3 20/24] vfio: selftests: Add vfio_pci_liveupdate_kexec_test David Matlack
2026-03-23 23:58 ` [PATCH v3 21/24] vfio: selftests: Expose iommu_modes to tests David Matlack
2026-03-23 23:58 ` [PATCH v3 22/24] vfio: selftests: Expose low-level helper routines for setting up struct vfio_pci_device David Matlack
2026-03-23 23:58 ` [PATCH v3 23/24] vfio: selftests: Verify that opening VFIO device fails during Live Update David Matlack
2026-03-23 23:58 ` [PATCH v3 24/24] vfio: selftests: Add continuous DMA to vfio_pci_liveupdate_kexec_test David Matlack
2026-03-24 6:42 ` [PATCH v3 00/24] vfio/pci: Base Live Update support for VFIO device files Askar Safin
2026-03-26 20:43 ` David Matlack
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=20260323235817.1960573-1-dmatlack@google.com \
--to=dmatlack@google.com \
--cc=ajayachandra@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=alex@shazbot.org \
--cc=amastro@fb.com \
--cc=ankita@nvidia.com \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=chrisl@kernel.org \
--cc=corbet@lwn.net \
--cc=dapeng1.mi@linux.intel.com \
--cc=elver@google.com \
--cc=feng.tang@linux.alibaba.com \
--cc=graf@amazon.com \
--cc=jacob.pan@linux.microsoft.com \
--cc=jgg@nvidia.com \
--cc=jgg@ziepe.ca \
--cc=jrhilke@google.com \
--cc=kees@kernel.org \
--cc=kevin.tian@intel.com \
--cc=kexec@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=leon@kernel.org \
--cc=leonro@nvidia.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-pci@vger.kernel.org \
--cc=lirongqing@baidu.com \
--cc=lukas@wunner.de \
--cc=michal.winiarski@intel.com \
--cc=parav@nvidia.com \
--cc=pasha.tatashin@soleen.com \
--cc=paulmck@kernel.org \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=peterz@infradead.org \
--cc=praan@google.com \
--cc=pratyush@kernel.org \
--cc=rananta@google.com \
--cc=rdunlap@infradead.org \
--cc=rientjes@google.com \
--cc=rodrigo.vivi@intel.com \
--cc=rppt@kernel.org \
--cc=saeedm@nvidia.com \
--cc=safinaskar@gmail.com \
--cc=skhan@linuxfoundation.org \
--cc=skhawaja@google.com \
--cc=vipinsh@google.com \
--cc=vivek.kasireddy@intel.com \
--cc=witu@nvidia.com \
--cc=yanjun.zhu@linux.dev \
--cc=yi.l.liu@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.