From: Stefan Hajnoczi <stefanha@redhat.com>
To: Hanna Czenczek <hreitz@redhat.com>
Cc: qemu-devel@nongnu.org, "Michael S . Tsirkin" <mst@redhat.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
"German Maglione" <gmaglione@redhat.com>
Subject: Re: [PATCH 6/6] vhost-user: Have reset_status fall back to reset
Date: Tue, 18 Jul 2023 11:10:44 -0400 [thread overview]
Message-ID: <20230718151044.GG44841@fedora> (raw)
In-Reply-To: <20230711155230.64277-7-hreitz@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2601 bytes --]
On Tue, Jul 11, 2023 at 05:52:28PM +0200, Hanna Czenczek wrote:
> The only user of vhost_user_reset_status() is vhost_dev_stop(), which
> only uses it as a fall-back to stop the back-end if it does not support
> SUSPEND. However, vhost-user's implementation is a no-op unless the
> back-end supports SET_STATUS.
>
> vhost-vdpa's implementation instead just calls
> vhost_vdpa_reset_device(), implying that it's OK to fully reset the
> device if SET_STATUS is not supported.
>
> To be fair, vhost_vdpa_reset_device() does nothing but to set the status
> to zero. However, that may well be because vhost-vdpa has no method
> besides this to reset a device. In contrast, vhost-user has
> RESET_DEVICE and a RESET_OWNER, which can be used instead.
>
> While it is not entirely clear from documentation or git logs, from
> discussions and the order of vhost-user protocol features, it appears to
> me as if RESET_OWNER originally had no real meaning for vhost-user, and
> was thus used to signal a device reset to the back-end. Then,
> RESET_DEVICE was introduced, to have a well-defined dedicated reset
> command. Finally, vhost-user received full STATUS support, including
> SET_STATUS, so setting the device status to 0 is now the preferred way
> of resetting a device. Still, RESET_DEVICE and RESET_OWNER should
> remain valid as fall-backs.
>
> Therefore, have vhost_user_reset_status() fall back to
> vhost_user_reset_device() if the back-end has no STATUS support.
>
> Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
> ---
> hw/virtio/vhost-user.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index 4507de5a92..53a881ec2a 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -2833,6 +2833,8 @@ static void vhost_user_reset_status(struct vhost_dev *dev)
> if (virtio_has_feature(dev->protocol_features,
> VHOST_USER_PROTOCOL_F_STATUS)) {
> vhost_user_set_status(dev, 0);
> + } else {
> + vhost_user_reset_device(dev);
> }
> }
Did you check whether DPDK treats setting the status to 0 as equivalent
to RESET_DEVICE?
My understanding is that SET_STATUS is mostly ignored by vhost-user
back-ends today. Even those that implement it may not treat SET_STATUS 0
as equivalent to RESET_DEVICE.
If you decide it's safe to make this change, please also update
vhost-user.rst to document that front-ends should use SET_STATUS 0,
RESET_DEVICE, and RESET_OWNER in order of preference.
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2023-07-18 15:17 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 15:52 [PATCH 0/6] vhost-user: Add suspend/resume Hanna Czenczek
2023-07-11 15:52 ` [PATCH 1/6] vhost-user.rst: " Hanna Czenczek
2023-07-18 14:25 ` Stefan Hajnoczi
2023-07-19 13:59 ` Hanna Czenczek
2023-07-24 17:55 ` Stefan Hajnoczi
2023-07-25 8:30 ` Hanna Czenczek
2023-07-27 21:12 ` Stefan Hajnoczi
2023-07-11 15:52 ` [PATCH 2/6] vhost-vdpa: Move vhost_vdpa_reset_status() up Hanna Czenczek
2023-07-18 14:29 ` Stefan Hajnoczi
2023-07-11 15:52 ` [PATCH 3/6] vhost: Do not reset suspended devices on stop Hanna Czenczek
2023-07-18 14:33 ` Stefan Hajnoczi
2023-07-21 15:25 ` Eugenio Perez Martin
2023-07-21 16:07 ` Hanna Czenczek
2023-07-24 15:48 ` Eugenio Perez Martin
2023-07-25 7:53 ` Hanna Czenczek
2023-07-25 10:03 ` Eugenio Perez Martin
2023-07-25 13:09 ` Hanna Czenczek
2023-07-25 18:53 ` Eugenio Perez Martin
2023-07-26 6:57 ` Hanna Czenczek
2023-07-27 12:49 ` Eugenio Perez Martin
2023-07-27 20:26 ` Stefan Hajnoczi
2023-07-11 15:52 ` [PATCH 4/6] vhost-user: Implement suspend/resume Hanna Czenczek
2023-07-18 14:37 ` Stefan Hajnoczi
2023-07-11 15:52 ` [PATCH 5/6] vhost-vdpa: Match vhost-user's status reset Hanna Czenczek
2023-07-18 14:50 ` Stefan Hajnoczi
2023-07-19 14:09 ` Hanna Czenczek
2023-07-19 15:06 ` Stefan Hajnoczi
2023-07-21 15:47 ` Eugenio Perez Martin
2023-07-11 15:52 ` [PATCH 6/6] vhost-user: Have reset_status fall back to reset Hanna Czenczek
2023-07-18 15:10 ` Stefan Hajnoczi [this message]
2023-07-19 14:11 ` Hanna Czenczek
2023-07-19 14:27 ` Hanna Czenczek
2023-07-20 16:03 ` Stefan Hajnoczi
2023-07-21 14:16 ` Hanna Czenczek
2023-07-24 18:04 ` Stefan Hajnoczi
2023-07-25 8:39 ` Hanna Czenczek
2023-07-18 15:14 ` [PATCH 0/6] vhost-user: Add suspend/resume Stefan Hajnoczi
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=20230718151044.GG44841@fedora \
--to=stefanha@redhat.com \
--cc=eperezma@redhat.com \
--cc=gmaglione@redhat.com \
--cc=hreitz@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).