I re-run the above, full PCI passthrough still attaches/detaches fine.
VFs attach fine VFs break on detach
I've thrown qemu into GDB and this is the backtrace Thread 4 "CPU 0/KVM" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7f82f0e31700 (LWP 3998)] 0x000055d2f322d45d in notifier_remove (notifier=notifier@entry=0x55d2f40c5078) at ./util/notify.c:31 31 QLIST_REMOVE(notifier, node); (gdb) bt #0 0x000055d2f322d45d in notifier_remove (notifier=notifier@entry=0x55d2f40c5078) at ./util/notify.c:31 #1 0x000055d2f2df8df9 in kvm_irqchip_remove_change_notifier (n=n@entry=0x55d2f40c5078) at ./accel/kvm/kvm-all.c:1409 #2 0x000055d2f2e56989 in vfio_exitfn (pdev=<optimized out>) at ./hw/vfio/pci.c:3079 #3 0x000055d2f3025c1b in pci_qdev_unrealize (dev=<optimized out>, errp=<optimized out>) at ./hw/pci/pci.c:1131 #4 0x000055d2f2f8c6e2 in device_set_realized (obj=<optimized out>, value=<optimized out>, errp=0x0) at ./hw/core/qdev.c:932 #5 0x000055d2f312449b in property_set_bool (obj=0x55d2f40c4430, v=<optimized out>, name=<optimized out>, opaque=0x55d2f4083ee0, errp=0x0) at ./qom/object.c:2078 #6 0x000055d2f3128c84 in object_property_set_qobject (obj=obj@entry=0x55d2f40c4430, value=value@entry=0x7f82dc2f7130, name=name@entry=0x55d2f330d85d "realized", errp=errp@entry=0x0) at ./qom/qom-qobject.c:26 #7 0x000055d2f31264ba in object_property_set_bool (obj=0x55d2f40c4430, value=<optimized out>, name=0x55d2f330d85d "realized", errp=0x0) at ./qom/object.c:1336 #8 0x000055d2f2f56bca in acpi_pcihp_device_unplug_cb (hotplug_dev=<optimized out>, s=<optimized out>, dev=0x55d2f40c4430, errp=<optimized out>) at ./hw/acpi/pcihp.c:269 #9 0x000055d2f2f56253 in acpi_pcihp_eject_slot (s=<optimized out>, bsel=<optimized out>, slots=slots@entry=256) at ./hw/acpi/pcihp.c:170 #10 0x000055d2f2f56383 in pci_write (size=<optimized out>, data=256, addr=8, opaque=<optimized out>) at ./hw/acpi/pcihp.c:341 #11 pci_write (opaque=<optimized out>, addr=<optimized out>, data=256, size=<optimized out>) at ./hw/acpi/pcihp.c:332 #12 0x000055d2f2de9cfb in memory_region_write_accessor (mr=mr@entry=0x55d2f4780970, addr=8, value=value@entry=0x7f82f0e304f8, size=size@entry=4, shift=<optimized out>, mask=mask@entry=4294967295, attrs=...) at ./memory.c:483 #13 0x000055d2f2de79ee in access_with_adjusted_size (addr=addr@entry=8, value=value@entry=0x7f82f0e304f8, size=size@entry=4, access_size_min=<optimized out>, access_size_max=<optimized out>, access_fn=access_fn@entry=0x55d2f2de9bd0 <memory_region_write_accessor>, mr=0x55d2f4780970, attrs=...) at ./memory.c:544 #14 0x000055d2f2debfc3 in memory_region_dispatch_write (mr=mr@entry=0x55d2f4780970, addr=8, data=<optimized out>, op=<optimized out>, attrs=attrs@entry=...) at ./memory.c:1475 #15 0x000055d2f2d96a30 in flatview_write_continue (fv=fv@entry=0x7f82dc14bbc0, addr=addr@entry=44552, attrs=..., buf=buf@entry=0x7f82f17e9000 "", len=len@entry=4, addr1=<optimized out>, l=<optimized out>, mr=0x55d2f4780970) at ./include/qemu/host-utils.h:164 #16 0x000055d2f2d96c46 in flatview_write (fv=0x7f82dc14bbc0, addr=44552, attrs=..., buf=0x7f82f17e9000 "", len=4) at ./exec.c:3169 #17 0x000055d2f2d9b01f in address_space_write (as=as@entry=0x55d2f3956960 <address_space_io>, addr=addr@entry=44552, attrs=..., buf=<optimized out>, len=len@entry=4) at ./exec.c:3259 #18 0x000055d2f2d9b09e in address_space_rw (as=as@entry=0x55d2f3956960 <address_space_io>, addr=addr@entry=44552, attrs=..., attrs@entry=..., buf=<optimized out>, len=len@entry=4, is_write=is_write@entry=true) at ./exec.c:3269 #19 0x000055d2f2dfc94f in kvm_handle_io (count=1, size=4, direction=<optimized out>, data=<optimized out>, attrs=..., port=44552) at ./accel/kvm/kvm-all.c:2104 #20 kvm_cpu_exec (cpu=cpu@entry=0x55d2f3dc9090) at ./accel/kvm/kvm-all.c:2350 #21 0x000055d2f2dde53e in qemu_kvm_cpu_thread_fn (arg=0x55d2f3dc9090) at ./cpus.c:1318 #22 qemu_kvm_cpu_thread_fn (arg=arg@entry=0x55d2f3dc9090) at ./cpus.c:1290 #23 0x000055d2f321fe13 in qemu_thread_start (args=<optimized out>) at ./util/qemu-thread-posix.c:519 #24 0x00007f82f4290609 in start_thread (arg=<optimized out>) at pthread_create.c:477 #25 0x00007f82f41b7153 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
I re-run the above, full PCI passthrough still attaches/detaches fine.
VFs attach fine
VFs break on detach
I've thrown qemu into GDB and this is the backtrace notifier@ entry=0x55d2f40 c5078) at ./util/notify.c:31 notifier, node); notifier@ entry=0x55d2f40 c5078) at ./util/notify.c:31 remove_ change_ notifier (n=n@entry= 0x55d2f40c5078) at ./accel/ kvm/kvm- all.c:1409 pci.c:3079 qdev.c: 932 4430, v=<optimized out>, name=<optimized out>, opaque= 0x55d2f4083ee0, errp=0x0) at ./qom/object.c:2078 property_ set_qobject (obj=obj@ entry=0x55d2f40 c4430, value=value@ entry=0x7f82dc2 f7130, name=name@ entry=0x55d2f33 0d85d "realized", errp=errp@ entry=0x0) qobject. c:26 property_ set_bool (obj=0x55d2f40c 4430, value=<optimized out>, name=0x55d2f330d85d "realized", errp=0x0) at ./qom/object.c:1336 device_ unplug_ cb (hotplug_ dev=<optimized out>, s=<optimized out>, dev=0x55d2f40c4430, errp=<optimized out>) at ./hw/acpi/ pcihp.c: 269 eject_slot (s=<optimized out>, bsel=<optimized out>, slots=slots@ entry=256) at ./hw/acpi/ pcihp.c: 170 pcihp.c: 341 pcihp.c: 332 region_ write_accessor (mr=mr@ entry=0x55d2f47 80970, addr=8, value=value@ entry=0x7f82f0e 304f8, size=size@entry=4, shift=<optimized out>, mask@entry= 4294967295, attrs=...) at ./memory.c:483 with_adjusted_ size (addr=addr@entry=8, value=value@ entry=0x7f82f0e 304f8, size=size@entry=4, access_ size_min= <optimized out>, size_max= <optimized out>, access_ fn=access_ fn@entry= 0x55d2f2de9bd0 <memory_ region_ write_accessor> , mr=0x55d2f4780970, attrs=...) at ./memory.c:544 region_ dispatch_ write (mr=mr@ entry=0x55d2f47 80970, addr=8, data=<optimized out>, op=<optimized out>, attrs=attrs@ entry=. ..) at ./memory.c:1475 write_continue (fv=fv@ entry=0x7f82dc1 4bbc0, addr=addr@ entry=44552, attrs=..., buf=buf@ entry=0x7f82f17 e9000 "", len=len@entry=4, addr1=<optimized out>, qemu/host- utils.h: 164 entry=0x55d2f39 56960 <address_space_io>, addr=addr@ entry=44552, attrs=..., buf=<optimized out>, len=len@entry=4) at ./exec.c:3259 entry=0x55d2f39 56960 <address_space_io>, addr=addr@ entry=44552, attrs=..., attrs@entry=..., buf=<optimized out>, len=len@entry=4, write=is_ write@entry= true) at ./exec.c:3269 <optimized out>, data=<optimized out>, attrs=..., port=44552) at ./accel/ kvm/kvm- all.c:2104 entry=0x55d2f3d c9090) at ./accel/ kvm/kvm- all.c:2350 cpu_thread_ fn (arg=0x55d2f3dc 9090) at ./cpus.c:1318 cpu_thread_ fn (arg=arg@ entry=0x55d2f3d c9090) at ./cpus.c:1290 qemu-thread- posix.c: 519 create. c:477 unix/sysv/ linux/x86_ 64/clone. S:95
Thread 4 "CPU 0/KVM" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f82f0e31700 (LWP 3998)]
0x000055d2f322d45d in notifier_remove (notifier=
31 QLIST_REMOVE(
(gdb) bt
#0 0x000055d2f322d45d in notifier_remove (notifier=
#1 0x000055d2f2df8df9 in kvm_irqchip_
#2 0x000055d2f2e56989 in vfio_exitfn (pdev=<optimized out>) at ./hw/vfio/
#3 0x000055d2f3025c1b in pci_qdev_unrealize (dev=<optimized out>, errp=<optimized out>) at ./hw/pci/pci.c:1131
#4 0x000055d2f2f8c6e2 in device_set_realized (obj=<optimized out>, value=<optimized out>, errp=0x0) at ./hw/core/
#5 0x000055d2f312449b in property_set_bool (obj=0x55d2f40c
#6 0x000055d2f3128c84 in object_
at ./qom/qom-
#7 0x000055d2f31264ba in object_
#8 0x000055d2f2f56bca in acpi_pcihp_
#9 0x000055d2f2f56253 in acpi_pcihp_
#10 0x000055d2f2f56383 in pci_write (size=<optimized out>, data=256, addr=8, opaque=<optimized out>) at ./hw/acpi/
#11 pci_write (opaque=<optimized out>, addr=<optimized out>, data=256, size=<optimized out>) at ./hw/acpi/
#12 0x000055d2f2de9cfb in memory_
mask=
#13 0x000055d2f2de79ee in access_
access_
#14 0x000055d2f2debfc3 in memory_
#15 0x000055d2f2d96a30 in flatview_
l=<optimized out>, mr=0x55d2f4780970) at ./include/
#16 0x000055d2f2d96c46 in flatview_write (fv=0x7f82dc14bbc0, addr=44552, attrs=..., buf=0x7f82f17e9000 "", len=4) at ./exec.c:3169
#17 0x000055d2f2d9b01f in address_space_write (as=as@
#18 0x000055d2f2d9b09e in address_space_rw (as=as@
is_
#19 0x000055d2f2dfc94f in kvm_handle_io (count=1, size=4, direction=
#20 kvm_cpu_exec (cpu=cpu@
#21 0x000055d2f2dde53e in qemu_kvm_
#22 qemu_kvm_
#23 0x000055d2f321fe13 in qemu_thread_start (args=<optimized out>) at ./util/
#24 0x00007f82f4290609 in start_thread (arg=<optimized out>) at pthread_
#25 0x00007f82f41b7153 in clone () at ../sysdeps/