On 20 March 2018 at 03:17, Michael S. Tsirkin <[email protected]> wrote:
> From: "Dr. David Alan Gilbert" <[email protected]>
>
> Register the UFD that comes in as the response to the 'advise' method
> with the postcopy code.
>
> Signed-off-by: Dr. David Alan Gilbert <[email protected]>
> Reviewed-by: Marc-André Lureau <[email protected]>
> Reviewed-by: Michael S. Tsirkin <[email protected]>
> Signed-off-by: Michael S. Tsirkin <[email protected]>
> ---
> 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