qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] virtio: Fix setting up host notifiers for vhost


From: Cornelia Huck
Subject: [Qemu-devel] [PATCH] virtio: Fix setting up host notifiers for vhost
Date: Wed, 29 Jun 2016 14:17:04 +0200

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 <address@hidden>
Reported-by: Marc-André Lureau <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
---

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]