From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id F3F44803BB for ; Thu, 12 Nov 2026 13:50:16 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6ACDmsIU009655; Thu, 12 Nov 2026 16:48:55 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6ACDmsIU009655 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="ehQXJ3Zw" Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6ACDmrvZ009651 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Thu, 12 Nov 2026 16:48:54 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6ACDmrvZ009651 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-48c6a1d4034so3268101f8f.0 for ; Thu, 12 Nov 2026 05:48:53 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErFtV8rBOKJFcwaYisWDEU0x3LUYGOXTRbQucsPm+ltymOlJCH/PsP4nd0lxkGuC8pToFtlWrw==@openvz.org X-Gm-Message-State: APuU4Z8B35Gd/BbjUiZKMMnMKshvU4oGfO0eUJqZEUefC/Clg4aLqFri rk4+Y0NDQQrjVReNipK0ROhsGayzowROCe9SJfQDmPR5r1/KV+y9cxEOBr8DZhoDLXUQJT4wIgC Oyyc1FmOkZzM+l+x66zitqGwVmvMczpnNhMKPrQQjj9fNNL4+J9YaoQ== X-Gm-Gg: AYBFou1vSoHX1hSeHU95Ix3z8uVkCFHidcrUQz0EHrvMVutmnI+v+sfcbO4ZtShw4ec lv43J1uYYqxS8gaG9vfQlsegGDJ3bSwrn54ecVGb1m/y54pdqf5LUWKKMhaWMUiaEJu9MOZfRzC KPJFWeO4uAwgQ6Ev1oeOVLOHcKYqRj+aC9W8J0MHSD6PhwQZLI289VPdBZWYwnHBtMUBD/2rRl/ eYvyJsHJ8We2Cop81PyEDPzCsixfkz5jCOXPLjS1weY83+tFDp7iTQWEZLyp17Ug39ugSN2ki3L rsXIOwbRrbCTvrr/duT9er3xKCeyK7amWY1Doq4vWFea2wbaPZT5wRIkL83ii6e535H7mVokRNT PyQfXBaofDayYJyQi X-Received: by 2002:a05:6000:4012:b0:492:20e0:f666 with SMTP id ffacd0b85a97d-499c15132femr10995930f8f.0.1794491333588; Thu, 12 Nov 2026 05:48:53 -0800 (PST) X-Received: by 2002:a05:600c:3486:b0:4a1:d8fc:8165 with SMTP id 5b1f17b1804b1-4ba093b981fmr94436895e9.20.1794491322588; Thu, 12 Nov 2026 05:48:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794491322; cv=none; d=google.com; s=arc-20260327; b=HNnK5oU/CIvpaeanXBkelUZBUUZMlFS2G4VT9obVjicw6xKX8z37NtP7kJYaTsrpNk 1KhFGQcc6yxwQ7MHZl6V3Z9UcslQfGZLQlXsXFa13lQXVRnM32584f/AHWu5eMPSztZE 3aJyOZ1txjgks0DIBIvzqsVXKuwcRdMld3KvJHNi1SEKV7xsf+jHPwCQpZpJ4yK7ARXK 1fraLfSgDPBqvT1rndEchrvcPfovkshlcbi7wN1NO61J1jiRi1Z2ty+wQpkJv6DbU5Vk QI30MEgZG+EQCF7/tgdoR/AQElydUZIOncJl5eVpgH0hRPOFL7/UgOyG1ROXkj22IcOb neYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=message-id:date:references:in-reply-to:cc:to:from:subject :content-transfer-encoding:mime-version:dkim-signature; bh=PtSWuqgtRL1g3hrzwu7EBRjTrZ8l0Cu7PPQYkScQhq8=; fh=YDx/sgeCfUIZ9eyfBjqETg92hV70ladS2omuMPCV2do=; b=TjJL0n+l4O3yPq2nZZ7YZyi4EEoNgzjKlhPBU/tWgU9C7cfAj6nHYDHfOEv/pCJ3jn 9mKJemM53/2ybG5KXbFtgRelF7xkLq8KIAvf6Qfmf88L7i7iuIRA+WfCTd/5zt2Wt2mZ Dmc+eO3cNWffz/ZSzS/vWDhuTcvaXGq61elm7Oh4l9XjHpyi4wY53S4wDJ4UhenmngBp 8cJ70iotmS04DPyd8LW6j/Pa6iHhrBiHzmCwJFq5CmP0W2TRX+1bHGx5eM3mrDt4lbYV /+pf9rUjzH6/fIWDtIGFlkZ3t/ZndqK80EgtvemAI0zw4oVh0xjlN1YGt/pUbp756aIP /V5g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=ehQXJ3Zw; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id ffacd0b85a97d-498365cbf03si17431480f8f.256.2026.11.12.05.48.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2026 05:48:42 -0800 (PST) Received-SPF: pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=ehQXJ3Zw; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Message-Id:Date:From:Subject:Content-Type: MIME-Version; bh=PtSWuqgtRL1g3hrzwu7EBRjTrZ8l0Cu7PPQYkScQhq8=; b=ehQXJ3ZweKya EuxukR7wAYdftqtxqaoI9f4wgGWr1uQ92G4n37OaaICyY5+9uu70um2ZTi4uSo59d5m0J0yVi7bKV XriihZk/Gileo5mPOVv97Wdy58FgW3Q9KdlYbaEbtabWWuMqvHw0UI5qfudyhRgwMQOq1h/nIM7dV iPG5j76S24hTfFi664t/g7AmlwyU9bdzX6fZM5eGOs5oWk3Xo9qzT9TWMU/vRCpPuiLWmDSQRB9TE ANI8A42YfjAVCVWDIUxOhZ598xim0DpSuYgFuaxvLP19jqqeTpyuZO0TeF2DftCz2x4xgZ0mPtEiU PpL0jDliT1Ua8YhNpPYjGQ==; Received: from ch-demo-asa.virtuozzo.com ([130.117.225.8] helo=f0.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xRV6H-000IKx-0K; Thu, 12 Nov 2026 14:48:39 +0100 MIME-Version: 1.0 From: Konstantin Khorenko To: Alexander Ivanov In-Reply-To: <20261102113051.4190522-1-alexander.ivanov@virtuozzo.com> References: <20261102113051.4190522-1-alexander.ivanov@virtuozzo.com> Date: Thu, 12 Nov 2026 14:48:36 +0100 Message-Id: <179449131676.4060562.10013879144026497589.b4-review@b4> X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3083; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=2JR4dK5ZnqFkSrUCryS738MAhyD7jA2zrBPgwHC6RZQ=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBq9cO5kjvJFCxraBbGB+EWYhGOi1vdC2KrwnG/K 3kY9yWadSuJAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCavXDuQAKCRBRlgpH+WFc KlZMD/0ctlzPlQkjmn2k90Npvm749bK0C/TRsaGoVDRdkppTFnbYg1KjPVvyhM5WmXeL8EMU+a6 JG4LqhkeJ8UpRCW3sP5RaK9jjvq4zPxXImVhIQ0c6xA0j9JrChlMJM1DTTiEB5CzgEP4UNrH3Dq mbFsQ+f8Khyby7GreWRfoaOB1kQXCl+t50mYP5nFccoNZr1QCiY/V250LS1oOJTvtzEdtCg8Ok/ 8KHjYQ6cWe6fDXh1udlYHp1HLKL9UUeisk3DxLe7OLpcRfm8BZsGKL/gjOsSVKHeikHGqwVqS9f T3Da0xXSd/JFWzKzeZW/f6yDdQ0urJV/owL+6EpiUNckiIZOie7XR240k2Iq46rMjMNkw2wJrKG lWR57fG/CnLOCWkftDLqpuFLq+gLcfLQUtwFMnWCvBTDuP2+clwPucayRenPLFm72WGrRwdReoG w2s4ED+7wz/k8waROlbPRCIQ6o5oX263KEnD2OAMRStYSA/kBn05I92Yln7M+4rbK9pd6XI1Wo3 iyqKw3f982TIEgFNm89mTLIaLFgrPPrROmlTaANs9CJRpL38Q7TVa+783ifnJkuC1Xzks7kZKCh oHT6hsLCkgmpc5XDLLHkuf0b/ILxABj9yATOR0fo8tpE2Lz5VOCywQx9i/11/Z6wSmlf35bdwGC 4ClMYcZIGUtbKFQ== X-Developer-Key: i=khorenko@virtuozzo.com; a=openpgp; fpr=560F6DC83DC5D3D063BD082C51960A47F9615C2A X-OZ-Fwd: true Cc: devel@openvz.org Subject: Re: [Devel] [PATCH hci-8.1] drivers/vhost/blk: support VIRTIO_BLK_F_WRITE_ZEROES X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org I won't apply this version, please send v2 with the changes below. On Mon, 02 Nov 2026 12:30:51 +0100, Alexander Ivanov wrote: > QEMU virtio-blk advertises WRITE_ZEROES, so a guest switched to > vhost-blk may issue such requests and gets VIRTIO_BLK_S_UNSUPP. - Reword this paragraph: no guest of our vhost-blk device can get WRITE_ZEROES today, and a QEMU change has to follow this patch. - Say in the message what the VMM must advertise: the backend logical block size, max_write_zeroes_sectors aligned to it, and max_write_zeroes_seg = 1. Drop "as QEMU does" for the alignment check. - Use a much smaller chunk when the range is written with zero pages. - Make the commit message much shorter: what the patch does, what the VMM must advertise and the errors the guest gets, in a few lines. Move the rest to the cover text: the comparisons with QEMU, the BLKROSET race, why a submit error would hang the guest, the wait in vhost_blk_flush(), the WRITE SAME retry. For a single patch b4 puts the cover text below the "---" line, so it stays in the mail and the list archive but not in git. The scenario cannot happen with our QEMU. The "write-zeroes" property of vhost-blk is off by default ("not yet implemented in kernel module"). Even when it is on, vhost_get_features() clears the bit, because the kernel did not report it. A guest moved from virtio-blk to vhost-blk renegotiates features on the new device. The real reason is parity with virtio-blk. > part of the chain, where the virtio spec places it. > > Complete a range not aligned to the logical block size and a request > to a read-only backend with VIRTIO_BLK_S_IOERR, as QEMU does. The bs_mask comes from the backend, but our QEMU always tells the guest blk_size 512 and leaves max_write_zeroes_sectors at 0. A Linux guest reads 0 as no limit and splits a large zeroout at 8388607 sectors. On a 4Kn backend, e.g. dm-qcow2 on a 4K disk, such a request is not aligned and gets IOERR. The guest does not fall back to zero pages, so blkdiscard -z or BLKZEROOUT of 4 GiB or more fails with -EIO, where before the patch the guest wrote the zeroes itself. QEMU checks alignment against the block size it advertised, so it never hits this. > +#define VHOST_BLK_MAX_WRITE_ZEROES_SECTORS (SZ_1G >> SECTOR_SHIFT) dm-ploop, dm-qcow2 and most SATA disks have no WRITE ZEROES, so on them every chunk goes through the zero-page fallback: about a thousand 1 MiB bios, all submitted from the vhost worker with vq->mutex held. On a disk with a shallow queue submit_bio() sleeps on tags until most of that GiB is written, and with the default single worker the completions of all queues of the device wait behind it. A Linux guest never sends a data request that large, and a guest zeroing on its own sends 1 MiB requests that do not block the worker. 1 GiB is fine for real WRITE ZEROES bios; for the zero-page case a chunk of a few MiB keeps the worker responsive. -- Konstantin Khorenko, Virtuozzo Linux Kernel Team _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel