Re: [PATCH v18 3/4] vfio/pci: Add a reset_done callback for vfio-pci driver

From: Keith Busch

Date: Thu Jun 04 2026 - 16:42:25 EST


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.