From nobody Tue Feb 10 05:36:47 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=1768298366; cv=none; d=zohomail.com; s=zohoarc; b=JyHf+eR56xq3sQCvTZyPvhCrOfdes2HGUSExh3O+pnGjEvKoOXUoAyzZQDKvuWqjWAWogbqDxTFVW7fdWU2nKErP9yBSvBLgdiYIaXd4NKax6fgQKZXxHBcpMYyNQhvbKUuw3j53gCR6W40r2omzXHMEtyttij8HVHd58e9h2kE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768298366; 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=ZAd/Fxgvks8ojlWBXFbKSd9KMAVUVGhazsRwe+yiqKM=; b=T2mAEZbNsnQyL+I74F5jhB+3357WBN+J9DyGZVY+9t9mlvphXRCwC1mlOmaRaFi91AOad2/7KmZW/Qs4zJOM+iMVhD09pRcOrhVbvwUZ2moWIBLmUQuBmzxXwg3wt/ylZ1cP6bk2fbnPhTHm6EKtweoDwPK3lnjlEFzP950itGQ= 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 1768298366257236.33343043557966; Tue, 13 Jan 2026 01:59:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vfbAh-0003KI-FX; Tue, 13 Jan 2026 04:58:43 -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 1vfbAg-0003Jv-Mu; Tue, 13 Jan 2026 04:58:42 -0500 Received: from forwardcorp1b.mail.yandex.net ([2a02:6b8:c02:900:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vfbAf-0006A1-6U; Tue, 13 Jan 2026 04:58:42 -0500 Received: from mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net [IPv6:2a02:6b8:c24:fa2:0:640:41ee:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 55FFC80877; Tue, 13 Jan 2026 12:58:37 +0300 (MSK) Received: from dtalexundeer-nx.yandex.net (unknown [2a02:6bf:803e:400:93c4:8e38:1f90:3c73]) by mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id KwPsag5AAiE0-WyAPVCn2; Tue, 13 Jan 2026 12:58:36 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1768298316; bh=ZAd/Fxgvks8ojlWBXFbKSd9KMAVUVGhazsRwe+yiqKM=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=l5fagdeUYR347duZfpZOPSakcHnQ7gVyl0wLf2zqBWuKA57wqBht+MLEdsNYPSu7B Kq1vwIeE6EyurIpZ2dvHT5YhZZ6KgSfq7CpLtPWBy8w0SjarSdCgxyT35Vbmhu4qX7 diG8Y3wWOuNVnlkw2rPx/jzpOLjReifCFKKrAokY= Authentication-Results: mail-nwsmtp-smtp-corp-main-34.sas.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 v6 1/5] vhost-user.rst: specify vhost-user back-end action on GET_VRING_BASE Date: Tue, 13 Jan 2026 14:58:11 +0500 Message-Id: <20260113095813.134810-2-dtalexundeer@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260113095813.134810-1-dtalexundeer@yandex-team.ru> References: <20260113095813.134810-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=2a02:6b8:c02:900:1:45:d181:df01; 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, 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: 1768298368530158501 Content-Type: text/plain; charset="utf-8" By default, we assume that server need to wait all inflight IO on GET_VRING_BASE. However, this fact is not recorded anywhere in the documentation. So, add this info in rst. Signed-off-by: Alexandr Moshkov Reviewed-by: Stefan Hajnoczi --- docs/interop/vhost-user.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst index 2e50f2ddfa..02908b48fa 100644 --- a/docs/interop/vhost-user.rst +++ b/docs/interop/vhost-user.rst @@ -1243,7 +1243,8 @@ 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 2.34.1 From nobody Tue Feb 10 05:36:47 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=1768298372; cv=none; d=zohomail.com; s=zohoarc; b=V2hTGYmsUDD4pdxZ1rBOeQXnx/GuXT9ZgG8TWiyup+UNLcQOlb5mJWp3FTxhJxzvQkXdYg3GBUWzovSnBH5CG+NFriVIJ1N8Exzgx+ofPm2Q0RwFAjKAnaGhCgOGTxpinNxfmtcpKhAcp3nqOVypnlfEwTOYPKjsiRYxSpi5MD8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768298372; 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=mQlvZ/q4g+mikGzd4Pofhz2KyjP2tY8dgFy2MWKhBPc=; b=B74Y1UIH2lLqVX15yxmK2/eAH+aJBwRe6SOnkhtC+YZ/VxPmJz6IvSd+O2l7fTbnCEoDq85fzqQGc2Cg4bAFXVH5p2uq5XnU+uW2yhgAbUY713S+nrNv7mlF3RssbOa3s9CRZ543qtZ0Zq+OA3eyAOmHyPB8YfxX29ksXguQe+Y= 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 176829837209276.21418504408882; Tue, 13 Jan 2026 01:59:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vfbAo-0003MW-2j; Tue, 13 Jan 2026 04:58:50 -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 1vfbAm-0003Lr-9I; Tue, 13 Jan 2026 04:58:48 -0500 Received: from forwardcorp1b.mail.yandex.net ([2a02:6b8:c02:900:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vfbAk-0006Cy-DC; Tue, 13 Jan 2026 04:58:48 -0500 Received: from mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net [IPv6:2a02:6b8:c24:fa2:0:640:41ee:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 3990A807E3; Tue, 13 Jan 2026 12:58:44 +0300 (MSK) Received: from dtalexundeer-nx.yandex.net (unknown [2a02:6bf:803e:400:93c4:8e38:1f90:3c73]) by mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id KwPsag5AAiE0-VPA0AX0f; Tue, 13 Jan 2026 12:58:43 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1768298323; bh=mQlvZ/q4g+mikGzd4Pofhz2KyjP2tY8dgFy2MWKhBPc=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=C5cvbg1eoe1LKWy/X+ZNblUiz/IFOOOqv11v5ARD+Cnw8yapR/bf+aX2kMLsDcgcm o3yDoWoaLQ8yQ8IthI8a4nWTS3PGk8/BZ1b4F7asdIcEjnxs5OcaRBWBXBtc/CtUen ZCi3iN8CvP7H2p1vDvN59fzArWXPuHAUDfQY4rss= Authentication-Results: mail-nwsmtp-smtp-corp-main-34.sas.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 v6 2/5] vhost-user: introduce protocol feature for skip drain on GET_VRING_BASE Date: Tue, 13 Jan 2026 14:58:13 +0500 Message-Id: <20260113095813.134810-3-dtalexundeer@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260113095813.134810-1-dtalexundeer@yandex-team.ru> References: <20260113095813.134810-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=2a02:6b8:c02:900:1:45:d181:df01; 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, 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: 1768298372476158500 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 | 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. =20 +.. _inflight_io_tracking: + Inflight I/O tracking --------------------- =20 @@ -1033,26 +1035,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 ----------------------- @@ -1243,12 +1246,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 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_d= ev *dev, Error **errp) } } =20 + if (!u->user->supports_inflight_migration || + !virtio_has_feature(VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) { + protocol_features &=3D ~(1ULL << + VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIG= HT); + } + /* final set of protocol features */ u->protocol_features =3D protocol_features; err =3D vhost_user_set_protocol_features(dev, u->protocol_features= ); 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 =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 @@ -69,6 +70,7 @@ typedef struct VhostUserState { GPtrArray *notifiers; int memory_slots; bool supports_config; + bool supports_inflight_migration; } VhostUserState; =20 /** --=20 2.34.1 From nobody Tue Feb 10 05:36:47 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=1768298398; cv=none; d=zohomail.com; s=zohoarc; b=Tn+zjWXauwjezDxC7cmeUqj8choPh0rpinl02Mi8SgjlTbZsrxITBs70i0bd6kpFX3D6rbCShLu9lh4ROM4HFW5JTRKJ8/wneFcuASJxyEIYX2X8y8uoM8qZEEj36Y5U5UH+4lwpYEjk+i4t8PR03Q5BbPAdYAjR7Vpm9hqrJEE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768298398; 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=BBaLzRPC1vSdvTfCEYutHaoyo6yavs9dofrXa1+5uLk=; b=cVd7zBhU15TY8dQoEfaQk76TsNT2AXNGqHWdodMn+oz1JF4D+2AnOR2S0r/ZzanVOSq3n0W6QmBNmE7crVmWAZtf6loqII237DGM0uD7Fga9DbCiONwmqVGoH6bTdHhukoD6JK9NASviaGfMM6kTo7iLNUgezk0sUx2AJ6V/lfs= 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 1768298398958372.5669699500462; Tue, 13 Jan 2026 01:59:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vfbAt-0003Oi-JZ; Tue, 13 Jan 2026 04:58:55 -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 1vfbAs-0003O9-M5; Tue, 13 Jan 2026 04:58:54 -0500 Received: from forwardcorp1b.mail.yandex.net ([2a02:6b8:c02:900:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vfbAr-0006EZ-4i; Tue, 13 Jan 2026 04:58:54 -0500 Received: from mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net [IPv6:2a02:6b8:c24:fa2:0:640:41ee:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 5778680874; Tue, 13 Jan 2026 12:58:51 +0300 (MSK) Received: from dtalexundeer-nx.yandex.net (unknown [2a02:6bf:803e:400:93c4:8e38:1f90:3c73]) by mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id KwPsag5AAiE0-m6oYaAmG; Tue, 13 Jan 2026 12:58:50 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1768298330; bh=BBaLzRPC1vSdvTfCEYutHaoyo6yavs9dofrXa1+5uLk=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=gCtK0dKwB29nbLSyWXagGxRTfpsPq3Bqmykx05TkITYmD3ZZvJ8KfMxlbDsN2o6l9 hITJ3TgJ0Bk0emsaztTBe0cMiGyRPlujUVo8pNyRePuKazm8x23OQrmJJgUzwgCINg vcFhvI7kYg53jAxCOIJhbuQ5Ij1kpWucLkNXWObI= Authentication-Results: mail-nwsmtp-smtp-corp-main-34.sas.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 v6 3/5] vmstate: introduce VMSTATE_VBUFFER_UINT64 Date: Tue, 13 Jan 2026 14:58:15 +0500 Message-Id: <20260113095813.134810-4-dtalexundeer@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260113095813.134810-1-dtalexundeer@yandex-team.ru> References: <20260113095813.134810-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=2a02:6b8:c02:900:1:45:d181:df01; 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, 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: 1768298400555158500 Content-Type: text/plain; charset="utf-8" This is an analog of VMSTATE_VBUFFER_UINT32 macro, but for uint64 type. Signed-off-by: Alexandr Moshkov Acked-by: Peter Xu Reviewed-by: Stefan Hajnoczi --- include/migration/vmstate.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 7f1f1c166a..4c9e212d58 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -707,6 +707,16 @@ extern const VMStateInfo vmstate_info_qlist; .offset =3D offsetof(_state, _field), \ } =20 +#define VMSTATE_VBUFFER_UINT64(_field, _state, _version, _test, _field_siz= e) { \ + .name =3D (stringify(_field)), \ + .version_id =3D (_version), \ + .field_exists =3D (_test), \ + .size_offset =3D vmstate_offset_value(_state, _field_size, uint64_t),\ + .info =3D &vmstate_info_buffer, \ + .flags =3D VMS_VBUFFER | VMS_POINTER, \ + .offset =3D offsetof(_state, _field), \ +} + #define VMSTATE_VBUFFER_ALLOC_UINT32(_field, _state, _version, \ _test, _field_size) { \ .name =3D (stringify(_field)), \ --=20 2.34.1 From nobody Tue Feb 10 05:36:47 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=1768298392; cv=none; d=zohomail.com; s=zohoarc; b=SvSwqOy1wTcsrxrwmJ478lL3n9hlXEU0aZy1PV9XmLgVxH++F8zF2IZN3RNnC2pXjclKomRi0MiIRwS2DzRF79D7dvealwKVJ7LrF3UGVWWNjE/+kNwUbwjVPBzEP0de8fhx43hVQzYip10IwBPpVpyLHlfdvuUwJQLn+MLgnYc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768298392; 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=XMMSdWsV7hoMkKSn+5aQ4Vb4bLkyzG3T3BxpqQSyRxY=; b=YEjgstuYTU84BOxLY0usqJE0/dLUqnY41ArXDNIu77ggvnP88MVC1bpcJRT0TrxulboOeZryqHthlb8r6AG5lp+htGt9Z74uH3Z7RIv2pUZ6Tn24Mv2WID+zL95jCL+u6EvkzPR9j7rAP4FN626VIERgoFMIGsLA/JR+sAH55GE= 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 1768298392321431.496916735706; Tue, 13 Jan 2026 01:59:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vfbB1-0003Sh-1o; Tue, 13 Jan 2026 04:59:03 -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 1vfbAz-0003RZ-Cy; Tue, 13 Jan 2026 04:59:01 -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 1vfbAx-0006Fd-SV; Tue, 13 Jan 2026 04:59:01 -0500 Received: from mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net [IPv6:2a02:6b8:c24:fa2:0:640:41ee:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 7F3FB80872; Tue, 13 Jan 2026 12:58:57 +0300 (MSK) Received: from dtalexundeer-nx.yandex.net (unknown [2a02:6bf:803e:400:93c4:8e38:1f90:3c73]) by mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id KwPsag5AAiE0-9RUEQUNk; Tue, 13 Jan 2026 12:58:56 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1768298337; bh=XMMSdWsV7hoMkKSn+5aQ4Vb4bLkyzG3T3BxpqQSyRxY=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=z6eIawIK1k28FBJ8W8Agi0YANlCVLNm3iHKIJbjS4RXxftRmRdmMmgSoX+qy9iysw N5yvMy3allltUXdm3Bp460Idj02Nfy8aHeYvZ8XlAEzArgvSE/OBzQmnaPJ3y/1AQx /uilIBWONTYZTguXqHOsCRqasvFNUACf3vOKcWrQ= Authentication-Results: mail-nwsmtp-smtp-corp-main-34.sas.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 v6 4/5] vhost: add vmstate for inflight region with inner buffer Date: Tue, 13 Jan 2026 14:58:17 +0500 Message-Id: <20260113095813.134810-5-dtalexundeer@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260113095813.134810-1-dtalexundeer@yandex-team.ru> References: <20260113095813.134810-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1768298394546158500 Content-Type: text/plain; charset="utf-8" Prepare for future inflight region migration for vhost-user-blk. We need to migrate size, queue_size, and inner buffer. So firstly it migrate size and queue_size fields, then allocate memory for = buffer with migrated size, then migrate inner buffer itself. Signed-off-by: Alexandr Moshkov Reviewed-by: Stefan Hajnoczi --- hw/virtio/vhost.c | 57 +++++++++++++++++++++++++++++++++++++++ include/hw/virtio/vhost.h | 6 +++++ 2 files changed, 63 insertions(+) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index c46203eb9c..f655c53b67 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -2028,6 +2028,63 @@ const VMStateDescription vmstate_backend_transfer_vh= ost_inflight =3D { } }; =20 +static int vhost_inflight_buffer_pre_load(void *opaque, Error **errp) +{ + info_report("vhost_inflight_region_buffer_pre_load"); + struct vhost_inflight *inflight =3D opaque; + + int fd =3D -1; + void *addr =3D qemu_memfd_alloc("vhost-inflight", inflight->size, + F_SEAL_GROW | F_SEAL_SHRINK | F_SEAL_SEA= L, + &fd, errp); + if (*errp) { + return -ENOMEM; + } + + inflight->offset =3D 0; + inflight->addr =3D addr; + inflight->fd =3D fd; + + return 0; +} + +const VMStateDescription vmstate_vhost_inflight_region_buffer =3D { + .name =3D "vhost-inflight-region/buffer", + .pre_load_errp =3D vhost_inflight_buffer_pre_load, + .fields =3D (const VMStateField[]) { + VMSTATE_VBUFFER_UINT64(addr, struct vhost_inflight, 0, NULL, size), + VMSTATE_END_OF_LIST() + } +}; + +static int vhost_inflight_region_post_load(void *opaque, + int version_id, + Error **errp) +{ + struct vhost_inflight *inflight =3D opaque; + + if (inflight->addr =3D=3D NULL) { + error_setg(errp, "inflight buffer subsection has not been loaded"); + return -EINVAL; + } + + return 0; +} + +const VMStateDescription vmstate_vhost_inflight_region =3D { + .name =3D "vhost-inflight-region", + .post_load_errp =3D vhost_inflight_region_post_load, + .fields =3D (const VMStateField[]) { + VMSTATE_UINT64(size, struct vhost_inflight), + VMSTATE_UINT16(queue_size, struct vhost_inflight), + VMSTATE_END_OF_LIST() + }, + .subsections =3D (const VMStateDescription * const []) { + &vmstate_vhost_inflight_region_buffer, + NULL + } +}; + const VMStateDescription vmstate_vhost_virtqueue =3D { .name =3D "vhost-virtqueue", .fields =3D (const VMStateField[]) { diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index 13ca2c319f..dd552de91f 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -596,6 +596,12 @@ extern const VMStateDescription vmstate_backend_transf= er_vhost_inflight; vmstate_backend_transfer_vhost_inflight, \ struct vhost_inflight) =20 +extern const VMStateDescription vmstate_vhost_inflight_region; +#define VMSTATE_VHOST_INFLIGHT_REGION(_field, _state) \ + VMSTATE_STRUCT_POINTER(_field, _state, \ + vmstate_vhost_inflight_region, \ + struct vhost_inflight) + extern const VMStateDescription vmstate_vhost_dev; #define VMSTATE_BACKEND_TRANSFER_VHOST(_field, _state) \ VMSTATE_STRUCT(_field, _state, 0, vmstate_vhost_dev, struct vhost_dev) --=20 2.34.1 From nobody Tue Feb 10 05:36:47 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=1768298377; cv=none; d=zohomail.com; s=zohoarc; b=Zh9tSMO8bngLQQ4rO/LQPH+gB3N3hyMNbAJczzXiwbB+WY0zjJ40Ud83J6p4NUoSE3h+ISB/Bzc719Na12Z/1YFHHB3HzpoMXeAED+cNX1L0B9AUAgZ7siOmhwh2qUOwWZHLzP3hsdRlogy4OVhExbkGypKeJQEJ1KtQcWF8U4o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768298377; 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=strUFTdyj30J5yE2cBIXci40KmPq9NaRqGWVIA7ALD4=; b=YqbnhoA+g20pVq8Qq8DkFabsp57gFDmnsqqHzZiViqWDljV62WLnLhC5biTcirdYjrYOC+EKMeK14v3oCrM4ww7leJfjQwpiDHV8GcpU7m3WQfR9PpY2jbIh+NaP5mcNiJTmF9NgAX7ekC6wVIVHZMn2c7dit2YIQJ2cTN/xMco= 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 1768298377683196.7356601432333; Tue, 13 Jan 2026 01:59:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vfbBB-0003cw-V9; Tue, 13 Jan 2026 04:59:13 -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 1vfbB5-0003Tv-Jh; Tue, 13 Jan 2026 04:59:08 -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 1vfbB3-0006GV-Q1; Tue, 13 Jan 2026 04:59:07 -0500 Received: from mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net [IPv6:2a02:6b8:c24:fa2:0:640:41ee:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 2C14A8085D; Tue, 13 Jan 2026 12:59:04 +0300 (MSK) Received: from dtalexundeer-nx.yandex.net (unknown [2a02:6bf:803e:400:93c4:8e38:1f90:3c73]) by mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id KwPsag5AAiE0-leX9UN8b; Tue, 13 Jan 2026 12:59:03 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1768298343; bh=strUFTdyj30J5yE2cBIXci40KmPq9NaRqGWVIA7ALD4=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=J58cdWhn9GWLtrAhxFxJ2bkXJruf7DB8CCX8gzUSqpvE+dlLsohEOpvmndzahUvhP sWYowF3d8SHCZ5jIqDSX+KJqIi0jNtNFb1IeNB3s5ZOaigojUmr7HK/B0VKIiTvIzV dD4Ak6lzFgj7LqQeRy0vIWbRfoD7T4dIJDMDoWtU= Authentication-Results: mail-nwsmtp-smtp-corp-main-34.sas.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 v6 5/5] vhost-user-blk: support inter-host inflight migration Date: Tue, 13 Jan 2026 14:58:19 +0500 Message-Id: <20260113095813.134810-6-dtalexundeer@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260113095813.134810-1-dtalexundeer@yandex-team.ru> References: <20260113095813.134810-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1768298378425158500 Content-Type: text/plain; charset="utf-8" During inter-host migration, waiting for disk requests to be drained in the vhost-user backend can incur significant downtime. This can be avoided if QEMU migrates the inflight region in vhost-user-blk. Thus, during the qemu migration, with feature flag the vhost-user back-end can immediately stop vrings, so all in-flight requests will be migrated to another host. Signed-off-by: Alexandr Moshkov Reviewed-by: Stefan Hajnoczi --- hw/block/vhost-user-blk.c | 28 ++++++++++++++++++++++++++++ include/hw/virtio/vhost-user-blk.h | 1 + 2 files changed, 29 insertions(+) diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index a8fd90480a..9093e98841 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -377,6 +377,7 @@ static int vhost_user_blk_init(DeviceState *dev, bool c= onnect, Error **errp) vhost_dev_set_config_notifier(&s->dev, &blk_ops); =20 s->vhost_user.supports_config =3D true; + s->vhost_user.supports_inflight_migration =3D s->inflight_migration; ret =3D vhost_dev_init(&s->dev, &s->vhost_user, VHOST_BACKEND_TYPE_USE= R, 0, false, errp); if (ret < 0) { @@ -656,6 +657,27 @@ static struct vhost_dev *vhost_user_blk_get_vhost(Virt= IODevice *vdev) return &s->dev; } =20 +static bool vhost_user_blk_inflight_needed(void *opaque) +{ + struct VHostUserBlk *s =3D opaque; + + bool inflight_migration =3D vhost_dev_has_feature(&s->dev, + VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT); + + return inflight_migration && + !migrate_local_vhost_user_blk(); +} + +static const VMStateDescription vmstate_vhost_user_blk_inflight =3D { + .name =3D "vhost-user-blk/inflight", + .version_id =3D 1, + .needed =3D vhost_user_blk_inflight_needed, + .fields =3D (const VMStateField[]) { + VMSTATE_VHOST_INFLIGHT_REGION(inflight, VHostUserBlk), + VMSTATE_END_OF_LIST() + }, +}; + static bool vhost_user_blk_pre_incoming(void *opaque, Error **errp) { VHostUserBlk *s =3D VHOST_USER_BLK(opaque); @@ -678,6 +700,10 @@ static const VMStateDescription vmstate_vhost_user_blk= =3D { VMSTATE_VIRTIO_DEVICE, VMSTATE_END_OF_LIST() }, + .subsections =3D (const VMStateDescription * const []) { + &vmstate_vhost_user_blk_inflight, + NULL + } }; =20 static bool vhost_user_needed(void *opaque) @@ -751,6 +777,8 @@ static const Property vhost_user_blk_properties[] =3D { VIRTIO_BLK_F_WRITE_ZEROES, true), DEFINE_PROP_BOOL("skip-get-vring-base-on-force-shutdown", VHostUserBlk, skip_get_vring_base_on_force_shutdown, false), + DEFINE_PROP_BOOL("inflight-migration", VHostUserBlk, + inflight_migration, false), }; =20 static void vhost_user_blk_class_init(ObjectClass *klass, const void *data) diff --git a/include/hw/virtio/vhost-user-blk.h b/include/hw/virtio/vhost-u= ser-blk.h index b06f55fd6f..e1466e5cf6 100644 --- a/include/hw/virtio/vhost-user-blk.h +++ b/include/hw/virtio/vhost-user-blk.h @@ -52,6 +52,7 @@ struct VHostUserBlk { bool started_vu; =20 bool skip_get_vring_base_on_force_shutdown; + bool inflight_migration; =20 bool incoming_backend; }; --=20 2.34.1