From: Stefan Hajnoczi <stefanha@redhat.com>
To: Alexandr Moshkov <dtalexundeer@yandex-team.ru>
Cc: qemu-devel@nongnu.org, "Gonglei (Arei)" <arei.gonglei@huawei.com>,
"Zhenwei Pi" <pizhenwei@bytedance.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Stefano Garzarella" <sgarzare@redhat.com>,
"Raphael Norwitz" <raphael@enfabrica.net>,
"Kevin Wolf" <kwolf@redhat.com>,
"Hanna Reitz" <hreitz@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Fam Zheng" <fam@euphon.net>,
"Alex Bennée" <alex.bennee@linaro.org>,
mzamazal@redhat.com, "Peter Xu" <peterx@redhat.com>,
"Fabiano Rosas" <farosas@suse.de>,
qemu-block@nongnu.org, virtio-fs@lists.linux.dev,
"yc-core@yandex-team.ru" <yc-core@yandex-team.ru>,
"Eric Blake" <eblake@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>
Subject: Re: [PATCH v6 2/5] vhost-user: introduce protocol feature for skip drain on GET_VRING_BASE
Date: Tue, 13 Jan 2026 13:00:17 -0500 [thread overview]
Message-ID: <20260113180017.GA528940@fedora> (raw)
In-Reply-To: <20260113095813.134810-3-dtalexundeer@yandex-team.ru>
[-- Attachment #1: Type: text/plain, Size: 7189 bytes --]
On Tue, Jan 13, 2026 at 02:58:13PM +0500, Alexandr Moshkov wrote:
> Add vhost-user protocol feature
> VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT
>
> Now on GET_VRING_BASE this feature can control whether to wait for
> in-flight requests to complete or not.
> Also we have to validate that this feature will be enabled only when
> qemu and back-end supports in-flight buffer and in-flight migration
>
> It will be helpfull in future for in-flight requests migration in
> vhost-user devices.
>
> Update docs, add ref to label for inflight-io-tracking
>
> Signed-off-by: Alexandr Moshkov <dtalexundeer@yandex-team.ru>
> ---
> docs/interop/vhost-user.rst | 59 +++++++++++++++++++++-------------
> hw/virtio/vhost-user.c | 5 +++
> include/hw/virtio/vhost-user.h | 2 ++
> 3 files changed, 44 insertions(+), 22 deletions(-)
>
> diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst
> index 02908b48fa..dcf79de0c0 100644
> --- a/docs/interop/vhost-user.rst
> +++ b/docs/interop/vhost-user.rst
> @@ -736,6 +736,8 @@ negotiated, back-end can send file descriptors (at most 8 descriptors in
> each message) to front-end via ancillary data using this fd communication
> channel.
>
> +.. _inflight_io_tracking:
> +
> Inflight I/O tracking
> ---------------------
>
> @@ -1033,26 +1035,27 @@ Protocol features
>
> .. code:: c
>
> - #define VHOST_USER_PROTOCOL_F_MQ 0
> - #define VHOST_USER_PROTOCOL_F_LOG_SHMFD 1
> - #define VHOST_USER_PROTOCOL_F_RARP 2
> - #define VHOST_USER_PROTOCOL_F_REPLY_ACK 3
> - #define VHOST_USER_PROTOCOL_F_MTU 4
> - #define VHOST_USER_PROTOCOL_F_BACKEND_REQ 5
> - #define VHOST_USER_PROTOCOL_F_CROSS_ENDIAN 6
> - #define VHOST_USER_PROTOCOL_F_CRYPTO_SESSION 7
> - #define VHOST_USER_PROTOCOL_F_PAGEFAULT 8
> - #define VHOST_USER_PROTOCOL_F_CONFIG 9
> - #define VHOST_USER_PROTOCOL_F_BACKEND_SEND_FD 10
> - #define VHOST_USER_PROTOCOL_F_HOST_NOTIFIER 11
> - #define VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD 12
> - #define VHOST_USER_PROTOCOL_F_RESET_DEVICE 13
> - #define VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS 14
> - #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_SHARED_OBJECT 18
> - #define VHOST_USER_PROTOCOL_F_DEVICE_STATE 19
> + #define VHOST_USER_PROTOCOL_F_MQ 0
> + #define VHOST_USER_PROTOCOL_F_LOG_SHMFD 1
> + #define VHOST_USER_PROTOCOL_F_RARP 2
> + #define VHOST_USER_PROTOCOL_F_REPLY_ACK 3
> + #define VHOST_USER_PROTOCOL_F_MTU 4
> + #define VHOST_USER_PROTOCOL_F_BACKEND_REQ 5
> + #define VHOST_USER_PROTOCOL_F_CROSS_ENDIAN 6
> + #define VHOST_USER_PROTOCOL_F_CRYPTO_SESSION 7
> + #define VHOST_USER_PROTOCOL_F_PAGEFAULT 8
> + #define VHOST_USER_PROTOCOL_F_CONFIG 9
> + #define VHOST_USER_PROTOCOL_F_BACKEND_SEND_FD 10
> + #define VHOST_USER_PROTOCOL_F_HOST_NOTIFIER 11
> + #define VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD 12
> + #define VHOST_USER_PROTOCOL_F_RESET_DEVICE 13
> + #define VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS 14
> + #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_SHARED_OBJECT 18
> + #define VHOST_USER_PROTOCOL_F_DEVICE_STATE 19
> + #define VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT 20
>
> Front-end message types
> -----------------------
> @@ -1243,12 +1246,24 @@ Front-end message types
>
> When and as long as all of a device's vrings are stopped, it is
> *suspended*, see :ref:`Suspended device state
> - <suspended_device_state>`. The back-end must complete all inflight I/O
> - requests for the specified vring before stopping it.
> + <suspended_device_state>`.
>
> The request payload's *num* field is currently reserved and must be
> set to 0.
>
> + By default, the back-end must complete all inflight I/O requests for the
> + specified vring before stopping it.
> +
> + If the ``VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT`` protocol
> + feature has been negotiated, the back-end may suspend in-flight I/O
> + requests and record them as described in :ref:`Inflight I/O tracking
> + <inflight_io_tracking>` instead of completing them before stopping the vring.
> + How to suspend an in-flight request depends on the implementation of the back-end
> + but it typically can be done by aborting or cancelling the underlying I/O
> + request. The ``VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT``
> + protocol feature must only be neogotiated if
> + ``VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD`` is also negotiated.
> +
> ``VHOST_USER_SET_VRING_KICK``
> :id: 12
> :equivalent ioctl: ``VHOST_SET_VRING_KICK``
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index a820214188..793d1b36d8 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -2320,6 +2320,11 @@ static int vhost_user_backend_connect(struct vhost_dev *dev, Error **errp)
> }
> }
>
> + if (!u->user->supports_inflight_migration ||
> + !virtio_has_feature(VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) {
This looks like it will not compile since virtio_has_features() takes
two arguments. I think it should be:
!virtio_has_feature(dev->protocol_features,
VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)
> + protocol_features &= ~(1ULL <<
> + VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT);
> + }
> +
> /* final set of protocol features */
> u->protocol_features = protocol_features;
> err = vhost_user_set_protocol_features(dev, u->protocol_features);
I seem to have different version of hw/virtio/vhost-user.c. Is this
patch against qemu.git/master?
> diff --git a/include/hw/virtio/vhost-user.h b/include/hw/virtio/vhost-user.h
> index fb89268de2..f30c1792e4 100644
> --- a/include/hw/virtio/vhost-user.h
> +++ b/include/hw/virtio/vhost-user.h
> @@ -33,6 +33,7 @@ enum VhostUserProtocolFeature {
> /* Feature 17 reserved for VHOST_USER_PROTOCOL_F_XEN_MMAP. */
> VHOST_USER_PROTOCOL_F_SHARED_OBJECT = 18,
> VHOST_USER_PROTOCOL_F_DEVICE_STATE = 19,
> + VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT = 20,
> VHOST_USER_PROTOCOL_F_MAX
> };
>
> @@ -69,6 +70,7 @@ typedef struct VhostUserState {
> GPtrArray *notifiers;
> int memory_slots;
> bool supports_config;
> + bool supports_inflight_migration;
> } VhostUserState;
>
> /**
> --
> 2.34.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2026-01-13 18:00 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-13 9:58 [PATCH v6 0/5] support inflight migration Alexandr Moshkov
2026-01-13 9:58 ` [PATCH v6 1/5] vhost-user.rst: specify vhost-user back-end action on GET_VRING_BASE Alexandr Moshkov
2026-01-13 9:58 ` [PATCH v6 2/5] vhost-user: introduce protocol feature for skip drain " Alexandr Moshkov
2026-01-13 18:00 ` Stefan Hajnoczi [this message]
2026-01-13 9:58 ` [PATCH v6 3/5] vmstate: introduce VMSTATE_VBUFFER_UINT64 Alexandr Moshkov
2026-01-13 9:58 ` [PATCH v6 4/5] vhost: add vmstate for inflight region with inner buffer Alexandr Moshkov
2026-01-14 19:15 ` Peter Xu
2026-01-14 21:38 ` Stefan Hajnoczi
2026-01-14 21:57 ` Peter Xu
2026-01-13 9:58 ` [PATCH v6 5/5] vhost-user-blk: support inter-host inflight migration Alexandr Moshkov
2026-01-14 12:26 ` Peter Xu
2026-01-13 18:12 ` [PATCH v6 0/5] support " Stefan Hajnoczi
2026-01-13 18:56 ` Peter Xu
2026-01-14 6:19 ` Vladimir Sementsov-Ogievskiy
2026-01-14 12:22 ` Peter Xu
2026-01-14 14:35 ` Vladimir Sementsov-Ogievskiy
2026-01-14 15:17 ` Peter Xu
2026-01-14 17:54 ` Vladimir Sementsov-Ogievskiy
2026-01-14 19:10 ` Peter Xu
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=20260113180017.GA528940@fedora \
--to=stefanha@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=arei.gonglei@huawei.com \
--cc=armbru@redhat.com \
--cc=dtalexundeer@yandex-team.ru \
--cc=eblake@redhat.com \
--cc=fam@euphon.net \
--cc=farosas@suse.de \
--cc=hreitz@redhat.com \
--cc=jasowang@redhat.com \
--cc=kwolf@redhat.com \
--cc=mst@redhat.com \
--cc=mzamazal@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=pizhenwei@bytedance.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=raphael@enfabrica.net \
--cc=sgarzare@redhat.com \
--cc=virtio-fs@lists.linux.dev \
--cc=yc-core@yandex-team.ru \
/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