backends/vhost-user: relax the ioeventfd check
RFC PATCH 1/1 backends/vhost-user: relax the ioeventfd check
While you certainly need ioeventfds to work for KVM guests it shouldn't be limited to that. We can run vhost-user backends for TCG guests and either use ioeventfds or in band signalling.
Maybe we should apply the same fix as b0aa77d36d (vhost-user: fix ioeventfd_enabled)?
With this change I can run:
$QEMU $OPTS \
-display gtk,gl=on \
-device vhost-user-gpu-pci,chardev=vhgpu \
-chardev socket,id=vhgpu,path=vhgpu.sockwith:
./contrib/vhost-user-gpu/vhost-user-gpu \
-s vhgpu.sock \
-vand at least see things start-up (although the display gets rotated by 180 degrees).
--- backends/vhost-user.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
backends/vhost-user.c +2 -8
@@ -21,12 +21,6 @@#include "io/channel-command.h" #include "hw/virtio/virtio-bus.h" -static bool -ioeventfd_enabled (void ) -{ -return kvm_enabled () &&kvm_eventfds_enabled (); -} -int vhost_user_backend_dev_init (VhostUserBackend *b,VirtIODevice *vdev,unsigned nvqs,Error **errp)
@@ -35,8 +29,8 @@ vhost_user_backend_dev_init(VhostUserBackend *b, VirtIODevice *vdev,assert (!b->vdev && vdev); -if (!ioeventfd_enabled ()) { -error_setg (errp,"vhost initialization failed: requires kvm" ); +if (kvm_enabled () && !kvm_eventfds_enabled ()) { +error_setg (errp,"vhost initialization failed: kvm required ioeventfds" );return -1 ; }
Signature · 1 line
2.34.1
Quoted 46 lines · Alex Bennée
While you certainly need ioeventfds to work for KVM guests it shouldn't be limited to that. We can run vhost-user backends for TCG guests and either use ioeventfds or in band signalling.
Maybe we should apply the same fix as
b0aa77d36d(vhost-user: fixioeventfd_enabled)?With this change I can run:
$QEMU $OPTS \ -display gtk,gl=on \ -device vhost-user-gpu-pci,chardev=vhgpu \ -chardev socket,id=vhgpu,path=vhgpu.sockwith:
./contrib/vhost-user-gpu/vhost-user-gpu \ -s vhgpu.sock \ -vand at least see things start-up (although the display gets rotated by 180 degrees).
Signed-off-by Alex Bennée <[email protected]>--- backends/vhost-user.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)backends/vhost-user.c +0
-6@@ -21,12 +21,6 @@#include "io/channel-command.h" #include "hw/virtio/virtio-bus.h" -static bool -ioeventfd_enabled (void ) -{ -return kvm_enabled () &&kvm_eventfds_enabled (); -} -int vhost_user_backend_dev_init (VhostUserBackend *b,VirtIODevice *vdev,unsigned nvqs,Error **errp)
backends/vhost-user.c vhost_user_backend_dev_init(VhostUserBackend *b, VirtIODevice *vdev, · line 35
Quoted 9 lines
backends/vhost-user.c +2
-2@@ -35,8 +29,8 @@ vhost_user_backend_dev_init(VhostUserBackend *b, VirtIODevice *vdev,assert (!b->vdev && vdev); -if (!ioeventfd_enabled ()) { -error_setg (errp,"vhost initialization failed: requires kvm" ); +if (kvm_enabled () && !kvm_eventfds_enabled ()) { +error_setg (errp,"vhost initialization failed: kvm required ioeventfds" );return -1 ; }
Gentle ping?
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Quoted 52 lines · Alex Bennée
Quoted 49 lines · Alex Bennée
While you certainly need ioeventfds to work for KVM guests it shouldn't be limited to that. We can run vhost-user backends for TCG guests and either use ioeventfds or in band signalling.
Maybe we should apply the same fix as
b0aa77d36d(vhost-user: fixioeventfd_enabled)?With this change I can run:
$QEMU $OPTS \ -display gtk,gl=on \ -device vhost-user-gpu-pci,chardev=vhgpu \ -chardev socket,id=vhgpu,path=vhgpu.sockwith:
./contrib/vhost-user-gpu/vhost-user-gpu \ -s vhgpu.sock \ -vand at least see things start-up (although the display gets rotated by 180 degrees).
Signed-off-by Alex Bennée <[email protected]>--- backends/vhost-user.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)backends/vhost-user.c +0
-6@@ -21,12 +21,6 @@#include "io/channel-command.h" #include "hw/virtio/virtio-bus.h" -static bool -ioeventfd_enabled (void ) -{ -return kvm_enabled () &&kvm_eventfds_enabled (); -} -int vhost_user_backend_dev_init (VhostUserBackend *b,VirtIODevice *vdev,unsigned nvqs,Error **errp)@@ -35,8 +29,8 @@ vhost_user_backend_dev_init(VhostUserBackend *b, VirtIODevice *vdev,assert (!b->vdev && vdev);
Quoted 9 lines
backends/vhost-user.c vhost_user_backend_dev_init(VhostUserBackend *b, VirtIODevice *vdev, · line 35
Quoted 6 lines
backends/vhost-user.c +2
-2-if (!ioeventfd_enabled ()) { -error_setg (errp,"vhost initialization failed: requires kvm" ); +if (kvm_enabled () && !kvm_eventfds_enabled ()) { +error_setg (errp,"vhost initialization failed: kvm required ioeventfds" );return -1 ; }Gentle ping?
Yea why not. Pls post a non RFC patch.
Signature · 1 line
MST
Quoted 4 lines · Alex Bennée
While you certainly need ioeventfds to work for KVM guests it shouldn't be limited to that. We can run vhost-user backends for TCG guests and either use ioeventfds or in band signalling.
I suggest tweaking this sentence so it's clear that you mean QEMU's simulated eventfds rather than kvm.ko's real ioeventfds:
s/use eventfds or in band signalling/simulate ioeventfds or use in band signalling/
Quoted 43 lines
Maybe we should apply the same fix as
b0aa77d36d(vhost-user: fixioeventfd_enabled)?With this change I can run:
$QEMU $OPTS \ -display gtk,gl=on \ -device vhost-user-gpu-pci,chardev=vhgpu \ -chardev socket,id=vhgpu,path=vhgpu.sockwith:
./contrib/vhost-user-gpu/vhost-user-gpu \ -s vhgpu.sock \ -vand at least see things start-up (although the display gets rotated by 180 degrees).
Signed-off-by Alex Bennée <[email protected]>--- backends/vhost-user.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)backends/vhost-user.c +0
-6@@ -21,12 +21,6 @@#include "io/channel-command.h" #include "hw/virtio/virtio-bus.h" -static bool -ioeventfd_enabled (void ) -{ -return kvm_enabled () &&kvm_eventfds_enabled (); -} -int vhost_user_backend_dev_init (VhostUserBackend *b,VirtIODevice *vdev,unsigned nvqs,Error **errp)
backends/vhost-user.c vhost_user_backend_dev_init(VhostUserBackend *b, VirtIODevice *vdev, · line 35
Quoted 9 lines
backends/vhost-user.c +2
-2@@ -35,8 +29,8 @@ vhost_user_backend_dev_init(VhostUserBackend *b, VirtIODevice *vdev,assert (!b->vdev && vdev); -if (!ioeventfd_enabled ()) { -error_setg (errp,"vhost initialization failed: requires kvm" ); +if (kvm_enabled () && !kvm_eventfds_enabled ()) { +error_setg (errp,"vhost initialization failed: kvm required ioeventfds" );return -1 ; }
The check can be dropped completely. If kvm.ko doesn't support ioeventfds QEMU can simulate them just like it does with TCG. In practice I don't think this happens with a reasonably modern kernel version.
Stefan