qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL v2 31/50] vhost+postcopy: Register shared ufd wit


From: Peter Maydell
Subject: Re: [Qemu-devel] [PULL v2 31/50] vhost+postcopy: Register shared ufd with postcopy
Date: Fri, 27 Apr 2018 17:12:34 +0100

On 20 March 2018 at 03:17, Michael S. Tsirkin <address@hidden> wrote:
> From: "Dr. David Alan Gilbert" <address@hidden>
>
> Register the UFD that comes in as the response to the 'advise' method
> with the postcopy code.
>
> Signed-off-by: Dr. David Alan Gilbert <address@hidden>
> Reviewed-by: Marc-André Lureau <address@hidden>
> Reviewed-by: Michael S. Tsirkin <address@hidden>
> Signed-off-by: Michael S. Tsirkin <address@hidden>
> ---
>  hw/virtio/vhost-user.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)

> @@ -835,8 +847,14 @@ 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);

Hi; this would probably be more neatly done with
       qemu_set_nonblock(ufd);
unless you really wanted to clear the other fd flags.
Among other things, it avoids Coverity producing a complaint
that we didn't check the fcntl return value (though we seem
to assume it can't fail in general, hence qemu_set_nonblock()
returning NULL.) -- CID1390601, which I've marked as false-positive.

> -    /* TODO: register ufd with userfault thread */
> +    /* register ufd with userfault thread */
> +    u->postcopy_fd.fd = ufd;
> +    u->postcopy_fd.data = dev;
> +    u->postcopy_fd.handler = vhost_user_postcopy_fault_handler;
> +    u->postcopy_fd.idstr = "vhost-user"; /* Need to find unique name */
> +    postcopy_register_shared_ufd(&u->postcopy_fd);
>      return 0;
>  }

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]