On Fri, Oct 01, 2021 at 10:25:02AM +0200, Laurent Vivier wrote: > Failover needs to detect the end of the PCI unplug to start migration > after the VFIO card has been unplugged. > > To do that, a flag is set in pcie_cap_slot_unplug_request_cb() and reset in > pcie_unplug_device().
> + /* > + * pending_deleted_event is used by virtio-net failover to detect the > + * end of the unplug operation, the flag is set to false in > + * acpi_pcihp_eject_slot() when the operation is completed. > + */ > + pdev->qdev.pending_deleted_event = true; This has the side effect of blocking a second 'device_del' command. So, in case the first time didn't work (for example due to the guest not listening because grub just doesn't do that), you can try a second time once the linux kernel is up'n'running. I suspect this patch will break that (didn't actually test though). While being at it I'll throw in a link to a bunch of slightly related pcie hotplug patches: https://gitlab.com/kraxel/qemu/-/commits/sirius/pcie-hotplug I'll be offline next week, so not posting that series for discussion yet, will probably do that when I'm back, but you might want have a look nevertheless. take care, Gerd