As we found, it will cause guest os crash when reboot guest os. because in 'virtio_pci_set_guest_notifiers' function, if it failed to set guest notifier, the error handler did not release the 'proxy->vector_irqfd' which already alloced. when reboot guest os, into 'virtio_pci_set_guest_notifiers' function again, it will jump into 'msix_unset_vector_notifiers' function, this function will check device notifier hooks, cause hooks were null, it will cause a assert error, then the guest os crash down.
We put the error message in our test below:
2022-07-29 07:49:46.591+0000: Domain id=30 is tainted: host-cpu char device redirected to /dev/pts/4 (label charserial0)
2022-07-29T07:49:48.319622Z qemu-4.1: nvqs:1,pci_dev name:virtio-blk-pci
2022-07-29T07:49:57.974985Z qemu-4.1: nvqs:1,pci_dev name:virtio-blk-pci
2022-07-29T07:50:01.834092Z qemu-4.1: nvqs:2,pci_dev name:virtio-net-pci
2022-07-29T07:50:01.834207Z qemu-4.1: Error binding guest notifier: 11
2022-07-29T07:50:01.834218Z qemu-4.1: unable to start vhost net: 11: falling back on userspace virtio
2022-07-29T07:50:01.865367Z qemu-4.1: nvqs:1,pci_dev name:virtio-blk-pci
2022-07-29T07:50:01.865506Z qemu-4.1: virtio-blk failed to set guest notifier (-11), ensure -accel kvm is set.
2022-07-29T07:50:01.865518Z qemu-4.1: virtio_bus_start_ioeventfd: failed. Fallback to userspace (slower).
2022-07-29T07:50:02.005930Z qemu-4.1: nvqs:3,pci_dev name:virtio-scsi-pci
2022-07-29T07:50:02.006079Z qemu-4.1: virtio-scsi: Failed to set guest notifiers (-11), ensure -accel kvm is set.
2022-07-29T07:50:02.006091Z qemu-4.1: virtio_bus_start_ioeventfd: failed. Fallback to userspace (slower).
2022-07-29T07:52:44.108820Z qemu-4.1: nvqs:1,pci_dev name:virtio-blk-pci
2022-07-29T07:52:52.886792Z qemu-4.1: nvqs:1,pci_dev name:virtio-blk-pci
qemu-4.1: hw/pci/msix.c:612: msix_unset_vector_notifiers: Assertion `dev->msix_vector_use_notifier && dev->msix_vector_release_notifier' failed.
2022-07-29 07:52:53.377+0000: shutting down, reason=crashed
----
日 期:2022-11-30 14:59
发件人:Michael S. Tsirkin
收件人:雷翔;