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

From: Bjorn Helgaas
Date: Fri Nov 11 2022 - 18:42:25 EST


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