[Qemu-devel] [PATCH] vhost-user+postcopy: Use qemu_set_nonblock

Dr. David Alan Gilbert (git) posted 1 patch 7 years, 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180502105552.22925-1-dgilbert@redhat.com
Test checkpatch passed
Test docker-build@min-glib passed
Test docker-mingw@fedora passed
Test s390x passed
hw/virtio/vhost-user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH] vhost-user+postcopy: Use qemu_set_nonblock
Posted by Dr. David Alan Gilbert (git) 7 years, 5 months ago
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Use qemu_set_nonblock rather than a simple fcntl; cleaner
and I have no reason to change other flags.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 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 38da8692bb..c2bbb622d6 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -1076,7 +1076,7 @@ static int vhost_user_postcopy_advise(struct vhost_dev *dev, Error **errp)
         error_setg(errp, "%s: Failed to get ufd", __func__);
         return -1;
     }
-    fcntl(ufd, F_SETFL, O_NONBLOCK);
+    qemu_set_nonblock(ufd);
 
     /* register ufd with userfault thread */
     u->postcopy_fd.fd = ufd;
-- 
2.17.0


Re: [Qemu-devel] [PATCH] vhost-user+postcopy: Use qemu_set_nonblock
Posted by Eric Blake 7 years, 5 months ago
On 05/02/2018 05:55 AM, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> Use qemu_set_nonblock rather than a simple fcntl; cleaner
> and I have no reason to change other flags.
> 
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>   hw/virtio/vhost-user.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

(wonder if checkpatch.pl can be taught to easily recognize this one)

> 
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index 38da8692bb..c2bbb622d6 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -1076,7 +1076,7 @@ static int vhost_user_postcopy_advise(struct vhost_dev *dev, Error **errp)
>           error_setg(errp, "%s: Failed to get ufd", __func__);
>           return -1;
>       }
> -    fcntl(ufd, F_SETFL, O_NONBLOCK);
> +    qemu_set_nonblock(ufd);
>   
>       /* register ufd with userfault thread */
>       u->postcopy_fd.fd = ufd;
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Re: [Qemu-devel] [PATCH] vhost-user+postcopy: Use qemu_set_nonblock
Posted by Stefan Hajnoczi 7 years, 5 months ago
On Wed, May 02, 2018 at 11:55:52AM +0100, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> Use qemu_set_nonblock rather than a simple fcntl; cleaner
> and I have no reason to change other flags.
> 
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  hw/virtio/vhost-user.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>