]> git.ipfire.org Git - thirdparty/qemu.git/commit
virtio-pci: add device_unplugged callback
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 20 Sep 2013 12:10:26 +0000 (14:10 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Fri, 21 Feb 2014 03:36:15 +0000 (21:36 -0600)
commit810766d9dd78ebe61891deff6b73efa85934c260
treeff0cb960f94a9328aebf57cde8fd5e02a000b765
parent3220207c276500cc335476f95c6e35c80709bc34
virtio-pci: add device_unplugged callback

This fixes a crash in hot-unplug of virtio-pci devices behind a PCIe
switch.  The crash happens because the ioeventfd is still set whent the
child is destroyed (destruction happens in postorder).  Then the proxy
tries to unset to ioeventfd, but the virtqueue structure that holds the
EventNotifier has been trashed in the meanwhile.  kvm_set_ioeventfd_pio
does not expect failure and aborts.

The fix is simply to move parts of uninitialization to a new
device_unplugged callback, which is called before the child is destroyed.

Cc: qemu-stable@nongnu.org
Acked-by: Andreas Faerber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 06a1307379fcd6c551185ad87679cd7ed896b9ea)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/virtio/virtio-pci.c