[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/3] vhost-user: add fds inf 'vhost_set_vring_fi
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 2/3] vhost-user: add fds inf 'vhost_set_vring_file' in qtest |
Date: |
Sat, 15 Dec 2018 12:08:08 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 |
On 15/12/18 02:26, 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. This patch avoid this.
>
> Signed-off-by: Li Qiang <address@hidden>
> ---
> hw/virtio/vhost-user.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index e09bed0e4a..3b666f093c 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -23,6 +23,7 @@
> #include "migration/migration.h"
> #include "migration/postcopy-ram.h"
> #include "trace.h"
> +#include "sysemu/qtest.h"
>
> #include <sys/ioctl.h>
> #include <sys/socket.h>
> @@ -742,7 +743,7 @@ static int vhost_set_vring_file(struct vhost_dev *dev,
> .hdr.size = sizeof(msg.payload.u64),
> };
>
> - if (ioeventfd_enabled() && file->fd > 0) {
The bug is in ioeventfd_enabled. It should be !kvm_enabled() ||
kvm_eventfds_enabled().
Paolo
> + if ((qtest_enabled() || ioeventfd_enabled()) && file->fd > 0) {
> fds[fd_num++] = file->fd;
> } else {
> msg.payload.u64 |= VHOST_USER_VRING_NOFD_MASK;
>