From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxgLK-0003ZG-2i for qemu-devel@nongnu.org; Sat, 14 Nov 2015 14:18:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxgLF-0008Ks-TP for qemu-devel@nongnu.org; Sat, 14 Nov 2015 14:18:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45016) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxgLF-0008Kn-Oa for qemu-devel@nongnu.org; Sat, 14 Nov 2015 14:18:29 -0500 Date: Sat, 14 Nov 2015 21:18:20 +0200 From: "Michael S. Tsirkin" Message-ID: <20151114211725-mutt-send-email-mst@redhat.com> References: <002301d11df5$9d440a10$d7cc1e30$@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <002301d11df5$9d440a10$d7cc1e30$@samsung.com> Subject: Re: [Qemu-devel] [PATCH] vhost: Fix aborting if KVM does not support eventfds List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Fedin Cc: qemu-devel@nongnu.org On Fri, Nov 13, 2015 at 12:28:10PM +0300, Pavel Fedin wrote: > 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 How come you have /dev/vhost-net though? That was supposed to only be there if you have vhost-net, and that never existed on kernels without eventfd. > --- > 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 >