Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2217644/?format=api
{ "id": 2217644, "url": "http://patchwork.ozlabs.org/api/patches/2217644/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260330095226.158386-6-dtalexundeer@yandex-team.ru/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260330095226.158386-6-dtalexundeer@yandex-team.ru>", "list_archive_url": null, "date": "2026-03-30T09:52:26", "name": "[v3,5/5] vhost-user: add skip_drain param to GET_VRING_BASE", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "43aa5624dc06ca0a876735fc133c0f64939dc55b", "submitter": { "id": 90655, "url": "http://patchwork.ozlabs.org/api/people/90655/?format=api", "name": "Alexandr Moshkov", "email": "dtalexundeer@yandex-team.ru" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260330095226.158386-6-dtalexundeer@yandex-team.ru/mbox/", "series": [ { "id": 497991, "url": "http://patchwork.ozlabs.org/api/series/497991/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=497991", "date": "2026-03-30T09:52:26", "name": "vhost-user-blk: fix compatibility with older qemu versions", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/497991/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2217644/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2217644/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=yandex-team.ru header.i=@yandex-team.ru\n header.a=rsa-sha256 header.s=default header.b=LRYxjwiM;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)", "mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net;\n dkim=pass header.i=@yandex-team.ru" ], "Received": [ "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fkmmB3jsZz1yG8\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 30 Mar 2026 20:53:46 +1100 (AEDT)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1w79Ip-0005P8-2Z; Mon, 30 Mar 2026 05:52:59 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <dtalexundeer@yandex-team.ru>)\n id 1w79Id-0005N7-3f; Mon, 30 Mar 2026 05:52:48 -0400", "from forwardcorp1a.mail.yandex.net\n ([2a02:6b8:c0e:500:1:45:d181:df01])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <dtalexundeer@yandex-team.ru>)\n id 1w79IZ-00064W-3x; Mon, 30 Mar 2026 05:52:46 -0400", "from mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net\n (mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net\n [IPv6:2a02:6b8:c2d:3530:0:640:eca4:0])\n by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 9989EC0203;\n Mon, 30 Mar 2026 12:52:41 +0300 (MSK)", "from dtalexundeer-nx.yandex-team.ru (unknown\n [2a02:6bf:8080:78d::1:13])\n by mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net (smtpcorp/Yandex) with\n ESMTPSA id QqVNFG1Af4Y0-5AOJ86sv; Mon, 30 Mar 2026 12:52:40 +0300" ], "Precedence": "bulk", "X-Yandex-Fwd": "1", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru;\n s=default; t=1774864360;\n bh=Hh5LG4Doo1WyRSeiFJBSkiaSBS0yCBvqInUEe434a44=;\n h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From;\n b=LRYxjwiMbBzC7+zDw44jqlEVvTVB+c0ttr229s8mU327X7ixmhIVuTrqLEJCWBxNz\n yy9sUmLKw/Q2lo8DBvyfs5owDPIiq1Ehbm8m/6MWqLYuvhz15/FYnpp1Jrno1mEr+z\n /Y3jybaki2fs06GZ1lg1SEmWrkIh6RYT+4tRBWdY=", "From": "Alexandr Moshkov <dtalexundeer@yandex-team.ru>", "To": "qemu-devel@nongnu.org", "Cc": "\"Gonglei (Arei)\" <arei.gonglei@huawei.com>,\n =?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org>,\n Milan Zamazal <mzamazal@redhat.com>, Raphael Norwitz <rnorwitz@nvidia.com>,\n Paolo Bonzini <pbonzini@redhat.com>, Jason Wang <jasowang@redhat.com>,\n qemu-block@nongnu.org, Fam Zheng <fam@euphon.net>,\n zhenwei pi <zhenwei.pi@linux.dev>, Hanna Reitz <hreitz@redhat.com>,\n virtio-fs@lists.linux.dev, Pierrick Bouvier <pierrick.bouvier@linaro.org>,\n Stefano Garzarella <sgarzare@redhat.com>,\n \"Michael S. Tsirkin\" <mst@redhat.com>,\n \"yc-core@yandex-team.ru\" <yc-core@yandex-team.ru>,\n Kevin Wolf <kwolf@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>,\n Alexandr Moshkov <dtalexundeer@yandex-team.ru>,\n Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>", "Subject": "[PATCH v3 5/5] vhost-user: add skip_drain param to GET_VRING_BASE", "Date": "Mon, 30 Mar 2026 14:52:26 +0500", "Message-Id": "<20260330095226.158386-6-dtalexundeer@yandex-team.ru>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20260330095226.158386-1-dtalexundeer@yandex-team.ru>", "References": "<20260330095226.158386-1-dtalexundeer@yandex-team.ru>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=2a02:6b8:c0e:500:1:45:d181:df01;\n envelope-from=dtalexundeer@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net", "X-Spam_score_int": "-27", "X-Spam_score": "-2.8", "X-Spam_bar": "--", "X-Spam_report": "(-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001,\n 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 <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "In case of migration of QEMU from the new version (where the\ninllight-migration parameter is present), to the old one (where it is\nabsent) there is no way to disable this feature on the backend during\nruntime.\n\nThis commit slightly changes the semantics of the protocol feature\nVHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT. Enabling this feature\nadds a new parameter for GET_VRING_BASE, which allows to control the\ndrain in-flight requests on the backend.\nThus, QEMU will be able to turn this feature on GET_VRING_BASE off and\non anytime.\n\nIn vhost-user-blk use inflight_migration param to enable skip_drain to\nsuspend in-flight I/O requests, and then migrate them throught inflight\nsubsection.\n\nAlso now QEMU will always try to setup\nVHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT protocol featrue with\nbackend. This will allow to use skip_drain parameter on GET_VRING_BASE\nmessage.\n\nReviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>\nSigned-off-by: Alexandr Moshkov <dtalexundeer@yandex-team.ru>\n---\n docs/interop/vhost-user.rst | 6 ++----\n hw/block/vhost-user-blk.c | 30 ++++++++++++++++++++++++------\n hw/virtio/vhost-user.c | 3 +--\n hw/virtio/vhost.c | 1 +\n include/hw/virtio/vhost-user.h | 1 -\n 5 files changed, 28 insertions(+), 13 deletions(-)", "diff": "diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst\nindex bfa75ff9a3..63efc87264 100644\n--- a/docs/interop/vhost-user.rst\n+++ b/docs/interop/vhost-user.rst\n@@ -1255,14 +1255,12 @@ Front-end message types\n *suspended*, see :ref:`Suspended device state\n <suspended_device_state>`.\n \n- The request payload's *num* field is currently reserved and must be\n- set to 0.\n-\n By default, the back-end must complete all inflight I/O requests for the\n specified vring before stopping it.\n \n If the ``VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT`` protocol\n- feature has been negotiated, the back-end may suspend in-flight I/O\n+ feature has been negotiated, using request payload's *num* field,\n+ when *num* is set to 1, QEMU can tell the back-end to suspend in-flight I/O\n requests and record them as described in :ref:`Inflight I/O tracking\n <inflight_io_tracking>` instead of completing them before stopping the vring.\n How to suspend an in-flight request depends on the implementation of the back-end\ndiff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c\nindex a3ecd83f54..522e9d34b5 100644\n--- a/hw/block/vhost-user-blk.c\n+++ b/hw/block/vhost-user-blk.c\n@@ -134,10 +134,7 @@ static bool vhost_user_blk_inflight_needed(void *opaque)\n {\n struct VHostUserBlk *s = opaque;\n \n- bool inflight_migration = virtio_has_feature(s->dev.protocol_features,\n- VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT);\n-\n- return inflight_migration;\n+ return s->inflight_migration;\n }\n \n \n@@ -232,11 +229,14 @@ static int vhost_user_blk_stop(VirtIODevice *vdev)\n return 0;\n }\n \n+ bool skip_drain = vhost_user_blk_inflight_needed(s) &&\n+ runstate_check(RUN_STATE_FINISH_MIGRATE);\n+\n force_stop = s->skip_get_vring_base_on_force_shutdown &&\n qemu_force_shutdown_requested();\n \n ret = force_stop ? vhost_dev_force_stop(&s->dev, vdev, true) :\n- vhost_dev_stop(&s->dev, vdev, true, false);\n+ vhost_dev_stop(&s->dev, vdev, true, skip_drain);\n \n if (k->set_guest_notifiers(qbus->parent, s->dev.nvqs, false) < 0) {\n error_report(\"vhost guest notifier cleanup failed: %d\", ret);\n@@ -364,7 +364,6 @@ static int vhost_user_blk_connect(DeviceState *dev, Error **errp)\n vhost_dev_set_config_notifier(&s->dev, &blk_ops);\n \n s->vhost_user.supports_config = true;\n- s->vhost_user.supports_inflight_migration = s->inflight_migration;\n ret = vhost_dev_init(&s->dev, &s->vhost_user, VHOST_BACKEND_TYPE_USER, 0,\n errp);\n if (ret < 0) {\n@@ -580,10 +579,29 @@ static struct vhost_dev *vhost_user_blk_get_vhost(VirtIODevice *vdev)\n return &s->dev;\n }\n \n+static bool vhost_user_blk_pre_save(void *opaque, Error **errp)\n+{\n+ VHostUserBlk *s = VHOST_USER_BLK(opaque);\n+\n+ bool inflight_migration_enabled = virtio_has_feature(\n+ s->dev.protocol_features,\n+ VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT);\n+ if (vhost_user_blk_inflight_needed(s) && !inflight_migration_enabled) {\n+ error_setg(errp, \"can't migrate vhost-user-blk device: \"\n+ \"backend doesn't support \"\n+ \"VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT \"\n+ \"protocol feature\");\n+ return false;\n+ }\n+\n+ return true;\n+}\n+\n static const VMStateDescription vmstate_vhost_user_blk_inflight = {\n .name = \"vhost-user-blk/inflight\",\n .version_id = 1,\n .needed = vhost_user_blk_inflight_needed,\n+ .pre_save_errp = vhost_user_blk_pre_save,\n .fields = (const VMStateField[]) {\n VMSTATE_VHOST_INFLIGHT_REGION(inflight, VHostUserBlk),\n VMSTATE_END_OF_LIST()\ndiff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c\nindex bb8f8eab77..ed95ec7523 100644\n--- a/hw/virtio/vhost-user.c\n+++ b/hw/virtio/vhost-user.c\n@@ -2225,8 +2225,7 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque,\n }\n }\n \n- if (!u->user->supports_inflight_migration ||\n- !virtio_has_feature(protocol_features,\n+ if (!virtio_has_feature(protocol_features,\n VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) {\n protocol_features &= ~(1ULL <<\n VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT);\ndiff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c\nindex ac4d6fca73..54e4ce2660 100644\n--- a/hw/virtio/vhost.c\n+++ b/hw/virtio/vhost.c\n@@ -1398,6 +1398,7 @@ static int do_vhost_virtqueue_stop(struct vhost_dev *dev,\n int vhost_vq_index = dev->vhost_ops->vhost_get_vq_index(dev, idx);\n struct vhost_vring_state state = {\n .index = vhost_vq_index,\n+ .num = skip_drain,\n };\n int r = 0;\n \ndiff --git a/include/hw/virtio/vhost-user.h b/include/hw/virtio/vhost-user.h\nindex 53fe996686..c95bad5ddc 100644\n--- a/include/hw/virtio/vhost-user.h\n+++ b/include/hw/virtio/vhost-user.h\n@@ -69,7 +69,6 @@ typedef struct VhostUserState {\n GPtrArray *notifiers;\n int memory_slots;\n bool supports_config;\n- bool supports_inflight_migration;\n } VhostUserState;\n \n /**\n", "prefixes": [ "v3", "5/5" ] }