From nobody Wed Feb 11 01:43:24 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=1768464787; cv=none; d=zohomail.com; s=zohoarc; b=jWc26CqAKE0c9/9XkGDFajySnxnK3adAyWn6riCe57nlnZQZQ2job90BDBqTkH8JSgu42oJBs0m1EyM1GjPncrOVbuSOMm4HUQvpupD0ZKxzVbtDePkz9mcrvYOwjo0ZMUhWN2+MYq6FKWifnRqshHImNW02Oqy8/++XPuQtcfI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768464787; 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=X3OeDLmKjVV7/P6aJCTi/mebxCg/pOWZ8d2ftLLT6Rg=; b=g3n+zM7OMrHSLhAI+UyLN9y3uAd2IeEC6K8uIBPAI8xp1eew8IWsi5jW59YZEaziqTR7AA8LAzCqHwMclJ3iKmzf1FmVSHnAD9Zuss+wLbZLtRQlwWGXDxSIOdM4fPW7jbvVLqcdKwFcmxvqEEHniI0u3vd53SlkjfvjF0Ay8zE= 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 1768464787123729.0796079675449; Thu, 15 Jan 2026 00:13:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vgITN-0003jA-QP; Thu, 15 Jan 2026 03:12: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 1vgITF-0003L6-Lu; Thu, 15 Jan 2026 03:12:45 -0500 Received: from forwardcorp1a.mail.yandex.net ([178.154.239.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vgITD-0006Fh-LP; Thu, 15 Jan 2026 03:12:45 -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 forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 241CCC0151; Thu, 15 Jan 2026 11:12:41 +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-OgOdefDm; Thu, 15 Jan 2026 11:12:40 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1768464760; bh=X3OeDLmKjVV7/P6aJCTi/mebxCg/pOWZ8d2ftLLT6Rg=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=EJl5erSoqRp2bfoZbkQIRY1krXauPegVhb7e0mJOS0XUOCftw1Rizq7aV3PXWjG4g sPrbRl/s+hIeZEPGajNBp7hidYTD7H3TkDnj1EhjZNqkrHbYJ/4ua1j0jLrWI9/CPT GbZDw4MXyctD6kCxDHu+f7AdMSc8on0x+iY6QXBU= 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 5/5] vhost-user-blk: support inter-host inflight migration Date: Thu, 15 Jan 2026 13:11:09 +0500 Message-Id: <20260115081103.655749-6-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.72; envelope-from=dtalexundeer@yandex-team.ru; helo=forwardcorp1a.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: 1768464789001158500 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 Reviewed-by: Raphael Norwitz --- hw/block/vhost-user-blk.c | 27 +++++++++++++++++++++++++++ include/hw/virtio/vhost-user-blk.h | 1 + include/hw/virtio/vhost.h | 6 ++++++ 3 files changed, 34 insertions(+) diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 4d81d2dc34..c151e83677 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -353,6 +353,7 @@ static int vhost_user_blk_connect(DeviceState *dev, Err= or **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, errp); if (ret < 0) { @@ -568,6 +569,26 @@ 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 virtio_has_feature(s->dev.protocol_feature= s, + VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIG= HT); + + return inflight_migration; +} + +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 const VMStateDescription vmstate_vhost_user_blk =3D { .name =3D "vhost-user-blk", .minimum_version_id =3D 1, @@ -576,6 +597,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 const Property vhost_user_blk_properties[] =3D { @@ -591,6 +616,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 8158d4673d..1e41a2bcdf 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 #endif diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index 08bbb4dfe9..89817bd848 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -554,4 +554,10 @@ static inline int vhost_load_backend_state(struct vhos= t_dev *dev, QEMUFile *f, } #endif =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) + #endif --=20 2.34.1