From: "Michael S. Tsirkin" <mst@redhat.com>
To: Felipe Franciosi <felipe@nutanix.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Marc-Andre Lureau <marcandre.lureau@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Peter Maydell <peter.maydell@linaro.org>,
Eric Blake <eblake@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
"Daniel P. Berrange" <berrange@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] libvhost-user: Start VQs on SET_VRING_CALL
Date: Tue, 17 Jan 2017 20:43:06 +0200 [thread overview]
Message-ID: <20170117204140-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <A2D5F9F5-0EB2-4295-9233-FB1A28E8A2F3@nutanix.com>
On Mon, Jan 16, 2017 at 06:27:12PM +0000, Felipe Franciosi wrote:
> Hi Michael,
>
> > On 16 Jan 2017, at 10:22, Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Thu, Jan 12, 2017 at 05:14:07PM -0800, Felipe Franciosi wrote:
> >> Currently, VQs are started as soon as a SET_VRING_KICK is received. That
> >> is too early in the VQ setup process, as the backend might not yet have
> >> a callfd to notify in case it received a kick and fully processed the
> >> request/command. This patch only starts a VQ when a SET_VRING_CALL is
> >> received.
> >>
> >> Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
> >
> > Doesn't look right to me.
> > It should happen when the fd supplies becomes readable.
>
> Apologies, but I'm confused now. What should happen when which fd becomes readable? I thought we were discussing this further down in the thread. My last comments are here:
>
> http://lists.nongnu.org/archive/html/qemu-devel/2017-01/msg02755.html
>
> I pointed out what appears to be a race and am looking forward to your comments. There is definitely a problem with the current code, so it's a matter of finding out exactly what's happening and what's the correct (and spec-compliant) way to fix it.
>
> Felipe
Pls review "Starting and stopping rings" (pls review all of it not just my
snippet) which has this text:
...
Client must start ring upon receiving a kick (that is, detecting that file
descriptor is readable) on the descriptor specified by
VHOST_USER_SET_VRING_KICK, and stop ring upon receiving
VHOST_USER_GET_VRING_BASE.
> >
> >> ---
> >> contrib/libvhost-user/libvhost-user.c | 26 +++++++++++++-------------
> >> 1 file changed, 13 insertions(+), 13 deletions(-)
> >>
> >> diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
> >> index af4faad..a46ef90 100644
> >> --- a/contrib/libvhost-user/libvhost-user.c
> >> +++ b/contrib/libvhost-user/libvhost-user.c
> >> @@ -607,19 +607,6 @@ vu_set_vring_kick_exec(VuDev *dev, VhostUserMsg *vmsg)
> >> DPRINT("Got kick_fd: %d for vq: %d\n", vmsg->fds[0], index);
> >> }
> >>
> >> - dev->vq[index].started = true;
> >> - if (dev->iface->queue_set_started) {
> >> - dev->iface->queue_set_started(dev, index, true);
> >> - }
> >> -
> >> - if (dev->vq[index].kick_fd != -1 && dev->vq[index].handler) {
> >> - dev->set_watch(dev, dev->vq[index].kick_fd, VU_WATCH_IN,
> >> - vu_kick_cb, (void *)(long)index);
> >> -
> >> - DPRINT("Waiting for kicks on fd: %d for vq: %d\n",
> >> - dev->vq[index].kick_fd, index);
> >> - }
> >> -
> >> return false;
> >> }
> >>
> >> @@ -661,6 +648,19 @@ vu_set_vring_call_exec(VuDev *dev, VhostUserMsg *vmsg)
> >>
> >> DPRINT("Got call_fd: %d for vq: %d\n", vmsg->fds[0], index);
> >>
> >> + dev->vq[index].started = true;
> >> + if (dev->iface->queue_set_started) {
> >> + dev->iface->queue_set_started(dev, index, true);
> >> + }
> >> +
> >> + if (dev->vq[index].kick_fd != -1 && dev->vq[index].handler) {
> >> + dev->set_watch(dev, dev->vq[index].kick_fd, VU_WATCH_IN,
> >> + vu_kick_cb, (void *)(long)index);
> >> +
> >> + DPRINT("Waiting for kicks on fd: %d for vq: %d\n",
> >> + dev->vq[index].kick_fd, index);
> >> + }
> >> +
> >> return false;
> >> }
> >>
> >> --
> >> 1.9.4
prev parent reply other threads:[~2017-01-17 18:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-13 1:14 [Qemu-devel] [PATCH] libvhost-user: Start VQs on SET_VRING_CALL Felipe Franciosi
2017-01-13 15:03 ` Marc-André Lureau
2017-01-13 15:09 ` Felipe Franciosi
2017-01-13 17:04 ` Michael S. Tsirkin
2017-01-13 17:15 ` Felipe Franciosi
2017-01-13 18:18 ` Michael S. Tsirkin
2017-01-13 22:29 ` Felipe Franciosi
2017-01-17 18:41 ` Michael S. Tsirkin
2017-01-17 18:53 ` Felipe Franciosi
2017-01-17 19:00 ` Michael S. Tsirkin
2017-01-19 10:26 ` Paolo Bonzini
2017-01-16 18:22 ` Michael S. Tsirkin
2017-01-16 18:27 ` Felipe Franciosi
2017-01-17 18:43 ` Michael S. Tsirkin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170117204140-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=felipe@nutanix.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.