All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vhost: Fix aborting if KVM does not support eventfds
@ 2015-11-13  9:28 Pavel Fedin
  2015-11-14 19:18 ` Michael S. Tsirkin
  2015-11-16 14:34 ` Christian Borntraeger
  0 siblings, 2 replies; 6+ messages in thread
From: Pavel Fedin @ 2015-11-13  9:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: 'Michael S. Tsirkin'

If you happen to have a stock kernel of old version, like 3.x, and you
attempt to enable vhost by setting vhost=on, qemu aborts with error:

kvm_mem_ioeventfd_add: error adding ioeventfd: Function not implemented

This patch adds capability check, so that vhost gets disabled instead. A
warning is displayed, explaining the reason.

This problem can be observed with libvirt, which checks for /dev/vhost-net
availability and just inserts "vhost=on" automatically in this case.

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
---
 hw/virtio/vhost.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 1794f0d..3121e19 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -24,6 +24,7 @@
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-access.h"
 #include "migration/migration.h"
+#include "sysemu/kvm.h"
 
 static struct vhost_log *vhost_log;
 static struct vhost_log *vhost_log_shm;
@@ -1083,6 +1084,11 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev)
         r = -ENOSYS;
         goto fail;
     }
+    if (!kvm_eventfds_enabled()) {
+        error_report("KVM does not support MMIO eventfds");
+        r = -ENOSYS;
+        goto fail;
+    }
 
     for (i = 0; i < hdev->nvqs; ++i) {
         r = k->set_host_notifier(qbus->parent, hdev->vq_index + i, true);
-- 
1.9.5.msysgit.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-11-16 14:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-13  9:28 [Qemu-devel] [PATCH] vhost: Fix aborting if KVM does not support eventfds Pavel Fedin
2015-11-14 19:18 ` Michael S. Tsirkin
2015-11-16  7:02   ` Pavel Fedin
2015-11-16  7:16     ` Michael S. Tsirkin
2015-11-16  7:31       ` Pavel Fedin
2015-11-16 14:34 ` Christian Borntraeger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.