From nobody Wed Feb 11 01:43:29 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1768464762; cv=none; d=zohomail.com; s=zohoarc; b=fQOrgTK31DSmZanBKkJvLSGgDJMZdnLmsUIoxT8PdKRhBNOAAxWhIQdoW370Ebsoo8WINyRCjNeckCbASWE3W9IUZIdZUjH6Yf1hgZlBLffHoZAD9Ena0m+d8j3u6iQb4odhEMIJqeuv3JfZ3TaMT5JtFWXa4hKlG8TZSWBged4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768464762; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=brAvgzNKEEepbNJKXXYhDnlUsoEZJ+Q5L1IfC7hUmGA=; b=Q2qClNf+2YE4yf6YbSVKIq7wbJA0u/5ughKksM/isDeMVA58Kc1MaKFAY9MhbD2toVijug16Im42TQ09yuzLROtfRN+Gm37n6JX7r7R73mZI7j3aLIy/VfjpTsMnl9Ya6aRWdGr2m+NFWh5yoaMjFiU3eLc9jZI/145ENVR+yzs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1768464762176293.78424613655216; Thu, 15 Jan 2026 00:12:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vgISX-0002eX-Pt; Thu, 15 Jan 2026 03:12:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vgIST-0002dK-S0; Thu, 15 Jan 2026 03:11:57 -0500 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vgISS-0005yA-3U; Thu, 15 Jan 2026 03:11:57 -0500 Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:5c05:0:640:ff67:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 79BAE807A9; Thu, 15 Jan 2026 11:11:54 +0300 (MSK) Received: from dtalexundeer-nx.yandex-team.ru (unknown [2a02:6bf:8080:973::1:c]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id PBQgfR0Ar8c0-IGupz6fw; Thu, 15 Jan 2026 11:11:53 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1768464713; bh=brAvgzNKEEepbNJKXXYhDnlUsoEZJ+Q5L1IfC7hUmGA=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=driIziYdK6Sj1luY/0ZbnOQ+DRpTaRcRC4J0hDmd20pfHVT8vRlWxVIerB8YoLM2u nz2EBOplS0FUFRM1wSOUOVTjOKMI4Tuzhej0wQlvxo9HCiS9R1ditlzNaS7ikuKj4u Ep3fqu0q1M/3OVS70NEhStXV7jvo7v2ijf0cQ2O8= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Alexandr Moshkov To: qemu-devel@nongnu.org Cc: "Gonglei (Arei)" , Zhenwei Pi , "Michael S. Tsirkin" , Stefano Garzarella , Raphael Norwitz , Kevin Wolf , Hanna Reitz , Jason Wang , Paolo Bonzini , Fam Zheng , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Stefan Hajnoczi , mzamazal@redhat.com, Peter Xu , Fabiano Rosas , qemu-block@nongnu.org, virtio-fs@lists.linux.dev, "yc-core@yandex-team.ru" , Eric Blake , Markus Armbruster , Alexandr Moshkov Subject: [PATCH v7 2/5] vhost-user: introduce protocol feature for skip drain on GET_VRING_BASE Date: Thu, 15 Jan 2026 13:11:03 +0500 Message-Id: <20260115081103.655749-3-dtalexundeer@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260115081103.655749-1-dtalexundeer@yandex-team.ru> References: <20260115081103.655749-1-dtalexundeer@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.136; envelope-from=dtalexundeer@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1768464765358158500 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Stefan Hajnoczi --- docs/interop/vhost-user.rst | 59 +++++++++++++++++++++------------- hw/virtio/vhost-user.c | 7 ++++ include/hw/virtio/vhost-user.h | 2 ++ 3 files changed, 46 insertions(+), 22 deletions(-) diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst index 66a8a2fbf3..a1afd09692 100644 --- a/docs/interop/vhost-user.rst +++ b/docs/interop/vhost-user.rst @@ -743,6 +743,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. =20 +.. _inflight_io_tracking: + Inflight I/O tracking --------------------- =20 @@ -1040,26 +1042,27 @@ Protocol features =20 .. code:: c =20 - #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 =20 Front-end message types ----------------------- @@ -1250,12 +1253,24 @@ Front-end message types =20 When and as long as all of a device's vrings are stopped, it is *suspended*, see :ref:`Suspended device state - `. The back-end must complete all inflight I/O - requests for the specified vring before stopping it. + `. =20 The request payload's *num* field is currently reserved and must be set to 0. =20 + 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 + ` instead of completing them before stopping the v= ring. + 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 63fa9a1b4b..bb8f8eab77 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -2225,6 +2225,13 @@ static int vhost_user_backend_init(struct vhost_dev = *dev, void *opaque, } } =20 + if (!u->user->supports_inflight_migration || + !virtio_has_feature(protocol_features, + VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) { + protocol_features &=3D ~(1ULL << + VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIG= HT); + } + /* final set of protocol features */ dev->protocol_features =3D protocol_features; err =3D vhost_user_set_protocol_features(dev, dev->protocol_featur= es); diff --git a/include/hw/virtio/vhost-user.h b/include/hw/virtio/vhost-user.h index 55d5725ef8..53fe996686 100644 --- a/include/hw/virtio/vhost-user.h +++ b/include/hw/virtio/vhost-user.h @@ -32,6 +32,7 @@ enum VhostUserProtocolFeature { /* Feature 17 reserved for VHOST_USER_PROTOCOL_F_XEN_MMAP. */ VHOST_USER_PROTOCOL_F_SHARED_OBJECT =3D 18, VHOST_USER_PROTOCOL_F_DEVICE_STATE =3D 19, + VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT =3D 20, VHOST_USER_PROTOCOL_F_MAX }; =20 @@ -68,6 +69,7 @@ typedef struct VhostUserState { GPtrArray *notifiers; int memory_slots; bool supports_config; + bool supports_inflight_migration; } VhostUserState; =20 /** --=20 2.34.1