From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11020077.outbound.protection.outlook.com [52.101.69.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 46FC4802A5 for ; Tue, 13 Oct 2026 15:51:01 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=d5QOKIMtI++Rt61jGaN+gHjf0xZS8lp9HaD+pRV0O0FDNhVjc65VHKSJMDLVdXH51yFVtCbfsRKpHeHmV4zlp7TH8tnzZIVj2zEVvuPOOhXigReKVjksGxh/wMfgyHWL0ALzJq87ima482IDXF6QdLBbTuJNsePt7pRCj4H7LlWW6QRxLIH8MzU/zIWmc+bA5crD1OAbAqYBj0/nzn0u5jBOv5aDq5oNgPTimy7PqYPGdp1wL6TvhLaljCYKwp2lThZcj0+Sdp67h4PaSg+g8/EZhCUIgveb8lrf9toI68gLYbgBauF3SDH8dKr0rAPwSiZwlKbPnEsIxVaQycPanQ== 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=7/bVU/N3gaCRBDME2vJ/6XgJn1dJCYNuPZFkbMuAvl8=; b=hKUBRE0z1nMYcjaBmySqPy62vgr95BhiFjYMkAJL/y9UGtm8JNr7v0XgSSAycYwoh25KNfm0+VoIAsCSEqwyu5kpd/N9ldgTuuhzWUp0T8AcOI3F8Lm0zAoRlaoED8W18XyzLNw9ewHx9v3TqNPtIvKOfKJjUcKkKCJUd7te/tPeX2YrPQSCZXgCeQbLzDuHXlkJ8jTVUTo/L3aswB6Z1d5CXDzN453yHAfwNi4LoiH4iiCUVubFtyADfsyCZpwT+MqpOmnk9W0PtSBsj+l+ShAGY3c4OXCYus/9THiM5yLAlnqubL06zQtYiwzRGaDuUvyiw4bc7IiRf77fVExYCg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 69.169.224.5) 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=7/bVU/N3gaCRBDME2vJ/6XgJn1dJCYNuPZFkbMuAvl8=; b=Ab3FiB+C5I1XCEtLq0TJ1nNtSk0zHvW8G7GrcY0pVJ8PjNODO3yrrb43o3KAIh8QWY+ZOEKtgifhXrc3cddigybqVxWxsOkhus0U52tlynINz+lXOgL1KkUd1F7/Lqwh7Qujjqa0jLDpaDYNBfWJm6ZKbbJ1QZ83l6bPvUQ5PcM= Received: from AS4P192CA0017.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:5e1::12) by DU0PR08MB7639.eurprd08.prod.outlook.com (2603:10a6:10:320::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.522.12; Tue, 13 Oct 2026 15:50:55 +0000 Received: from AM7PEPF00000052.EURPRD83.prod.outlook.com (2603:10a6:20b:5e1:cafe::a7) by AS4P192CA0017.outlook.office365.com (2603:10a6:20b:5e1::12) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.472.20 via Frontend Transport; Tue, 13 Oct 2026 15:50:55 +0000 Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 69.169.224.5) 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.5 as permitted sender) receiver=protection.outlook.com; client-ip=69.169.224.5; helo=b224-5.smtp-out.eu-central-1.amazonses.com; pr=C Received: from b224-5.smtp-out.eu-central-1.amazonses.com (69.169.224.5) by AM7PEPF00000052.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.546.0 via Frontend Transport; Tue, 13 Oct 2026 15:50:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1791906654; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=2l3vwITiI1Oh6aq/FAi6e2JJtCFgNhVM67whUEeLoPU=; b=rBbbNH2P4p4s7ubegkoE03OmGEc+hlChUgjVqH6B2sEhoY87RY9MsYqKxHEuWtK2 H6Gwjl2j8TXApghhAy9JaCBuOsg8oJuQXFl5bbQIrWWa6D6Ov8Y0/X9A59mpQz3RM4G biKhvZT4XdnmlpF7NozvsXd76LTRK8E4HJKVNN0yTVR0i1bCI1QslVwpJCGK3jV6XNn P3TNLb60jDFu7UIRjygOgvN2Xm1FvTld0kHbN8lMF7SutSH/ftI2fbzJr5SdvkMCL6U bsel9aUigiiRWGWZkLpbZ3051D4wImoVBB0cqXX1XGWeY7RfEqwqZ051eN/JfMabBCF w1WVH+INiA== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1791906654; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=2l3vwITiI1Oh6aq/FAi6e2JJtCFgNhVM67whUEeLoPU=; b=eD7WTjNLXkr4dFkqL275mJ9euJat+4gqxaizanrNlt291LRRjmnMlIFwV4EDDY9J QojWEr3WJnh/lAX653W9swU7sVLcmp3uBMly+iY0MH22ankFYFYELVxervOkI9G9F4M 4E/l7hcXwQkdqYZ8P1yVjusoCtHf6wTcHXBTtxC8= Message-ID: <010701a135f5a893-bcf5461b-5ee3-4135-b4f7-2772666bfe14-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.1 v2 19/24] vfio/listener: skip dirty page tracking during CPR To: svt-core@virtuozzo.com, Andrey Drobyshev Cc: andrey.drobyshev@virtuozzo.com In-Reply-To: <20261013-vfio_v1-v2-19-433455c0a294@virtuozzo.com> References: <20261013-vfio_v1-v2-0-433455c0a294@virtuozzo.com> <20261013-vfio_v1-v2-19-433455c0a294@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 13 Oct 2026 15:50:54 +0000 Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.10.13-69.169.224.5 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PEPF00000052:EE_|DU0PR08MB7639:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: b37c546f-3e3f-4c64-cd39-08df2941c405 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|704161411799003|704161111799003|376014|61400799027|32142699015|48200799018|9140799003|10067099003|56012099006|5063699009|5023799004|4143699003|55112099003|16102099003|22082099003|18002099003|3023799007|13003099007|261009223027099003|5113699003|4113699003; X-Microsoft-Antispam-Message-Info: f5bV5lKVL8JL/pkcCet7G5whHdOvzxalYG+UbDDnfUciAtVbQtiSMPFmGrJPnZVBcbLXutrpY2Tjo8B1FFXVNpFMbnFfrvFIogCeC24zrI2Ne+90LblIjhZs1S6RQaBA7GNcZr6e32SFOZkFWnTbyc4mJrlvxFCDvcxVlDwap5ETefymKJ5kpm6CphTQ2vuYVNX4vT2SNYkvaFBgU/Mkwa4WAXRKlNP1LGN47FVct5Jg/BZRzKpgfWBwjnW3MrDclV+DKmXu15G02ID+KogWkpCtTrNUQ2aeb6JsGJ5klOxSXjiXtbxvaZuTUPsNcWZFsOjgNzSiWyzLKXF8bzGL0SbIJuUJ9pL42DmNx7OaS6gEO8z4E30hcidi7qoEadwcqEY8o9TB8nQbE9WJIlSjhcfo92vK4su3WGuANc46IUwBEzjpVHGzWHVx4y0XOTnAFjYHh75zIUOSGw/2p5Hgy7c4HB0U2PwEONM1/P7mna5kTwv+aLPXU0vNa0BghM0wt/590FVFCMHckN3BC94ra/9VWEA19UTIBrsRiOJK8myLts/ie12vGI/KgO/noD6Gq83R+pS3PpbVxu6rNGbrk6z+FX0EVuO2qQ8Xb+9IGcHJmAYjaaVsHp8dIXK4Danp5+LyNGPCTJKBp6rq7lLl1baTef+leBLLCUa0+A+erohU/Yednay0ulrwI7m/eww5EyEEjD4Rh/VxNVOiqM27ch6D7XIvfZZ2CbkIDND2v48k3A21zQTuCBG9RUFHPV9adh1Q3Mvr7Mrk5w9qDfQmMlYjWoOehEeGgICn7yerwEmZlQ7T7NvNGFd2IQ7/UGCW X-Forefront-Antispam-Report: CIP:69.169.224.5;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:b224-5.smtp-out.eu-central-1.amazonses.com;PTR:b224-5.smtp-out.eu-central-1.amazonses.com;CAT:NONE;SFS:(13230040)(704161411799003)(704161111799003)(376014)(61400799027)(32142699015)(48200799018)(9140799003)(10067099003)(56012099006)(5063699009)(5023799004)(4143699003)(55112099003)(16102099003)(22082099003)(18002099003)(3023799007)(13003099007)(261009223027099003)(5113699003)(4113699003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: R6FBUWDmuXDZWvFh7GRyjsHVtxRLPfJqfYFP6Q5yhNKUTw6xVCCNlfgQNnGcXbGRv5uDgLG7BKZoaUwEDc7xld5eNk6X6PwGN43knEap3zCg6llF45f85kHSF3NkPWaEvHU2drUi6ahruk3ZjYeJQCq9E4mGnjwnc1v4n7WM5XKZhKGIcceL2Q2vOhrHcYcBdyoQ2Wm17fwy6GyEOnGRg5KeK3CrH2UFVlSEUyDvEui0vNM5qTELIDrILUhTJba4Dp1ZBlGDsnYRsBGQ/p8Mr0kMLpopNzcE1QdPQ3wSGYNRakak2y6ezRkFsGFXG/Fu0twjdJGpE7j9NntVAKPt8DiJMJImz4eBG2AfY9/UPapuSeo6aPOnNG0c+VNe+qbZe+64wyN8LG2PAHN3CxfIolnNPWxaj1Uo6wI9r0+UnAMf9kLDCQu+upfGBO7PH3ZH X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-Auto-Response-Suppress: DR, OOF, AutoReply X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2026 15:50:54.7587 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b37c546f-3e3f-4c64-cd39-08df2941c405 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: AM7PEPF00000052.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB7639 Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Medium] vfio: log_global_start skipped in CPR mode is never retried when= mode changes -- commit 29c28bad6094fa55255321af5424128d0b541ec1 Author: Andrey Drobyshev vfio/listener: skip dirty page tracking during CPR This commit makes vfio_listener_log_global_start() return early without starting VFIO dirty page tracking when the migration mode is cpr-transfer or cpr-exec. Stopping dirty tracking is left unconditional. > diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c > --- a/hw/vfio/listener.c > +++ b/hw/vfio/listener.c [ ... ] > @@ -1012,6 +1013,11 @@ static bool vfio_listener_log_global_start(MemoryL= istener *listener, > listener); > bool ret; > =20 > + /* Preserved devices keep DMA-ing into preserved RAM, nothing to tra= ck */ > + if (cpr_incoming_needed(NULL)) { > + return true; > + } > + [Severity: Medium] Can this early return leave VFIO dirty tracking permanently off for a later live migration? The skip is decided from the current migrate_mode(), which is mutable state, rather than from the reason global dirty logging was requested. The listener callback runs only on the first transition of the global dirty flags: system/memory.c:memory_global_dirty_log_start() { ... flags &=3D ~global_dirty_tracking; if (!flags) { return true; } old_flags =3D global_dirty_tracking; global_dirty_tracking |=3D flags; ... if (!old_flags) { if (!memory_global_dirty_log_do_start(errp)) { ... } Consider this sequence: 1. While migrate_mode() is cpr-transfer or cpr-exec, some user takes a global dirty flag. calc-dirty-rate in dirty-bitmap mode does this via global_dirty_log_change() calling memory_global_dirty_log_start(). A CPR migration that is still running, or whose stop is postponed, also qualifies. vfio_listener_log_global_start() returns true and starts nothing. 2. The mode parameter is changed through migrate-set-parameters, or incoming_mode is reset by cpr_set_incoming_mode(MIG_MODE_NONE) in migration cleanup. 3. A normal migration calls memory_global_dirty_log_start(GLOBAL_DIRTY_MIGRATION). Since the other flag is still held, old_flags is non-zero, so memory_global_dirty_log_do_start() is not run again and vfio_listener_log_global_start() is never called for this migration. Would VFIO device DMA writes then go unsynced during that live migration, which could corrupt guest memory on the destination? The path needs an unusual mode switch while a global dirty flag is held, but it is reachable through QMP. The series-final state does not change hw/vfio/listener.c or system/memory.c, so this is not addressed by later patches. As a secondary effect, calc-dirty-rate while in a CPR mode silently excludes VFIO device writes. Would it be better to base the decision on why logging was requested, or to make the start retriable when the mode changes? > if (vfio_container_devices_dirty_tracking_is_supported(bcontainer)) { > ret =3D vfio_devices_dma_logging_start(bcontainer, errp); > } else { --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261013-vfio= _v1-v2-0-433455c0a294@virtuozzo.com?part=3D19