ivshmem: Always remove irqfd notifiers
commit089fd80376196adc0274a53eb9729c3ef7ee5ae7
authorLadi Prosek <lprosek@redhat.com>
Mon, 11 Dec 2017 07:21:08 +0000 (11 08:21 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 7 Feb 2018 13:09:24 +0000 (7 14:09 +0100)
tree9e358fe5431c1c9110e514d8efb0275e304d05fa
parente6a354be6ea0a52f5921f230a91518625247af82
ivshmem: Always remove irqfd notifiers

As of commit 660c97eef6f8 ("ivshmem: use kvm irqfd for msi notifications"),
QEMU crashes with:

ivshmem: msix_set_vector_notifiers failed
msix_unset_vector_notifiers: Assertion `dev->msix_vector_use_notifier && dev->msix_vector_release_notifier' failed.

if MSI-X is repeatedly enabled and disabled on the ivshmem device, for example
by loading and unloading the Windows ivshmem driver. This is because
msix_unset_vector_notifiers() doesn't call any of the release notifier callbacks
since MSI-X is already disabled at that point (msix_enabled() returning false
is how this transition is detected in the first place). Thus ivshmem_vector_mask()
doesn't run and when MSI-X is subsequently enabled again ivshmem_vector_unmask()
fails.

This is fixed by keeping track of unmasked vectors and making sure that
ivshmem_vector_mask() always runs on MSI-X disable.

Fixes: 660c97eef6f8 ("ivshmem: use kvm irqfd for msi notifications")
Signed-off-by: Ladi Prosek <lprosek@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20171211072110.9058-3-lprosek@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/misc/ivshmem.c