When setting up host notifiers, virtio_bus_set_host_notifier() simply switches the handler. This will only work, however, if the ioeventfd has already been setup; this is true for dataplane, but not for vhost.
Fix this by starting the ioeventfd if that has not happened before. While we're at it, also fixup the unsetting path of set_host_notifier_internal(). Fixes: 6798e245a3 ("virtio-bus: common ioeventfd infrastructure") Reported-by: Jason Wang <jasow...@redhat.com> Reported-by: Marc-André Lureau <marcandre.lur...@gmail.com> Signed-off-by: Cornelia Huck <cornelia.h...@de.ibm.com> --- This fixes the vhost regression for me, while dataplane continues to work. Peter, does this help with your iSCSI regression? --- hw/virtio/virtio-bus.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index 1313760..0136242 100644 --- a/hw/virtio/virtio-bus.c +++ b/hw/virtio/virtio-bus.c @@ -176,8 +176,8 @@ static int set_host_notifier_internal(DeviceState *proxy, VirtioBusState *bus, return r; } } else { - virtio_queue_set_host_notifier_fd_handler(vq, false, false); k->ioeventfd_assign(proxy, notifier, n, assign); + virtio_queue_set_host_notifier_fd_handler(vq, false, false); event_notifier_cleanup(notifier); } return r; @@ -258,6 +258,9 @@ int virtio_bus_set_host_notifier(VirtioBusState *bus, int n, bool assign) return -ENOSYS; } if (assign) { + if (!k->ioeventfd_started(proxy)) { + virtio_bus_start_ioeventfd(bus); + } /* * Stop using the generic ioeventfd, we are doing eventfd handling * ourselves below -- 2.6.6