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: Dr. David Alan Gilbert
Subject: Re: [Qemu-devel] [PULL v2 31/50] vhost+postcopy: Register shared ufd with postcopy
Date: Wed, 2 May 2018 11:58:05 +0100
User-agent: Mutt/1.9.5 (2018-04-13)

* Peter Maydell (address@hidden) wrote:
> 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.

Fix posted.  To be honest, I probably hadn't realised/forgot that
this would nuke all the other flags.  I bet some of the others uses
are the same, and may be losing important flags like noexec.

Dave

> > -    /* 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
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK



reply via email to

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