From: Farhan Ali <alifm@linux.ibm.com>
To: Keith Busch <kbusch@kernel.org>
Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pci@vger.kernel.org, alex@shazbot.org, helgaas@kernel.org,
schnelle@linux.ibm.com, mjrosato@linux.ibm.com,
Julian Ruess <julianr@linux.ibm.com>
Subject: Re: [PATCH v18 3/4] vfio/pci: Add a reset_done callback for vfio-pci driver
Date: Fri, 5 Jun 2026 11:41:07 -0700 [thread overview]
Message-ID: <8d1cbef7-f7d9-4796-a6a1-460956adfb39@linux.ibm.com> (raw)
In-Reply-To: <aiHjIyYB_8ogbxfz@kbusch-mbp>
On 6/4/2026 1:42 PM, Keith Busch wrote:
> On Thu, Jun 04, 2026 at 10:17:04AM -0700, Farhan Ali wrote:
>> On 6/4/2026 1:28 AM, Keith Busch wrote:
>>> On Wed, Jun 03, 2026 at 11:24:14AM -0700, Farhan Ali wrote:
>>>> +static void vfio_pci_core_aer_reset_done(struct pci_dev *pdev)
>>>> +{
>>>> + struct vfio_pci_core_device *vdev = dev_get_drvdata(&pdev->dev);
>>>> +
>>>> + if (!vdev->pci_saved_state)
>>>> + return;
>>>> +
>>>> + pci_load_saved_state(pdev, vdev->pci_saved_state);
>>>> + pci_restore_state(pdev);
>>>> +}
>>> Shouldn't there be a cooresponding user space notification that the
>>> device has been restored? There's an eventfd on the error detected side
>>> so user space can know the device needs recovery, but how does it come
>>> to know that the reset is completed?
>> I think if the VFIO_DEVICE_RESET ioctl completes successfully it should be
>> an indication that the reset has completed?
> But isn't this reset initiated by the kernel via the kernel's AER
> handler? The user space driven ioctl has nothing to do with it, unless
> I'm missing something. I'm just mentioning it as I was recently asked to
> look into DPC and AER handling for vfio, and I think there needs to be
> coordination with userspace here for a more reliable recovery.
The approach I have taken for s390x, is on an error for PCI devices
bound to vfio, we bypass host recovery completely so the kernel doesn't
drive the reset (see patch 1 of this series). The recovery will then
have to be driven by userspace. The error_detected() callback and
eventfd notifies userspace on an error, and then userspace can drive the
recovery via VFIO_DEVICE_RESET. For our primary use case of QEMU, once
notified it then injects this error into the VM so device drivers in the
VM can take recovery actions. For example for a passthrough NVMe device,
the VM's OS NVMe driver will access the device. At this point the VM's
NVMe driver's error_detected() will drive the recovery by returning
PCI_ERS_RESULT_NEED_RESET, and the s390x error recovery in the VM's OS
will try to do a reset. Resets are privileged operations and so the VM
will need intervention from QEMU to perform the reset. QEMU will invoke
the VFIO_DEVICE_RESET ioctl to now notify the host that the VM is
requesting a reset of the device. The vfio-pci driver on the host will
then perform the reset on the device to recover it. This also aligns
architecturally for us as on s390 as PCI devices are exposed as
functions to the OS, so an OS can issue resets per function (with
platform firmware doing the heavy lifting). But I am curious to learn
about your thoughts for DPC/AER with vfio for other platforms
(x86/ARM?). Thanks
Farhan
next prev parent reply other threads:[~2026-06-05 18:41 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 18:24 [PATCH v18 0/4] [VFIO] Error recovery for vfio-pci devices on s390x Farhan Ali
2026-06-03 18:24 ` [PATCH v18 1/4] s390/pci: Store PCI error information for passthrough devices Farhan Ali
2026-06-03 22:20 ` Alex Williamson
2026-06-03 23:35 ` Farhan Ali
2026-06-04 18:27 ` Alex Williamson
2026-06-03 18:24 ` [PATCH v18 2/4] vfio-pci/zdev: Add a device feature for error information Farhan Ali
2026-06-03 22:37 ` Alex Williamson
2026-06-03 23:40 ` Farhan Ali
2026-06-03 18:24 ` [PATCH v18 3/4] vfio/pci: Add a reset_done callback for vfio-pci driver Farhan Ali
2026-06-03 22:46 ` Alex Williamson
2026-06-04 0:01 ` Farhan Ali
2026-06-04 8:28 ` Keith Busch
2026-06-04 17:17 ` Farhan Ali
2026-06-04 19:57 ` Alex Williamson
2026-06-08 19:26 ` Farhan Ali
2026-06-09 19:16 ` Alex Williamson
2026-06-09 20:13 ` Farhan Ali
2026-06-04 20:42 ` Keith Busch
2026-06-05 18:41 ` Farhan Ali [this message]
2026-06-09 21:38 ` Keith Busch
2026-06-03 18:24 ` [PATCH v18 4/4] vfio/pci: Remove the pcie check for VFIO_PCI_ERR_IRQ_INDEX Farhan Ali
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=8d1cbef7-f7d9-4796-a6a1-460956adfb39@linux.ibm.com \
--to=alifm@linux.ibm.com \
--cc=alex@shazbot.org \
--cc=helgaas@kernel.org \
--cc=julianr@linux.ibm.com \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjrosato@linux.ibm.com \
--cc=schnelle@linux.ibm.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®