From: Hanna Czenczek <hreitz@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Hanna Czenczek" <hreitz@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
"German Maglione" <gmaglione@redhat.com>
Subject: [PATCH 1/6] vhost-user.rst: Add suspend/resume
Date: Tue, 11 Jul 2023 17:52:23 +0200 [thread overview]
Message-ID: <20230711155230.64277-2-hreitz@redhat.com> (raw)
In-Reply-To: <20230711155230.64277-1-hreitz@redhat.com>
When stopping the VM, qemu wants all devices to fully cease any
operation, too. Currently, we can only have vhost-user back-ends stop
processing vrings, but not background operations. Add the SUSPEND and
RESUME commands from vDPA, which allow the front-end (qemu) to tell
back-ends to cease all operations, including those running in the
background.
qemu's current work-around for this is to reset the back-end instead of
suspending it, which will not work for back-ends that have internal
state that must be preserved across e.g. stop/cont.
Note that the given specification requires the back-end to delay
processing kicks (i.e. starting vrings) until the device is resumed,
instead of requiring the front-end not to send kicks while suspended.
qemu starts devices (and would just resume them) only when the VM is in
a running state, so it would be difficult to have qemu delay kicks until
the device is resumed, which is why this patch specifies handling of
kicks as it does.
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
---
docs/interop/vhost-user.rst | 35 +++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst
index 5a070adbc1..ac6be34c4c 100644
--- a/docs/interop/vhost-user.rst
+++ b/docs/interop/vhost-user.rst
@@ -381,6 +381,10 @@ readable) on the descriptor specified by ``VHOST_USER_SET_VRING_KICK``
or receiving the in-band message ``VHOST_USER_VRING_KICK`` if negotiated,
and stop ring upon receiving ``VHOST_USER_GET_VRING_BASE``.
+While the back-end is suspended (via ``VHOST_USER_SUSPEND``), it must
+never process rings, and thus also delay handling kicks until the
+back-end is resumed again.
+
Rings can be enabled or disabled by ``VHOST_USER_SET_VRING_ENABLE``.
If ``VHOST_USER_F_PROTOCOL_FEATURES`` has not been negotiated, the
@@ -479,8 +483,9 @@ supplied by ``VhostUserLog``.
ancillary data, it may be used to inform the front-end that the log has
been modified.
-Once the source has finished migration, rings will be stopped by the
-source. No further update must be done before rings are restarted.
+Once the source has finished migration, the device will be suspended and
+its rings will be stopped by the source. No further update must be done
+before the device and its rings are resumed.
In postcopy migration the back-end is started before all the memory has
been received from the source host, and care must be taken to avoid
@@ -885,6 +890,7 @@ Protocol features
#define VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS 15
#define VHOST_USER_PROTOCOL_F_STATUS 16
#define VHOST_USER_PROTOCOL_F_XEN_MMAP 17
+ #define VHOST_USER_PROTOCOL_F_SUSPEND 18
Front-end message types
-----------------------
@@ -1440,6 +1446,31 @@ Front-end message types
query the back-end for its device status as defined in the Virtio
specification.
+``VHOST_USER_SUSPEND``
+ :id: 41
+ :equivalent ioctl: VHOST_VDPA_SUSPEND
+ :request payload: N/A
+ :reply payload: N/A
+
+ When the ``VHOST_USER_PROTOCOL_F_SUSPEND`` protocol feature has been
+ successfully negotiated, this message is submitted by the front-end to
+ have the back-end cease all operations except for handling vhost-user
+ requests. The back-end must stop processing all virt queues, and it
+ must not perform any background operations. It may not resume until a
+ subsequent ``VHOST_USER_RESUME`` call.
+
+``VHOST_USER_RESUME``
+ :id: 42
+ :equivalent ioctl: VHOST_VDPA_RESUME
+ :request payload: N/A
+ :reply payload: N/A
+
+ When the ``VHOST_USER_PROTOCOL_F_SUSPEND`` protocol feature has been
+ successfully negotiated, this message is submitted by the front-end to
+ allow the back-end to resume operations after having been suspended
+ before. The back-end must again begin processing rings that are not
+ stopped, and it may resume background operations.
+
Back-end message types
----------------------
--
2.41.0
next prev parent reply other threads:[~2023-07-11 15:53 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 ` Hanna Czenczek [this message]
2023-07-18 14:25 ` [PATCH 1/6] vhost-user.rst: " 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
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=20230711155230.64277-2-hreitz@redhat.com \
--to=hreitz@redhat.com \
--cc=eperezma@redhat.com \
--cc=gmaglione@redhat.com \
--cc=mst@redhat.com \
--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 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).