From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11021086.outbound.protection.outlook.com [52.101.65.86]) by lore.virtuozzo.com (Postfix) with ESMTPS id 121DA80033 for ; Tue, 1 Dec 2026 09:18:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kZvfSFSDCAXLtaoC3iTa5NXTJyofNHbyUoFpvoSZFRT2ud3F7RH6N7PcEPD4waWSbrQq7o0z1mibJiU1k58Bh1blqpAmENbZxMzA8FWA2/B7Ya7B9KX8oreqhRTNZgCC74S39vqoHmBF0seHW0hISGNsHMBidgSPbHDEsqvI0fQdI6LuVL5QNPu+Nw5SLyaTk+D/Zk0Fnq7P65gW6leuc+ahlKlCjHTgj2vGaq+w4d/a05toHSMBwZm8ZxumGE1eTw0WBEMJ87RFBG2E3smwbjG92HzfA5Bl9x6VU+ZoIV3pwm8+RSc+/d51msLC0ARt86xRp93Fof86CZcqtYsWqg== 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=HGhHMvtMB43c8J9L2MffBgbPtrlx3amO2VmLnHlaLfU=; b=HNMFORXevZtld2TqW4PfvnRQ99oyPYQl5/OqmkScjJDCR2Bp2YoG+1FaW5bjuKNtiLJ3s4bAewhXNl7IpxDFymhBH3xZmIK48ma16ow2aTh3Nsul7OesLDNZ71g9zJZOn1cs18t5fuVq8vmgPVDe8qGMstd8g4QS9ddRinFTzqWZJ8pFb0qIF9XlTAcDlKBwgvXCnruwbt88+yIOOGZlIY4Wyit2Ui/m8LKX0nGldYXPqIEJ9BL8KE3MeZVB26vQAWGJ0s8UOrfVMsuo7pHpWgiHZcAMbCLw47oVweFYV4JorgUjeGBUhjNFqw3qi6rGsyYHCFqHm8gcdSphzig3Gg== 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=HGhHMvtMB43c8J9L2MffBgbPtrlx3amO2VmLnHlaLfU=; b=wdUdlgzmg1xdzFplPDTJK0+EdxLI42au8O5wqIy9piYOclv7vMzu9iPgPOlK+6FEkJePtSClX7h1F4khVOOj2qzjVvWHFanfKshKmMSoGLC/TDykO2uIZkf+yvejmx/0fGbtFpGrzFYPFKdg5XrOQ1/Uwx9xFiXT6R8X6T+trX5XClZwkYWmZsi9OXz9hDK4CBg0u01biTdzsDss/cyR2UkaNAtyV1QXqjAP5hY92HXFbnowCgzv7YBFsdtwl5ASY0RTFOMZ7TmqDCBOAshwF+8d99zV9Nts2j7dn18cqR7ik5op3kqIBctBLBUkGbYYc6n6rvIwl1oPbpXeog1mSQ== Received: from LO4P123CA0036.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:151::23) by AM0PR08MB540638.eurprd08.prod.outlook.com (2603:10a6:20b:7f9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.13; Tue, 1 Dec 2026 09:18:22 +0000 Received: from MI3PEPF00008551.eurprd05.prod.outlook.com (2603:10a6:600:151:cafe::79) by LO4P123CA0036.outlook.office365.com (2603:10a6:600:151::23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.662.13 via Frontend Transport; Tue, 1 Dec 2026 09:18:22 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; 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 MI3PEPF00008551.mail.protection.outlook.com (10.167.240.5) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.5 via Frontend Transport; Tue, 1 Dec 2026 09:18:21 +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=HGhHMvtMB43c8J9L2MffBgbPtrlx3amO2VmLnHlaLfU=; b=t1fN6tExOyVo Klm6aECG7cz3ZH4SISlZg+RUQhByttMO6qZULQVJ4CkUcQ4Ib+ZMn2Lwt+MTux29jrgOCGTYuAaW9 I9RiuYSBANvI8m2k6sHBeqMTltJPuRiyAVK8cJTMvwvU/TGfAUBFiz4jAaArmzcZ7PNPDqUgAqPPH xUi5weIzT4l+F9VzqSrX63J6K7evF846XnKl3FZamGwIfSwfpEgaiKrVGCCByvzAgvBAPoBaOzp4E iriLdKxEPsF8t+TKBPlkKWGn34fmGKO3QR2vDvUHVdKFz7mt22Zwhkmbn/0RXGCvaCS2MS0vO4EFh /UEftRZ1C/h+UaTB/tyBWQ==; 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 1xYJzt-000oEp-0I; Tue, 01 Dec 2026 10:18:11 +0100 From: Alexander Ivanov To: andrey.zhadchenko@virtuozzo.com Cc: andrey.drobyshev@virtuozzo.com, svt-core@virtuozzo.com Subject: [PATCH hci-8.2 v4 0/5] vhost-blk: support the werror/rerror policies Date: Tue, 1 Dec 2026 10:18:13 +0100 Message-ID: <20261201091818.1894308-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: MI3PEPF00008551:EE_|AM0PR08MB540638:EE_ X-MS-Office365-Filtering-Correlation-Id: d943af61-dbe1-403b-4ed5-08df4f8c0b8f 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|82310400026|376014|36860700016|1800799024|23010399003|5113699003|6133799003|261009223027099003|18002099003|56012099006|261028144727099003|261021121427099003|10067099003|261022105027099003|261026140227099003|261102123227099003|261026121527099003|261021123027099003; X-Microsoft-Antispam-Message-Info: vKiE/GpQrbtRNRPhrE5z6IJm74Taj/kGAFiZ5xGDyT3+naxC2Lp4EwunIHGXhO/zbGn3sWIh84ZttRcKd+fONqYglpACpoykwaVDtIJ3qx6UfPB9TxAnzeukKpyZ0DAOsMkTaWJshv2vDSn29gN14oaPcCmpHJKg39ee9GdafnimANk1mhHbwqlInI2VH6tacUnljSYnvScMjXMxrPrRNFhcnt5KKhaik0vVVuNfflatG1lPJRGgfDPbfha+Th1MhPKyYVFxiv6PEZq+SNOrniLHGZ4GC5aGkj+XT9a6LC5xSqDN7WtE2HEQH4yfaGmeY1p9yzgdF2OwkE170lCRBuIgTh7XyaGwU6qAjwDre/Enih6jRAOhthU331l20n5hnoVMct/tUnWt8Ax6Zo9CRmBJ/Y4bCQ36+XMVdwLAoyBf74tRQkuqEv35NJzq4mWlY1TODQWJaQLSgt84OglDLpZmplIzlnURxsf61bicm/Ry7dqsZrNjtGC+Wo+OQc78SZIkYcGAWS8FmS1viCxRbtf/uhLPZEVsWThQXTWLAPS90W4lBK0nCaB1a3h/27xJwHM15SFG1LiZO4yEUqhxKZb41a7LM4KH0GVDgIktT1ik6Rk5DQJjeH1kgmvq+N6zlDArGjJb2YkWZLanEHJ93Q4wHT1qpgZJe8Wv2IIrLMo= 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)(82310400026)(376014)(36860700016)(1800799024)(23010399003)(5113699003)(6133799003)(261009223027099003)(18002099003)(56012099006)(261028144727099003)(261021121427099003)(10067099003)(261022105027099003)(261026140227099003)(261102123227099003)(261026121527099003)(261021123027099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oxKl6mw07y53SE/IUpAvQd7oSORNwSeVNYAAdFQt0idc2KdXiKwM/7Ih7Lk2xmjIXYydUlbNTtxJQevix9IjhtnwWU7M3+Q14FUHeFtzCIIGUT+VE0J6v00bpvoSmiZAyNWiWGrI3GnQmFZYiy19wQDu1VcY9D4Jle9XjyNQPDPuSchtcytF8aeDxSksRzXcr+6C17+gFakzYPDCB3WyxJz1HqcBvEcgYLTOjF7qeJLe/g/57Ntvsj4m26Xmvd4mdjCmm/OMIOhuIwfZWD3bA7UXGP4e/br0ZuDXaxSiUbQt/8B3gdxXqjTRa33R4Zjn5Q5a08EGr5JYaGcK1hpjisEVxFoWrIAhc6yrnxJX1sQGW+KwUUTmzvW2LSJJQ8uvYiO8uiUka73OevBrG91WtQoBqSemBedKG0Arp37cW1W08UbbsWm6XGAzJjrz/wVM X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2026 09:18:21.5775 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d943af61-dbe1-403b-4ed5-08df4f8c0b8f 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: MI3PEPF00008551.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB540638 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. v4: - patch 2, 5: add Reviewed-by - patch 3: add the Fixes tag - no code changes 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