[Qemu-devel] [PATCH v2 2/3] vhost-user: fix ioeventfd_enabled

Li Qiang posted 3 patches 7 years, 1 month ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Thomas Huth <thuth@redhat.com>
[Qemu-devel] [PATCH v2 2/3] vhost-user: fix ioeventfd_enabled
Posted by Li Qiang 7 years, 1 month ago
Currently, the vhost-user-test assumes the eventfd is available.
However it's not true because the accel is qtest. So the
'vhost_set_vring_file' will not add fds to the msg and the server
side of vhost-user-test will be broken. The bug is in 'ioeventfd_enabled'.
We should make this function return true if not using kvm accel.

Signed-off-by: Li Qiang <liq3ea@163.com>
---
v2: change the fix in 'ioeventfd_enabled' per Paolo's review

 hw/virtio/vhost-user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index e09bed0e4a..564a31d12c 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -207,7 +207,7 @@ struct vhost_user {
 
 static bool ioeventfd_enabled(void)
 {
-    return kvm_enabled() && kvm_eventfds_enabled();
+    return !kvm_enabled() || kvm_eventfds_enabled();
 }
 
 static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg)
-- 
2.17.1



Re: [Qemu-devel] [PATCH v2 2/3] vhost-user: fix ioeventfd_enabled
Posted by Michael S. Tsirkin 7 years ago
On Sat, Dec 15, 2018 at 04:03:52AM -0800, Li Qiang wrote:
> Currently, the vhost-user-test assumes the eventfd is available.
> However it's not true because the accel is qtest. So the
> 'vhost_set_vring_file' will not add fds to the msg and the server
> side of vhost-user-test will be broken. The bug is in 'ioeventfd_enabled'.
> We should make this function return true if not using kvm accel.
> 
> Signed-off-by: Li Qiang <liq3ea@163.com>

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> ---
> v2: change the fix in 'ioeventfd_enabled' per Paolo's review
> 
>  hw/virtio/vhost-user.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index e09bed0e4a..564a31d12c 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -207,7 +207,7 @@ struct vhost_user {
>  
>  static bool ioeventfd_enabled(void)
>  {
> -    return kvm_enabled() && kvm_eventfds_enabled();
> +    return !kvm_enabled() || kvm_eventfds_enabled();
>  }
>  
>  static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg)
> -- 
> 2.17.1
> 
>