From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from PA4PR04CU001.outbound.protection.outlook.com (mail-francecentralazon11023130.outbound.protection.outlook.com [40.107.162.130]) by lore.virtuozzo.com (Postfix) with ESMTPS id 746088006B for ; Mon, 30 Nov 2026 09:42:22 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Wj8JP9k3ITO9D6yhD7rPtSo23n/EkwybfKZ1n63/4B+UrKke9RmNQ4A8Qa75djQEOO1qJFD5/Bul2YLCHItrHZ9j8NSag9OPOormxzz5pXVuekjlLninq1hI7G79abizXQGQDH1JwL2clZ+96lXGr6W+sx2FDM1WoQ8i5Vaccqr04CPVOHBAkN+OJISmYRE09PeC/7ZjocwJ34JpLB3yn1c7JCOG46s25ks/YAGgm+SNeA15mVe6WGo7QnBwHJIzHM398vtWpox3i7IkWgnL6bVrIU3YSDO900jgfAkfEbq/MOy91XlnjKgtUr8M4yWf+e+XlCoZCYCg8O9STXaSog== 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=1Gqp/NO2zK3138TgekgkivWKCcwD8kvFYnt71lkAP8g=; b=LAqBBOiludBCyFKmKe9XsoFhUQQHnJTr2ZmIXsdqD47ZVPWZAO0C7wjJK2n6a5r3fQ3QSyDYocPJG+Rf98Rjw4JNpOcOVnAwPBEbtbEkwOsxasT2lmJFyOAxEBo7FPDCCvw+PVMJekgusaryErOWN0msv5WgGNnobvw73/e7tidlxuyzDJuyZYA5p7QWTpuuOcRJJhoPrvklD7k2GRHRT3UylL9/phcWyU9uMQih2eX4TWPTnIy3nnsfUEiZENtav6hysOBKm3Fjlf38+JLK+AFEKvXbECj+ofpmDyabwN5ruOfboSQXsJxz6dTRDG4hE4ayXAjd3hez4G/1MA2Rew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 130.117.225.111) smtp.rcpttodomain=virtuozzo.com smtp.mailfrom=virtuozzo.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=virtuozzo.com; dkim=pass (signature was verified) header.d=virtuozzo.com; arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1Gqp/NO2zK3138TgekgkivWKCcwD8kvFYnt71lkAP8g=; b=GdJAxwN6Le/IY/1W7YhSd2TS7mr7/HXEanbwY25YZc0M8MO4lP2hOuUsvMIo7K58AFiHorlR9HMB55FIH6TgBawP4Hn/UbIZMXm7P9a60MD26BZNhOlxv2SnEqIAbMhRungAEQ2PsDwo0A6W/6OvsqbXbmR7r9ZmL96HiapuBNrTuEapzTUNQnRRPe0NQkRaDQdsepn68nsKTxlaIFo529GYBDt2mWRbuFCpxHdQ3eiiBz7/qoPmtNGeuJXMr5C31tyvS6znFvdau7qrfjdWq3Rl/4cpwq4Ie9+NDEEewGs/iKMTK0miu5VogRSL3nKuzNcqGNmWWBGu1lUCUlTjCg== Received: from MR1P264CA0072.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:3f::13) by DB9PR08MB11463.eurprd08.prod.outlook.com (2603:10a6:10:607::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.12; Mon, 30 Nov 2026 09:42:17 +0000 Received: from MAD0EPF000008B0.eurprd04.prod.outlook.com (2603:10a6:501:3f:cafe::4b) by MR1P264CA0072.outlook.office365.com (2603:10a6:501:3f::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.662.13 via Frontend Transport; Mon, 30 Nov 2026 09:42:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 130.117.225.111) smtp.mailfrom=virtuozzo.com; dkim=pass (signature was verified) header.d=virtuozzo.com;dmarc=pass action=none header.from=virtuozzo.com; Received-SPF: Pass (protection.outlook.com: domain of virtuozzo.com designates 130.117.225.111 as permitted sender) receiver=protection.outlook.com; client-ip=130.117.225.111; helo=relay.virtuozzo.com; pr=C Received: from relay.virtuozzo.com (130.117.225.111) by MAD0EPF000008B0.mail.protection.outlook.com (10.167.241.132) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.662.3 via Frontend Transport; Mon, 30 Nov 2026 09:42:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=1Gqp/NO2zK3138TgekgkivWKCcwD8kvFYnt71lkAP8g=; b=LjCotvSN/7Aw xc581FStg2xVOpBq5GRhwtb8WUXJK8aFkFgwlHV01fnVfVL0Yb6o7+1s45cwl8sHH81HnL1zAWqCJ bCK9iQQ7ljoH63Al3BjsxFIFlxmYz7OMs23NiB8UyIbbRHBBndjKuc2e6q15M/migeX2ZE6m53cZ5 LTSSqdGL86ECSW2oDnFIplx/sQmcvw7yS+dMp/9I9Ln0v1P000z2K3NWxkNyvo4SZN78C5Zd2GqWA 6RERfy7mg7KLyb1LFvC2YY1WVhWTJjPgkoWLAjJehiTAu1BzeYyy6rVzJF5zg6ktxT1nJNS5bW9ra D+MYngzq7l6EMVFrEJQkYw==; Received: from ch-vpn.virtuozzo.com ([130.117.225.6] helo=sky) by relay.virtuozzo.com with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1xXxtS-0098YL-1a; Mon, 30 Nov 2026 10:42:05 +0100 From: Alexander Ivanov To: andrey.zhadchenko@virtuozzo.com Cc: andrey.drobyshev@virtuozzo.com, svt-core@virtuozzo.com Subject: [PATCH hci-8.2 v3 0/5] vhost-blk: support the werror/rerror policies Date: Mon, 30 Nov 2026 10:42:05 +0100 Message-ID: <20261130094210.1686802-1-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MAD0EPF000008B0:EE_|DB9PR08MB11463:EE_ X-MS-Office365-Filtering-Correlation-Id: 42ffb6ee-19a6-4399-1cd8-08df4ec6371c X-LD-Processed: 0bc7f26d-0264-416e-a6fc-8352af79c58f,ExtAddr List-Id: svt-core@virtuozzo.com X-MS-Exchange-Transport-Rules-Loop: 1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|36860700016|23010399003|1800799024|5113699003|261009223027099003|57112099003|18002099003|6133799003|13003099007|10067099003|261102123227099003|261026140227099003|261021123027099003|261021121427099003|261028144727099003|261026121527099003|261022105027099003; X-Microsoft-Antispam-Message-Info: U35vKLkCSFxkTT4sL5Eiob99IwoSm3eH9TLe6GSfFMfRvHKjI7clrRpf4/34GMLlV10/+mC42Urevg0DOWUSOizanDBZM7HL5B1N5Ck/XTt4q8808fQH6nq40tMfGhz/ECpTGrNKE8bB4HtVWrx/YpusVDhUOA4cDZLNc5ON0u6/yowifqgNnPlEmHLfCT8RLYFzNXnbsheTtcftj+je73SNwvg0mDDPkWw2ryLh87yY1oHNhLunscZOUhiXTMeDCCexSJamxMP4V78A3Pz7YOQUgMYEvVAeUC/aFJbH5axyXhFLFBkoQANdnP1iUp4rx8eeKWSSZQbyLLr6HcQ4aOL6p8CLdn1NhLAb82NF6iCOP1aBg2qzmjNbwTgbtdTli/+gMkSZ+wgitEK3hK3auqEJ7FDPVyv/peoKw8SdKluCOKsf1a8etSDms0mjVPlHvHtRy5GyWGh8IKr1VpmfqkrGlYE8PCeLPV+e49UO8KuRovwXPQMtcqOWiYI6nuhifYiPEdmpKLGbwS5kNnDc7o1+zAMQGMoki3+YZI8o6Tcgg/K5UtPU2n0KcQKK70T8vOO9sJkZtzIZcNGnNvw6twlTuST0aPW4+zJKsiSRpzz7G0zGIQUjNjX6QHdB7VIdBCmwondNq8Z+LxdD8ems7PJUCIQwYR1Hg58MNjcbOiHaiSoNcSNj6Veirh7OcxLYV3RlxRk6In1A0qg9h2IXAQoBZxhaQXxyr2pxoIaVpg6TfC3iHl+uFlAmBsg/X1DDRCLzEGW/dv+ItG32e4HotrkbTzitldvLQ7naLAZtcBWV7akOHsf1wX5X1KFsK7ExV/ms2IbEPybC2ivUFYWfWlY1VHSkitCviFZyTlEEOrkJ1sA6HhzsVNZKRoK4suCZ X-Forefront-Antispam-Report: CIP:130.117.225.111;CTRY:CH;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:relay.virtuozzo.com;PTR:relay.virtuozzo.com;CAT:NONE;SFS:(13230040)(376014)(82310400026)(36860700016)(23010399003)(1800799024)(5113699003)(261009223027099003)(57112099003)(18002099003)(6133799003)(13003099007)(10067099003)(261102123227099003)(261026140227099003)(261021123027099003)(261021121427099003)(261028144727099003)(261026121527099003)(261022105027099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wLRssSpg9KPnx9UU6j23fZErgc851dZSvJ60E83NHAc6BKP0F/Zb7xFfGeI4TPfcb264mHdkgz779ESwt7JfA6+h6nViCTQwlOKVrKjWdmPQkHO7fT9h+OCY+mSiVkEjXpdwg1J5XjlJiEnELeMLjAaqAx3PQ69ZLhBqi8H/3l/yKyc8tLDVqtGNASggtaSDLwrwR3Sm0rHZ2RnzFn2vZ+fXdeI/eBj0ltR/9Z1CohwrCArJQgbIPH3HS3vLZYI8+IGkynxksvBzEWKhWQ8rxSSXvTb/WqS4k3dtKREfCDIviNu4uNYXFcizikm6kBEspGXExIx0M4UYQLFYCwbQgaDru8EHbyDzyzZ27iLmHUcMZDzrq3QZR08mIJI9NU20AYyM0bHpcnyXs2Zp2eFH0MVM57zJWceW3p4SAeTE+S/VCG4bhAXAzdVtBOauNCWR X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2026 09:42:13.9637 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 42ffb6ee-19a6-4399-1cd8-08df4ec6371c X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0bc7f26d-0264-416e-a6fc-8352af79c58f;Ip=[130.117.225.111];Helo=[relay.virtuozzo.com] X-MS-Exchange-CrossTenant-AuthSource: MAD0EPF000008B0.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB11463 A vhost-blk disk completes requests to the guest from the kernel, so QEMU never sees an I/O error and the werror/rerror policies cannot work the usual way. vhost-blk in the Virtuozzo kernel can hold a request failed with ENOSPC instead of completing it and signal an eventfd. This series makes QEMU accept the policies, pause the VM on a held request and resubmit it on resume or after a migration. Patch 1 adds the UAPI of the held requests. Patch 2 adds the werror and rerror properties, which libvirt passes when the disk has error_policy or rerror_policy set. Without them QEMU refuses to start such a VM. Patch 3 stops vhost on every VM stop, not only on pause and at the end of a migration. Otherwise the device state saved in the other stopped states is stale, and so is the list of held requests. Patch 4 sets the hold policy in the kernel, stops the VM with the io-error reason and a BLOCK_IO_ERROR event on a held request, and resubmits the held requests on the next start. Patch 5 migrates the vq and head of each held request, so the destination resubmits them. v3: - hold the requests in vhost-blk instead of dm-qcow2: the IO_ERROR uevent is replaced with an eventfd, and the held requests are resubmitted with an ioctl - new patch 1: the UAPI of the held requests - new patch 3: stop vhost on every VM stop - patch 4 replaces "pause the VM on an IO_ERROR uevent from dm-qcow2" - new patch 5: migrate the held requests instead of blocking migration and savevm - patch 2: update the commit message, the code is unchanged v2: - patch 1: accept enospc as rerror, add Reviewed-by - patch 2: stop the VM even if the event does not match the policy of the device, with a warning, as nobody resubmits the held request otherwise - patch 2: ignore repeated events once the held request is reported, as the run state stays running until the main loop handles the stop - patch 2: if the VM is already stopped, block migration and emit BLOCK_IO_ERROR without requesting a stop - patch 2: ignore the event while vhost is stopped and in the suspended state - patch 2: accept enospc without ueventfd, as it is the default The series applies on top of "vhost-blk: support discard". On a kernel without the held request ioctls QEMU warns and runs as before. https://virtuozzo.atlassian.net/browse/VSTOR-152175 Alexander Ivanov (5): linux-headers: add the vhost-blk held request ioctls #VSTOR-152175 vhost-blk: add the werror and rerror properties #VSTOR-152175 vhost-blk: stop vhost on every VM stop #VSTOR-152175 vhost-blk: pause the VM on a request failed with ENOSPC #VSTOR-152175 vhost-blk: migrate the held requests #VSTOR-152175 hw/block/vhost-blk.c | 275 ++++++++++++++++++- include/hw/virtio/vhost-blk.h | 9 + include/standard-headers/linux/vhost_types.h | 18 ++ linux-headers/linux/vhost.h | 31 +++ 4 files changed, 329 insertions(+), 4 deletions(-) -- 2.53.0