Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2218871/?format=api
{ "id": 2218871, "url": "http://patchwork.ozlabs.org/api/patches/2218871/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260401230548.136541-1-heifetz@yandex-team.com/", "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": "<20260401230548.136541-1-heifetz@yandex-team.com>", "list_archive_url": null, "date": "2026-04-01T23:05:48", "name": "vhost-user-blk: add seg-max-adjust flag", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "4e3bd99eb3592b2d1194454da5be0908e4ed40dd", "submitter": { "id": 92578, "url": "http://patchwork.ozlabs.org/api/people/92578/?format=api", "name": "Sergei Heifetz", "email": "heifetz@yandex-team.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260401230548.136541-1-heifetz@yandex-team.com/mbox/", "series": [ { "id": 498409, "url": "http://patchwork.ozlabs.org/api/series/498409/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=498409", "date": "2026-04-01T23:05:48", "name": "vhost-user-blk: add seg-max-adjust flag", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/498409/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2218871/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2218871/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.com header.i=@yandex-team.com\n header.a=rsa-sha256 header.s=default header.b=JKYq7Oap;\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.com" ], "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 4fmLGL138Jz1yGH\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 02 Apr 2026 10:06:48 +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 1w84dT-00051q-Hm; Wed, 01 Apr 2026 19:06:07 -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 <heifetz@yandex-team.com>)\n id 1w84dK-000507-MC; Wed, 01 Apr 2026 19:05:59 -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 <heifetz@yandex-team.com>)\n id 1w84dH-0005sF-MK; Wed, 01 Apr 2026 19:05:58 -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 24F65C0244;\n Thu, 02 Apr 2026 02:05:50 +0300 (MSK)", "from localhost (unknown [2a02:6bf:8080:42a::1:b])\n by mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net (smtpcorp/Yandex) with\n ESMTPSA id m5leq60LKeA0-kh0M1gk8; Thu, 02 Apr 2026 02:05:49 +0300" ], "X-Yandex-Fwd": "1", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.com;\n s=default; t=1775084749;\n bh=EoQSq2o+KRu3QhGbTHj5+iJSlNcBzF4BfhoQLpT5Iic=;\n h=Message-ID:Date:Cc:Subject:To:From;\n b=JKYq7OapdLJO3fmXDskzRWFeZETOE9sSofP0kQwuWe46imlZPqxvPFOgCPUsOiyiT\n 0mSs2+TwT3EEkkJtjP6rjQmhxHu9xPYbnHn44VRFAj6WLd5BOKpWhT8CAujZC45PG/\n meRasxjMao179d8Htv7RbRIuvULynA7xBDr6wlZo=", "From": "Sergei Heifetz <heifetz@yandex-team.com>", "To": "qemu-devel@nongnu.org", "Cc": "qemu-block@nongnu.org, \"Michael S. Tsirkin\" <mst@redhat.com>,\n Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>,\n Stefano Garzarella <sgarzare@redhat.com>,\n Raphael Norwitz <rnorwitz@nvidia.com>,\n Sergei Heifetz <heifetz@yandex-team.com>", "Subject": "[PATCH] vhost-user-blk: add seg-max-adjust flag", "Date": "Thu, 2 Apr 2026 04:05:48 +0500", "Message-ID": "<20260401230548.136541-1-heifetz@yandex-team.com>", "X-Mailer": "git-send-email 2.53.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=2a02:6b8:c0e:500:1:45:d181:df01;\n envelope-from=heifetz@yandex-team.com; 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", "Precedence": "list", "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": "The virtio specification is not completely clear about seg_max and its\nrelationship with queue_size. Some drivers (for example, the modern\nLinux kernel driver) rely on seg_max to set the maximum number of\nsegments used in a request. If seg_max is set larger than queue_size,\nsuch a driver might overwhelm a virtqueue by trying to send more\nsegments than it can handle. As a result, it either hangs or faults.\n\nOne might argue that it is the vhost-user server's responsibility to set\na valid seg_max value. However, due to the issue described in the\nprevious paragraph, this value should generally depend on queue_size.\nThat's why it may be necessary to control it on QEMU's side.\n\nThis patch adds the seg-max-adjust flag. A flag with the same name\nalready exists for virtio-blk (and it exists to solve the same problem,\nexcept that here we have a vhost-user server to consult).\n\nIf seg-max-adjust is set, the final seg_max is the minimum of the value\nprovided by the vhost-user server and (queue_size - 2). It is not\nenabled by default.\n\nSigned-off-by: Sergei Heifetz <heifetz@yandex-team.com>\n---\n hw/block/vhost-user-blk.c | 11 +++++++++++\n include/hw/virtio/vhost-user-blk.h | 1 +\n 2 files changed, 12 insertions(+)", "diff": "diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c\nindex c151e836770..23f910d9fe3 100644\n--- a/hw/block/vhost-user-blk.c\n+++ b/hw/block/vhost-user-blk.c\n@@ -65,6 +65,11 @@ static void vhost_user_blk_update_config(VirtIODevice *vdev, uint8_t *config)\n /* Our num_queues overrides the device backend */\n virtio_stw_p(vdev, &s->blkcfg.num_queues, s->num_queues);\n \n+ if (s->seg_max_adjust) {\n+ uint32_t seg_max = MIN(s->blkcfg.seg_max, s->queue_size - 2);\n+ virtio_stl_p(vdev, &s->blkcfg.seg_max, seg_max);\n+ }\n+\n memcpy(config, &s->blkcfg, vdev->config_len);\n }\n \n@@ -474,6 +479,10 @@ static void vhost_user_blk_device_realize(DeviceState *dev, Error **errp)\n error_setg(errp, \"queue size must be non-zero\");\n return;\n }\n+ if (s->queue_size < 4 && s->seg_max_adjust) {\n+ error_setg(errp, \"queue size must be >= 4 when seg-max-adjust is set\");\n+ return;\n+ }\n if (s->queue_size > VIRTQUEUE_MAX_SIZE) {\n error_setg(errp, \"queue size must not exceed %d\",\n VIRTQUEUE_MAX_SIZE);\n@@ -608,6 +617,8 @@ static const Property vhost_user_blk_properties[] = {\n DEFINE_PROP_UINT16(\"num-queues\", VHostUserBlk, num_queues,\n VHOST_USER_BLK_AUTO_NUM_QUEUES),\n DEFINE_PROP_UINT32(\"queue-size\", VHostUserBlk, queue_size, 128),\n+ DEFINE_PROP_BOOL(\"seg-max-adjust\", VHostUserBlk, seg_max_adjust,\n+ false),\n DEFINE_PROP_BIT64(\"config-wce\", VHostUserBlk, parent_obj.host_features,\n VIRTIO_BLK_F_CONFIG_WCE, true),\n DEFINE_PROP_BIT64(\"discard\", VHostUserBlk, parent_obj.host_features,\ndiff --git a/include/hw/virtio/vhost-user-blk.h b/include/hw/virtio/vhost-user-blk.h\nindex 1e41a2bcdf6..dee848cfd81 100644\n--- a/include/hw/virtio/vhost-user-blk.h\n+++ b/include/hw/virtio/vhost-user-blk.h\n@@ -34,6 +34,7 @@ struct VHostUserBlk {\n struct virtio_blk_config blkcfg;\n uint16_t num_queues;\n uint32_t queue_size;\n+ bool seg_max_adjust;\n struct vhost_dev dev;\n struct vhost_inflight *inflight;\n VhostUserState vhost_user;\n", "prefixes": [] }