On Thu, Jul 6, 2023 at 3:24 PM Peter Xu <pet...@redhat.com> wrote: > > On Thu, Jul 06, 2023 at 03:07:40PM -0300, Leonardo Bras Soares Passos wrote: > > > I asked the same question, and I still keep confused: whether there's a > > > first bad commit? Starting from when it fails? > > > > > > For example, is this broken on 6.0 binaries too with pc-q35-6.0? > > > > I tested for qemu 6.0, and it still reproduces, but have not pursued > > this any further. > > I see, thanks! > > But then do you know why it's never hit before? I assume it means this bug > has been there for a long time.
Oh, I totally missed updating the commit msg on this: --- In this scenario, hotplug_handler_plug() calls pcie_cap_slot_plug_cb(), which sets dev->config byte 0x6e with bit PCI_EXP_SLTSTA_PDS to signal PCI - hotplug for the guest. After a while the guest will deal with this hotplug - and qemu will clear the above bit. + hotplug for the guest. After a while, if the guest powers down the device + qemu will clear the above bit. --- The whole idea is that the guest powers down the device, which causes qemu to hot-remove it, and clear PCI_EXP_SLTSTA_PDS. --- /* * If the slot is populated, power indicator is off and power * controller is off, it is safe to detach the devices. * * Note: don't detach if condition was already true: * this is a work around for guests that overwrite * control of powered off slots before powering them on. */ if ((sltsta & PCI_EXP_SLTSTA_PDS) && pcie_sltctl_powered_off(val) && !pcie_sltctl_powered_off(old_slt_ctl)) { pcie_cap_slot_do_unplug(dev); // clear PCI_EXP_SLTSTA_PDS } --- Since the bit is different on source & target qemu, the migration is aborted. > > -- > Peter Xu > Thanks for reviewing Peter! I will send a v3 with the updated commit msg and add the comments suggested by Juan in the source code. Thanks! Leo