Re: [PATCH v2] pci: fix device presence detection for VFs

Michael S. Tsirkin
2022-11-13T08:47:22Z

On Fri, Nov 11, 2022 at 05:42:19PM -0600, Bjorn Helgaas wrote:
> On Thu, Nov 10, 2022 at 03:15:55PM -0500, Michael S. Tsirkin wrote:
> > On Thu, Nov 10, 2022 at 01:35:47PM -0600, Bjorn Helgaas wrote:
> > ...
>
> > > Prior to this change pci_device_is_present(VF) returned "false"
> > > (because the VF Vendor ID is 0xffff); after the change it will return
> > > "true" (because it will look at the PF Vendor ID instead).
> > >
> > > Previously virtio_pci_remove() called virtio_break_device(). I guess
> > > that meant the virtio I/O operation will never be completed?
> > >
> > > But if we don't call virtio_break_device(), the virtio I/O operation
> > > *will* be completed?
> >
> > It's completed anyway - nothing special happened at the device
> > level - but driver does not detect it.
> >
> > Calling virtio_break_device will mark all queues as broken, as
> > a result attempts to check whether operation completed
> > will return false.
> >
> > This probably means we need to work on handling surprise removal
> > better in virtio blk - since it looks like actual suprise
> > removal will hang too. But that I think is a separate issue.
>
> Yeah, this situation doesn't seem like it's inherently special for
> virtio or VFs, so it's a little surprising to see
> pci_device_is_present() used there.
>
> Bjorn

Just making sure - pci_device_is_present *is* the suggested way
to distinguish between graceful and surprise removal, isn't it?

--
MST