From: Vipin Sharma <vipinsh@google.com>
To: "Yanjun.Zhu" <yanjun.zhu@linux.dev>
Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org, kvm@vger.kernel.org,
linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
ajayachandra@nvidia.com, alex@shazbot.org, amastro@fb.com,
ankita@nvidia.com, apopple@nvidia.com, bhelgaas@google.com,
chrisl@kernel.org, christian.koenig@amd.com, corbet@lwn.net,
dmatlack@google.com, graf@amazon.com,
jacob.pan@linux.microsoft.com, jgg@nvidia.com, jgg@ziepe.ca,
jrhilke@google.com, julianr@linux.ibm.com, kees@kernel.org,
kevin.tian@intel.com, leon@kernel.org, leonro@nvidia.com,
lukas@wunner.de, mattev@meta.com, michal.winiarski@intel.com,
parav@nvidia.com, pasha.tatashin@soleen.com, praan@google.com,
pratyush@kernel.org, rananta@google.com, rientjes@google.com,
rodrigo.vivi@intel.com, rppt@kernel.org, saeedm@nvidia.com,
schnelle@linux.ibm.com, skhan@linuxfoundation.org,
skhawaja@google.com, vivek.kasireddy@intel.com, witu@nvidia.com,
yi.l.liu@intel.com
Subject: Re: [PATCH v5 17/20] vfio: selftests: Add vfio_pci_liveupdate_kexec_test
Date: Tue, 4 Aug 2026 23:02:55 -0700 [thread overview]
Message-ID: <20260805055042.GA806762.vipinsh@google.com> (raw)
In-Reply-To: <0556e2fc-3be5-4023-a9a4-8482fa8c88b2@linux.dev>
On Tue, Aug 04, 2026 at 03:19:34PM -0700, Yanjun.Zhu wrote:
>
> On 7/14/26 8:15 AM, Vipin Sharma wrote:
> > Add a selftest to exercise preserving a vfio-pci device across a Live
> > Update. For now the test is extremely simple and just verifies that the
> > device file can be preserved and retrieved. In the future this test will
> > be extended to verify more parts about device preservation as they are
> > implemented.
> >
> > This test is added to TEST_GEN_PROGS_EXTENDED since it must be run
> > manually along with a kexec.
> >
> > To run this test manually:
> >
> > $ 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 ... # NOTE: Exact method will be distro-dependent
> >
> > $ 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
> Hi, Vipin
>
> Thanks a lot for your help. I followed your suggestion, vfio-pci setup can
> work.
I am glad your setup using virsh is working.
>
> The followings are the test result. In the step 3, after kexec, there are
> some fails. I am not sure if these are known problem or not.
>
> 1. Before kexec command
>
> + modprobe -v vfio-pci
> + tools/testing/selftests/vfio/scripts/setup.sh 0000:00:04.0
> + echo "vfio-pci" > /sys/bus/pci/devices/0000:00:04.0/driver_override
> + echo "0000:00:04.0" > /sys/bus/pci/drivers/vfio-pci/bind
> + tools/testing/selftests/vfio/vfio_pci_liveupdate_kexec_test --stage 1
> 0000:00:04.0
> Preserving device in session
> Preserving memfd of size 0x40100000 in session
> # [STAGE 1] Forking persistent child to hold sessions...
> # [STAGE 1] Child PID: 1236. Resources are pinned.
> # [STAGE 1] You may now perform kexec reboot.
> + set +x
>
> 2. Run kexec command
>
> 3. After kexec command
>
> + echo "vfio-pci" > /sys/bus/pci/devices/0000:00:04.0/driver_override
> + echo "0000:00:04.0" > /sys/bus/pci/drivers/vfio-pci/bind
> Checking open(/dev/vfio/devices/vfio0) fails <--- I can confirm that the
> /dev/vfio/devices/vfio0 exists. But open this failed.
This is correct output. Test is verifying that open should fail. If it
didn't fail the ntest would have exited with an error. A preserved VFIO
FD can only be retrived using Live Update session ioctls and not through
usual VFIO dev path.
> Checking ioctl(group_fd, VFIO_GROUP_GET_DEVICE_FD, "0000:00:04.0") fails
> (vfio_type1_iommu) <--- fails
> Checking ioctl(group_fd, VFIO_GROUP_GET_DEVICE_FD, "0000:00:04.0") fails
> (vfio_type1v2_iommu). <--- fails
> Checking ioctl(group_fd, VFIO_GROUP_GET_DEVICE_FD, "0000:00:04.0") fails
> (iommufd_compat_type1) <--- fails
> Checking ioctl(group_fd, VFIO_GROUP_GET_DEVICE_FD, "0000:00:04.0") fails
> (iommufd_compat_type1v2). <--- fails
These are all correct output. Test is verifying that userspace should
not be able to get VFIO device FD only through Live Update session
ioctls and nothing else.
> Retrieving memfd from LUO
> Finishing the session before retrieving the device (should fail)
> Retrieving the device FD from LUO
> Finishing the session before binding to iommufd (should fail)
> Binding the device to an iommufd and setting it up
> Finishing the session
>
This is shows VFIO FD is successfully retrived by Live Update ioctl.
So, you saw expected output from successful test run. I will change
the message getting printed to avoid confusion. I think current way of
printing ".... fails" is confusing.
Thanks
Vipin
next prev parent reply other threads:[~2026-08-05 6:03 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 15:14 [PATCH v5 00/20] vfio/pci: Base Live Update support for VFIO Vipin Sharma
2026-07-14 15:14 ` [PATCH v5 01/20] vfio/pci: Factor out the reset logic in VFIO PCI device close path Vipin Sharma
2026-07-14 15:14 ` [PATCH v5 02/20] vfio: Export various helpers from VFIO Vipin Sharma
2026-07-14 15:30 ` sashiko-bot
2026-07-20 17:31 ` Vipin Sharma
2026-07-14 15:14 ` [PATCH v5 03/20] vfio/pci: Export vfio_pci_dma_buf_move for vfio-pci module Vipin Sharma
2026-07-14 15:14 ` [PATCH v5 04/20] liveupdate: Export symbols needed by modules Vipin Sharma
2026-07-14 15:14 ` [PATCH v5 05/20] vfio/pci: Register a file handler with Live Update Orchestrator Vipin Sharma
2026-07-14 15:28 ` sashiko-bot
2026-07-20 17:46 ` Vipin Sharma
2026-07-14 15:14 ` [PATCH v5 06/20] vfio/pci: Preserve vfio-pci device files across Live Update Vipin Sharma
2026-07-14 15:36 ` sashiko-bot
2026-07-20 18:08 ` Vipin Sharma
2026-07-21 23:16 ` Josh Hilke
2026-07-23 21:55 ` Vipin Sharma
2026-07-14 15:14 ` [PATCH v5 07/20] vfio: Introduce vfio_find_device() helper Vipin Sharma
2026-07-14 15:14 ` [PATCH v5 08/20] vfio: Refactor vfio_device_fops_cdev_open() Vipin Sharma
2026-07-14 15:14 ` [PATCH v5 09/20] vfio: Add API to open cdev device for Live Update restore Vipin Sharma
2026-07-14 15:14 ` [PATCH v5 10/20] vfio/pci: Retrieve preserved device files after Live Update Vipin Sharma
2026-07-21 16:23 ` Josh Hilke
2026-07-14 15:14 ` [PATCH v5 11/20] vfio: Enforce preserved devices are retrieved via LIVEUPDATE_SESSION_RETRIEVE_FD Vipin Sharma
2026-07-14 15:28 ` sashiko-bot
2026-07-20 18:09 ` Vipin Sharma
2026-07-14 15:14 ` [PATCH v5 12/20] docs: liveupdate: Add documentation for VFIO PCI Vipin Sharma
2026-07-14 15:14 ` [PATCH v5 13/20] vfio: selftests: Build liveupdate library in VFIO selftests Vipin Sharma
2026-07-14 15:20 ` sashiko-bot
2026-07-20 18:11 ` Vipin Sharma
2026-07-14 15:14 ` [PATCH v5 14/20] vfio: selftests: Add vfio_pci_liveupdate_uapi_test Vipin Sharma
2026-07-14 15:44 ` sashiko-bot
2026-07-20 18:12 ` Vipin Sharma
2026-07-14 15:15 ` [PATCH v5 15/20] vfio: selftests: Initialize vfio_pci_device using a VFIO cdev FD Vipin Sharma
2026-07-14 15:15 ` [PATCH v5 16/20] vfio: selftests: Add Makefile support for TEST_GEN_PROGS_EXTENDED Vipin Sharma
2026-07-14 15:15 ` [PATCH v5 17/20] vfio: selftests: Add vfio_pci_liveupdate_kexec_test Vipin Sharma
2026-07-14 15:35 ` sashiko-bot
2026-07-20 18:14 ` Vipin Sharma
2026-07-27 0:40 ` Zhu Yanjun
2026-07-28 5:34 ` Vipin Sharma
2026-08-04 22:19 ` Yanjun.Zhu
2026-08-05 6:02 ` Vipin Sharma [this message]
2026-07-14 15:15 ` [PATCH v5 18/20] vfio: selftests: Expose iommu_modes to tests Vipin Sharma
2026-07-14 15:15 ` [PATCH v5 19/20] vfio: selftests: Verify that opening VFIO device fails during Live Update Vipin Sharma
2026-07-14 15:42 ` sashiko-bot
2026-07-20 18:28 ` Vipin Sharma
2026-07-14 15:15 ` [PATCH v5 20/20] vfio: selftests: Add continuous DMA to vfio_pci_liveupdate_kexec_test Vipin Sharma
2026-07-14 15:37 ` sashiko-bot
2026-07-20 18:33 ` Vipin Sharma
2026-07-16 23:24 ` [PATCH v5 00/20] vfio/pci: Base Live Update support for VFIO Yanjun.Zhu
2026-07-17 1:22 ` Yanjun.Zhu
2026-07-20 17:08 ` Vipin Sharma
2026-07-23 22:18 ` Yanjun.Zhu
2026-07-23 23:01 ` Vipin Sharma
2026-07-23 22:58 ` Vipin Sharma
2026-08-05 6:04 ` Vipin Sharma
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=20260805055042.GA806762.vipinsh@google.com \
--to=vipinsh@google.com \
--cc=ajayachandra@nvidia.com \
--cc=alex@shazbot.org \
--cc=amastro@fb.com \
--cc=ankita@nvidia.com \
--cc=apopple@nvidia.com \
--cc=bhelgaas@google.com \
--cc=chrisl@kernel.org \
--cc=christian.koenig@amd.com \
--cc=corbet@lwn.net \
--cc=dmatlack@google.com \
--cc=graf@amazon.com \
--cc=jacob.pan@linux.microsoft.com \
--cc=jgg@nvidia.com \
--cc=jgg@ziepe.ca \
--cc=jrhilke@google.com \
--cc=julianr@linux.ibm.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=lukas@wunner.de \
--cc=mattev@meta.com \
--cc=michal.winiarski@intel.com \
--cc=parav@nvidia.com \
--cc=pasha.tatashin@soleen.com \
--cc=praan@google.com \
--cc=pratyush@kernel.org \
--cc=rananta@google.com \
--cc=rientjes@google.com \
--cc=rodrigo.vivi@intel.com \
--cc=rppt@kernel.org \
--cc=saeedm@nvidia.com \
--cc=schnelle@linux.ibm.com \
--cc=skhan@linuxfoundation.org \
--cc=skhawaja@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.