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 <liq...@163.com>
> ---
>  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;
> 


Reply via email to