From: Laszlo Ersek <lersek@redhat.com>
To: Albert Esteve <aesteve@redhat.com>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
"Eugenio Perez Martin" <eperezma@redhat.com>,
"German Maglione" <gmaglione@redhat.com>,
"Liu Jiang" <gerry@linux.alibaba.com>,
"Sergio Lopez Pascual" <slp@redhat.com>,
"Stefano Garzarella" <sgarzare@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH v2 1/7] vhost-user: strip superfluous whitespace
Date: Wed, 6 Sep 2023 11:09:35 +0200 [thread overview]
Message-ID: <64c3ff9a-12d4-c33e-c2a9-5602e4cd060a@redhat.com> (raw)
In-Reply-To: <CADSE00+9s4etckQFqGbxc3xB281tffTRPs5CAO5b7J9PeQsyrA@mail.gmail.com>
On 9/6/23 09:12, Albert Esteve wrote:
>
>
> On Thu, Aug 31, 2023 at 9:14 AM Laszlo Ersek <lersek@redhat.com
> <mailto:lersek@redhat.com>> wrote:
>
> On 8/30/23 15:40, Laszlo Ersek wrote:
> > Cc: "Michael S. Tsirkin" <mst@redhat.com <mailto:mst@redhat.com>>
> (supporter:vhost)
> > Cc: Eugenio Perez Martin <eperezma@redhat.com
> <mailto:eperezma@redhat.com>>
> > Cc: German Maglione <gmaglione@redhat.com
> <mailto:gmaglione@redhat.com>>
> > Cc: Liu Jiang <gerry@linux.alibaba.com
> <mailto:gerry@linux.alibaba.com>>
> > Cc: Sergio Lopez Pascual <slp@redhat.com <mailto:slp@redhat.com>>
> > Cc: Stefano Garzarella <sgarzare@redhat.com
> <mailto:sgarzare@redhat.com>>
> > Signed-off-by: Laszlo Ersek <lersek@redhat.com
> <mailto:lersek@redhat.com>>
> > Reviewed-by: Stefano Garzarella <sgarzare@redhat.com
> <mailto:sgarzare@redhat.com>>
> > ---
> >
> > Notes:
> > v2:
> >
> > - pick up Stefano's R-b
> >
> > hw/virtio/vhost-user.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
>
> This has been
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org
> <mailto:philmd@linaro.org>>
>
> under the (identical) v1 posting:
>
> http://mid.mail-archive.com/cd0604a1-6826-ac6c-6c47-dcb6def64b28@linaro.org <http://mid.mail-archive.com/cd0604a1-6826-ac6c-6c47-dcb6def64b28@linaro.org>
>
> Thanks, Phil! (and sorry that I posted v2 too quickly -- I forgot that
> sometimes reviewers split a review over multiple days.)
>
> Laszlo
>
> >
> > diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> > index 8dcf049d422b..b4b677c1ce66 100644
> > --- a/hw/virtio/vhost-user.c
> > +++ b/hw/virtio/vhost-user.c
> > @@ -398,7 +398,7 @@ static int vhost_user_write(struct vhost_dev
> *dev, VhostUserMsg *msg,
> > * operations such as configuring device memory mappings or
> issuing device
> > * resets, which affect the whole device instead of
> individual VQs,
> > * vhost-user messages should only be sent once.
> > - *
> > + *
> > * Devices with multiple vhost_devs are given an associated
> dev->vq_index
> > * so per_device requests are only sent if vq_index is 0.
> > */
> >
>
>
> Thanks for the series!
> I had a timeout problem with a virtio device I am developing, and I was
> not sure yet what was going on.
> Your description of the problem seemed to fit mine, in my case the
> driver sent a command through the data plane
> right after the feature negotiation that reached the backend too soon.
> Adding delays alleviated the issue, so it
> already hinted me to a race condition.
>
> I tested using this patch series and according to my experiments, it
> really lowers the chances to get the deadlock.
> Sadly, I do still get the issue sometimes, though (not frequently)...
> However, I think probably the solution comes not
> from the Qemu side, but from the rust-vmm vhost-user-backend crate. I am
> looking for that solution on my side.
>
> But that does not invalidate this patch, which I think is a necessary
> improvement, and in my tests it really
> helps a lot with the described issue. Therefore:
>
> Tested-by: Albert Esteve <aesteve@redhat.com <mailto:aesteve@redhat.com>>
Thank you for the testing and the feedback!
My problem with relegating the fix to rust-vmm/vhost -- i.e. with
calling the hang a bug inside rust-vmm/vhost -- is that rust-vmm/vhost
is *unfixable* as long as the vhost-user specification says what it
says. As soon as the guest is permitted to issue a data plane operation,
without forcing it to await completion of an earlier control plane
operation, the cat is out of the bag. Those operations travel through
independent channels, and the vhost-user spec currently requires the
backend to listen to both channels at the same time. There's no way to
restore the original order after both operations have been submitted
effectively in parallel from the guest side.
The guest cannot limit itself, the virtio operations it needs to do (on
the control plane) are described in the virtio spec, in "driver
requirements" sections, and most of those steps are inherently
treated/specified as synchronous. The guest already thinks those steps
are synchronous.
So it really is a spec problem. I see the big problem in the switch from
vhost-net to the generic vhost-user protocol. My understanding from the
virtio-networking series in the RH Developer Blog is that vhost-net was
entirely ioctl() based, and consequently totally synchronous. That was
lost when the protocol was rebased to unix domain sockets, without
upholding the explicit request-response pattern in all operations.
I'm worried we can't get this unstuck until Michael answers Stefan's
question, concerning the spec.
Laszlo
next prev parent reply other threads:[~2023-09-06 9:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-30 13:40 [PATCH v2 0/7] vhost-user: call VHOST_USER_SET_VRING_ENABLE synchronously Laszlo Ersek
2023-08-30 13:40 ` [PATCH v2 1/7] vhost-user: strip superfluous whitespace Laszlo Ersek
2023-08-31 7:13 ` Laszlo Ersek
2023-09-06 7:12 ` Albert Esteve
2023-09-06 9:09 ` Laszlo Ersek [this message]
2023-10-02 19:48 ` Laszlo Ersek
2023-08-30 13:40 ` [PATCH v2 2/7] vhost-user: tighten "reply_supported" scope in "set_vring_addr" Laszlo Ersek
2023-08-31 7:14 ` Laszlo Ersek
2023-08-30 13:40 ` [PATCH v2 3/7] vhost-user: factor out "vhost_user_write_sync" Laszlo Ersek
2023-08-30 13:40 ` [PATCH v2 4/7] vhost-user: flatten "enforce_reply" into "vhost_user_write_sync" Laszlo Ersek
2023-08-30 13:40 ` [PATCH v2 5/7] vhost-user: hoist "write_sync", "get_features", "get_u64" Laszlo Ersek
2023-08-31 7:20 ` Laszlo Ersek
2023-09-06 9:59 ` Philippe Mathieu-Daudé
2023-08-30 13:40 ` [PATCH v2 6/7] vhost-user: allow "vhost_set_vring" to wait for a reply Laszlo Ersek
2023-08-30 13:40 ` [PATCH v2 7/7] vhost-user: call VHOST_USER_SET_VRING_ENABLE synchronously Laszlo Ersek
2023-09-07 15:59 ` Eugenio Perez Martin
2023-09-07 20:27 ` Laszlo Ersek
2023-09-07 16:01 ` [PATCH v2 0/7] " Eugenio Perez Martin
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=64c3ff9a-12d4-c33e-c2a9-5602e4cd060a@redhat.com \
--to=lersek@redhat.com \
--cc=aesteve@redhat.com \
--cc=eperezma@redhat.com \
--cc=gerry@linux.alibaba.com \
--cc=gmaglione@redhat.com \
--cc=mst@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=slp@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).