From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11020095.outbound.protection.outlook.com [52.101.69.95]) by lore.virtuozzo.com (Postfix) with ESMTPS id 9295E803F6 for ; Wed, 18 Nov 2026 10:53:08 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=o+bytJpiZUQrhXSJunx0z0JNI8glB3n8XTRpAqU9CcaNCyfyt9M+f5RWlZ+JBa3VldbftqwByWadKumEZBA24cZCb6JFVCzUiht3J6aAY/gQLSLb6p/3K9iOdpkyJVCqh+kVLvaRannCcPOpcFN2Fkvv2PPVTSlXqEpZcX7VWP9z5rRxJY6KMATAwKwtHuetLO8NNVz+2r3LAzW+9wl9gO4Ri9+ZcKSzUekT3PLJk65+6AHqLJpvmwwImDp0kdETpTjIKSNBS0evKprVuHd7HATqIgfPlmIYdXaioYNP1LcFjARKYWm5LNYNTe3+KovuihVLxuL/9tvdPvOICN82MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=D+BXxlNCbrVIQTbuP2sWB5+7dKX4ogICfxf8usqxJOs=; b=su1lUeV4TpfDJrzLA39kYgGRPmHpWRzx92gWno2ID6fBBmuMxSJ2c849z4OHDyW4tqij63C/mvO4jymwsl8VHhxoCCFdDHyGLTEq2NwjfBTpA083t3cqlcQiGRzt0z84xOlhWe/JzGKVXakXfQZDPJSOyLtgeq3EO1Yvg5ZwgixJMcjXFj45UeO3GD30tDGU4cta0lhqE79zPGuSBQTg+mAUKQKcDtIEBkAXBJKBbTJrk/gprr8Fxxz//76ugiLrvsn2BBLJXgQDPAeE6kbuotwm0RhAly8vgy8w8KyWUmFM1OJU1KfHCaQOiKOvl157oF85H/KTL6PE1OnxkBY49g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 69.169.224.2) smtp.rcpttodomain=virtuozzo.com smtp.mailfrom=eu-central-1.amazonses.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=sashiko.virtuozzo.com; dkim=pass (signature was verified) header.d=sashiko.virtuozzo.com; dkim=pass (signature was verified) header.d=amazonses.com; arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.onmicrosoft.com; s=selector2-virtuozzo-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=D+BXxlNCbrVIQTbuP2sWB5+7dKX4ogICfxf8usqxJOs=; b=ZpfRxheCRv11QeLtzjG01hkXgN1ayItOFTWN7kLZWh7WXWltcBAOqIYZ3vezdmeAIvC2j4qfJ8VQ/OebYB8kczm/WyfJ3TvaZrTwxQYj+E5z/ZvSufrYho7saUxHxs9n5vOEHQK1wSYdBfJgZ8+wOwgvF8AZLjn2FGoychciT7c= Received: from GVX0EPF0005F693.SWEP280.PROD.OUTLOOK.COM (2603:10a6:158:400::13c) by GVXPR08MB7800.eurprd08.prod.outlook.com (2603:10a6:150:2::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.615.14; Wed, 18 Nov 2026 10:52:59 +0000 Received: from CPH1EPF0000051D.eurprd04.prod.outlook.com (2603:10a6:388::1a8) by GVX0EPF0005F693.outlook.office365.com (2603:10a6:158:400::13c) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.615.10 via Frontend Transport; Wed, 18 Nov 2026 10:52:57 +0000 Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 69.169.224.2) smtp.mailfrom=eu-central-1.amazonses.com; dkim=pass (signature was verified) header.d=sashiko.virtuozzo.com;dkim=pass (signature was verified) header.d=amazonses.com;dmarc=pass action=none header.from=sashiko.virtuozzo.com; Received-SPF: Pass (protection.outlook.com: domain of eu-central-1.amazonses.com designates 69.169.224.2 as permitted sender) receiver=protection.outlook.com; client-ip=69.169.224.2; helo=b224-2.smtp-out.eu-central-1.amazonses.com; pr=C Received: from b224-2.smtp-out.eu-central-1.amazonses.com (69.169.224.2) by CPH1EPF0000051D.mail.protection.outlook.com (10.167.241.232) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.615.4 via Frontend Transport; Wed, 18 Nov 2026 10:52:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1794999177; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=uVLoQnwjBLCvHaVan8crd0iAk/TgQtTZwC/RvDvG+F4=; b=CdX1KpxxMqRNg/sJVSQU4yq2MxEz5k69UsXAqJ10yZLQSE3utc3ztuE/RHDHh3nd ywR3tou0s3c3jgxL1XHHUfkNVO6UViMkjVN0IwYY0KZZBqoe6VyMzX9OEWHJbzKbBcz +zDRwGi/s6Kz2l8OByEZopd4C8xBw9jPF1d52LTeUQfuZB3pcSFvo2EjvyFmtiWs+Ip 1yTpqkCyXtzHFtOdbok7dGCZ9gwv7GkrFvXY0W1Ql3VRGJoJymLQGgYSwLHyUf0my2B tfFZeAhGDpoXB4z6etMxT6DKBaVsdLIP8Nd2Imv+s+rnCKvLehAltrH+fES58vkam3k GpFjYspEpw== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1794999177; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=uVLoQnwjBLCvHaVan8crd0iAk/TgQtTZwC/RvDvG+F4=; b=fVxlF2G1nzwssn7Vi86+FxyH+RsZWGq90COhzCEclg3JhvixmuxJFz7YKpDZ1UZ4 aDosZxjL7JwvZ/bijzZe3/MxUtGdtweOOYZAVM1EIblfvRDmnhodzYcNVzIB5PtS7Ab fQTm8lP2Jr++JjjlDPlooFyZEFWho+WvCPkrij9o= Message-ID: <010701a1ee49cfe9-0a7cf54f-df79-4779-a3b1-935a4aaba950-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH hci-8.2] vhost-blk: advertise write zeroes with the backend limit To: Alexander Ivanov , andrey.zhadchenko@virtuozzo.com Cc: andrey.drobyshev@virtuozzo.com, svt-core@virtuozzo.com In-Reply-To: <20261118104654.3324703-1-alexander.ivanov@virtuozzo.com> References: <20261118104654.3324703-1-alexander.ivanov@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 18 Nov 2026 10:52:57 +0000 Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.11.18-69.169.224.2 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CPH1EPF0000051D:EE_|GVXPR08MB7800:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: e528e0a3-8689-4f29-cd68-08df45621b59 X-LD-Processed: 0bc7f26d-0264-416e-a6fc-8352af79c58f,ExtAddr X-MS-Exchange-AtpMessageProperties: SA List-Id: svt-core@virtuozzo.com X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|32142699015|48200799018|9140799003|61400799027|16102099003|22082099003|18002099003|5113699003|261009223027099003|4113699003|55112099003|13003099007|5023799004|56012099006|5063699009|261026121527099003|261028144727099003|10067099003|261026140227099003|261022105027099003|261021121427099003|261102123227099003|261022075727099003; X-Microsoft-Antispam-Message-Info: hfHOTF7ifj4jaRDIv/PAn4Bl/1bm5w316YV/ziZhRl2Ky6u3pTJdrtuaQv0tIYQbPbdamJSpdNj9Q5vBIz1AZe7mWuGMDDv251UVqZiiut21x+8I1rNATqaHmt+upxrlAtc9h/bjhzWCwxaJFGOkw0SUQljYe45eaLogMT/IBzdiFi1ADvS+gil9EVewUoc7ZbOtYmUPYUsGx/Hs9Cqy4/906NYHpkArKsDyKuMujCr4p1ueCajOBnxM6RB/BtcUaxP4J/nZGnK/DDwiRm1aq5Zoah+XkPkYccNMGXGAio3s6MJsU6J3j8BoJv9MoXO7IqaM0mcY5yAf7NSZ7fHw9csf7095D1zfmuwC3w2GrsJcldolSAbMch3+KbpBZbPZqfoFeinrwJbnU7CVbMFVHgQamjCiRklw4vXgyuySTWEWJgZB1YPtL9Uyb6C437HA7yaoXXdBBgpJVB0yhqATqSaPYK19ddbDIuw28R6C8qVhOPZQEI59t421tTn1XL8Z2lhZqGZY5TLTH2rpIS//fnyi10Q1eVThTo+uCsKmhu3K/0dZpW/jWJGqDe4ruLfvwHjtpwrUwVVhQ8s10dGAPeRKiSS53gLKMy5qYPqsxLi2dr0yT/85Y3cEttCCjYtZ7ZdbTnDFtgm39AyhYKYkWzvdUb4ZWnWBYkbijauXnV9z9EHU+vWGzS4bVBG0BU3/KDzL6aV+JLxwOu4x/mMB/GDY38qKJATw+C8SGZa9mzCPFRkX49twmk703y8Iq0YggkU04o35PQdti1OgnvpTGNyMkx0ADXJjOQ/daqwB4iUzuaE73vb01B/XKZHwq6PtKKSXQH6/4Xe4QVSFVnKxfZaY5htghltx4mJ7UYlI273RFfz+Czpl3bRY2ijFdc4WmglWtOfDzHsJbICISpDFnw== X-Forefront-Antispam-Report: CIP:69.169.224.2;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:b224-2.smtp-out.eu-central-1.amazonses.com;PTR:b224-2.smtp-out.eu-central-1.amazonses.com;CAT:NONE;SFS:(13230040)(376014)(32142699015)(48200799018)(9140799003)(61400799027)(16102099003)(22082099003)(18002099003)(5113699003)(261009223027099003)(4113699003)(55112099003)(13003099007)(5023799004)(56012099006)(5063699009)(261026121527099003)(261028144727099003)(10067099003)(261026140227099003)(261022105027099003)(261021121427099003)(261102123227099003)(261022075727099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VX56iIop5mOCrDg+kq5Fj/tJGB5oz2Eb2Y6zRmhj2/CtHcUsGzoPUGvs0PyxgGYLUpgRByuTB2olp5//eyqV/Wp5dYuUQK7pEVfVooxbjN8fA1WMf31pmqwYQ1GzEs8Lf4aJbl5iyat0CL6GRn3WJ4/xYTMSG2deQN+NWVyFHaDAcOaxiDFmOzvyxDx1z5fcOqpH/fis9Lshek6l5eN/2grJCGuNBx/ZQMMkOGSwbapxfWXK5Xxueh2jZpjsAGs2dORxkM6CB4Ihkl4e4DASv2uJXPxqF9xfewoGyc9312y7gZqV5/4J+T0lt778fF9p8/mV6jOQSyd1g/wANaSimqATvahIKIByZYL88PTCZvsZxbL01FjwBjtUnPyz5tEm23SqyeGQMTi9zOFuKnFeGGJwgX0pZUDRQsImhtnoGtLOSL7Y+87F/5lxwE9F5iqg X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-Auto-Response-Suppress: DR, OOF, AutoReply X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2026 10:52:57.6780 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e528e0a3-8689-4f29-cd68-08df45621b59 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: CPH1EPF0000051D.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR08MB7800 Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Low] vhost-blk: write-zeroes limit lookup fails for partition backends - [Low] vhost-blk: no warning when write-zeroes=3Don is dropped on read-only backend - [Low] vhost-blk: write zeroes limit sampled once and never revalidated -- commit 66e3eda6a649795c315512f6c2bb40ad45109264 Author: Alexander Ivanov vhost-blk: advertise write zeroes with the backend limit When the write-zeroes property is on, vhost-blk reads write_zeroes_max_byte= s of a writable backend from sysfs. It advertises that value as max_write_z= eroes_sectors, capped to what one bio can carry. It does not offer VIRTIO_B= LK_F_WRITE_ZEROES when the backend reports no limit or is read-only. > diff --git a/hw/block/vhost-blk.c b/hw/block/vhost-blk.c > index abddff02c6d92..8fe7a46d19166 100644 > --- a/hw/block/vhost-blk.c > +++ b/hw/block/vhost-blk.c > @@ -521,6 +521,23 @@ static bool vhost_blk_uevent_attach(VHostBlk *s, Err= or **errp) > return true; > } > =20 > +static uint32_t vhost_blk_get_write_zeroes_sectors(VHostBlk *s) > +{ > + g_autofree char *path =3D NULL; > + g_autofree char *val =3D NULL; > + uint64_t bytes; > + > + path =3D g_strdup_printf("/sys/dev/block/%u:%u/queue/write_zeroes_ma= x_bytes", > + major(s->backend_rdev), minor(s->backend_rdev= )); > + if (!g_file_get_contents(path, &val, NULL, NULL) || > + qemu_strtou64(g_strstrip(val), NULL, 10, &bytes)) { > + return 0; > + } > + > + /* The kernel issues the whole range as one bio */ > + return MIN(bytes >> BDRV_SECTOR_BITS, UINT32_MAX >> BDRV_SECTOR_BITS= ); > +} > + [Severity: Low] Does this lookup work when the backend is a partition such as /dev/sda1 or = /dev/nvme0n1p1? vhost_blk_open_backend() accepts any block device node. For= a partition, /sys/dev/block/MAJ:MIN points at the partition, and the queue= / directory normally exists only on the whole-disk node. g_file_get_content= s() then fails and the helper returns 0. With write-zeroes=3Don, the feature is then silently withheld even though t= he underlying disk may support it. The caller also warns "does not support = write zeroes", which is misleading when only the lookup failed. A read or p= arse failure cannot be told apart from a real limit of 0 either. Could the helper fall back to the parent disk's queue/ directory? Otherwise= , the warning could say the limit could not be determined, and the commit m= essage could state the whole-disk restriction. > @@ -562,6 +579,14 @@ static bool vhost_blk_open_backend(VHostBlk *s, Erro= r **errp) > s->conf.devpath); > goto fail; > } > + > + if (virtio_has_feature(s->host_features, VIRTIO_BLK_F_WRITE_ZERO= ES)) { > + s->max_write_zeroes_sectors =3D vhost_blk_get_write_zeroes_s= ectors(s); > + if (!s->max_write_zeroes_sectors) { > + warn_report("vhost-blk: '%s' does not support write zero= es", > + s->conf.devpath); > + } > + } > } [Severity: Low] Should a read-only backend also get a diagnostic? The probe and the warn_re= port() both sit inside the !s->conf.readonly block. With write-zeroes=3Don = and read-only=3Don, max_write_zeroes_sectors stays 0 and vhost_blk_get_feat= ures() clears the bit with no message. A writable backend with no limit doe= s get a warning. [ ... ] > @@ -775,6 +803,12 @@ static void vhost_blk_update_config(VirtIODevice *vd= ev, uint8_t *config) > blkcfg.physical_block_exp =3D get_physical_block_exp(conf); > blkcfg.alignment_offset =3D 0; > virtio_stw_p(vdev, &blkcfg.num_queues, s->conf.num_queues); > + if (s->max_write_zeroes_sectors) { > + virtio_stl_p(vdev, &blkcfg.max_write_zeroes_sectors, > + s->max_write_zeroes_sectors); > + blkcfg.write_zeroes_may_unmap =3D 1; > + virtio_stl_p(vdev, &blkcfg.max_write_zeroes_seg, 1); > + } [Severity: Low] Is it a problem that the limit is sampled only once, in vhost_blk_open_back= end(), and never revalidated? Suppose a guest negotiated a larger limit on = the source, and the destination backend has a smaller write_zeroes_max_byte= s after migration or CPR. The destination reports its own value here, but n= othing compares it with what the guest saw and no config-change notificatio= n is sent. The same applies to a runtime sysfs change, because the resize h= andler does not re-read the limit. The guest could then submit a request larger than the real limit. That requ= est goes to the kernel as a single bio and fails, so the guest sees an I/O = error. --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/2026111810465= 4.3324703-1-alexander.ivanov@virtuozzo.com?part=3D1