From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <010701a19beb9859-5108e892-4da4-44db-bb67-3d510e97ff9c-000000@eu-central-1.amazonses.com> Received: from AM0PR02CU008.outbound.protection.outlook.com (mail-westeuropeazon11023079.outbound.protection.outlook.com [52.101.72.79]) by lore.virtuozzo.com (Postfix) with ESMTPS id 9052F8017D for ; Mon, 2 Nov 2026 11:01:15 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LPFsEqgqrJeAUFcvFD5aCvt/mbZOrhdqOOUv4PVAJheYeqQ5ciRJEEEF5AuI7aALQw7bkwooQuGYsNuoUm3JIc5p2rQDL7M3Lpeq873Mi7iPXFrSnoGt03ABUgwTrOaHb7Sk70P8v6fUtJDEcackfiIP2ucTH39HUbHz37UM+gtBIs3Z0J7NFlyXFCEWMCvh5Gq71+JIHgS0DWXf2C1oZxg2tmV7OSyWtYHq86zFPRv7VJiXODcgxevlyQk6djw0DxSiBF352x8/vx0BMZPcRXI8rgmFB0xcRh1WgIX/fcDdff6W2+p/xr7fn0nb4nXyXoifZPURUQeWbLdHvg6JUA== 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=ck6XtAezOoh0TiAxn0S8pPsBQ0ziDTeQ95L6WQfoAok=; b=OJ9r6G1EUDv6lqg8VIEixDfXCwiRVXtrf4g8DrluL/b8dYaFLaG6k1VsTmobdujq4PdiWbALx6PL4X4PGhd+fc+UKrrqyeOcKjvQkCuwmniqbet4JaoBIF+ft9fAujVlf0bhrZCPP3VMOjBQhMajTUYH5xf6i4lgzZMf0vGeJKy2Hdp4/habzW9YSyT25OCX05gl9GQ2HQNny7fbpMfw6G0JmthStQ+VzUSg4Mu/1tJNxEyrSjjnEuY2eDc9DujND76jp3IdiUSH1+4W8bdkSbiYElAmXJC2tPQOBa795KAlDHgpxjMV25YK2mqBIMaruLdAVYB9OhWRXJ8b/4Ae7A== 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=ck6XtAezOoh0TiAxn0S8pPsBQ0ziDTeQ95L6WQfoAok=; b=MAxEBO6MwCoauodli1IBmxM3Smp4x4K6WCvtMAfe6/IlBu/nwioa5OL/duCBYm84/lothsHJrczbndKannZbhW5FkukoKkCj3oWemix3kH8xYbZ27tSQ+baVUXRSX3Ee7zIFbrk2YrJrtaS4dCCQGQAGjkneandHFaH5JSxCWJg= Received: from LO4P123CA0497.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1ab::16) by BESPR08MB598144.eurprd08.prod.outlook.com (2603:10a6:b10:124::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.569.12; Mon, 2 Nov 2026 11:01:12 +0000 Received: from MI3PEPF00008490.eurprd03.prod.outlook.com (2603:10a6:600:1ab:cafe::1b) by LO4P123CA0497.outlook.office365.com (2603:10a6:600:1ab::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.569.12 via Frontend Transport; Mon, 2 Nov 2026 11:01:12 +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 MI3PEPF00008490.mail.protection.outlook.com (10.167.240.151) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.592.5 via Frontend Transport; Mon, 2 Nov 2026 11:01:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1793617271; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=Fsh27Wu9+7mww1Ha84uzsEX0/bkZynwSuIWLnWPzSf0=; b=b6Xj7Mfks5dqAHNyEQ0Qu3JGz+tWuht4jY+mNOewTMTSIX0cHckEgcP9Fdm6ygLU 8XXQ2+GpPO32+4FXZEWjxnI77NsFmL0CCgXd4QwVvbsRnghqeWkgU+MauDjNQ5yP4UM 6g2fDu3Mc/kt/GgR++MizCwItXBawoHHnTD2ZfGjM6+8YA5l4rkQ1i1UGR+nUqp40b0 5qF0jBC5h9OlUOXiYrDXJSv8wtUX+kMHIpGnGFaggwXzSPhgWDUvMstOzifjz5jqIAN cWGOlCPeY0lsuLV+sTsS2ShTzKwiNCDxJ45pWOXreLFEiA6dm57DiDwKCdf9L0YGITc Q0YMJusqwA== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1793617271; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=Fsh27Wu9+7mww1Ha84uzsEX0/bkZynwSuIWLnWPzSf0=; b=DONw3IEhOo/RZwIupXeCA3MGOUJoKgDlVPjlJr2chzAuoTDUwL8rsUduK4GRnYXq k8MK4LDIvNtuJFcznHeKR4CLc60NCrNRGSbeb4Kq2EdtgdOJblnRC+OJ6lAHZdvgCbV NcQgX5dZhm5eol1peVZc5yhLPfwzL7cTGGSVrcp4= Message-ID: <010701a19beb9859-5108e892-4da4-44db-bb67-3d510e97ff9c-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.1 v6 24/34] migration/cpr: add cpr_is_in_progress() To: Andrey Drobyshev , svt-core@virtuozzo.com In-Reply-To: <20261102-vfio_v1-v6-24-9bc7cabc850d@virtuozzo.com> References: <20261102-vfio_v1-v6-0-9bc7cabc850d@virtuozzo.com> <20261102-vfio_v1-v6-24-9bc7cabc850d@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 2 Nov 2026 11:01:10 +0000 Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.11.02-69.169.224.2 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MI3PEPF00008490:EE_|BESPR08MB598144:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: a1c6472a-5168-4e77-b7cc-08df38d09b31 X-LD-Processed: 0bc7f26d-0264-416e-a6fc-8352af79c58f,ExtAddr X-MS-Exchange-AtpMessageProperties: SA 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|704161411799003|376014|61400799027|48200799018|9140799003|32142699015|260925021311599003|260925022911599003|260925021911599003|4143699003|5023799004|5063699009|56012099006|261009223027099003|261028144727099003|261021121427099003|261026121527099003|261022075727099003|261022105027099003|261026140227099003|10067099003|18002099003|55112099003|22082099003|16102099003|5113699003|4113699003; X-Microsoft-Antispam-Message-Info: aPHjbv0gF15noNi3NoQbIFounIF2C0ZgykjcgaYY8SG1H3gW3DzO0PiqzML6VKYqiiaB/OLpdAIo9v/Urt1HNpb5evyR8MVXhf9LyZ+d/D4nyPnQteXuFForpIBjlWW1hyv4T+EMyHp5CUuE/dydpziHzu1Wodt0vemtgyEgyNNYOQGJefWqNdR473UHkjvM2XFCAch/DrrVoZkc8uO8cREKqMtLOCbHWOAz+bQZn/OxYDEN2AOcix8xfgSVBYUi1IkKwjrGpxG3x5tGrJAP5R8uh03Z+oxSJsbsciQOHwea6URhYidryJYYCCh47bm6aLriFQ5I5LQc7wmCOP6B2GoidYAQsZ3pAjrb1MTVlXzddwb28i6CxmrTygBWh6IhBRvYrQiMqhyXr37NBgDla2cXA46EPdq4plijIcZWl61yvkZ328H6Wtw71Jrp2gjbsdwtlDujgy0AxtlclQ+UbYm59XSRxhhk0t3K+2oVCYL0LFAsVqfB+JJaS01JYyLmZBhyaa6/bNu1JjIHHuHCrlfhfCgY85vesUgJpqPxQ/qOaEx5NAb3fQYp8xsvAL0jFnNvVOIw8NfTYi5n7Hm7q/V8hN02r+yGOzZaNNJv82Z82Dxk6Nug+BtusqlhBcYsQH2s+0Gi8X43TZzfgiA1ohTGHaDifsmqu3NQeSwADocEhRJybGBCWgUHQQ/v2thV4Ua0rJflHSbTjqW1Kq9AzyxF74ideWiVqqWLGbpZZa6CzrbJ5GYtzpr2IeoAY3gRXtHCGy0Y5IBy7fcrzJBvpVlleTGdWUpR6FO3iBTfgbDOCDX2xiSu2Nj3V5c202Vu0ZN5VamGCJel5VIdhY+Xkw0y3lPftDwljoWm/6w+yfswmGHND5GwABYlxLyDyIJLBSTWvAklpqIzo/ehz9ye10AgEE+CB+tsmC39H5S0wcM= 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)(704161411799003)(376014)(61400799027)(48200799018)(9140799003)(32142699015)(260925021311599003)(260925022911599003)(260925021911599003)(4143699003)(5023799004)(5063699009)(56012099006)(261009223027099003)(261028144727099003)(261021121427099003)(261026121527099003)(261022075727099003)(261022105027099003)(261026140227099003)(10067099003)(18002099003)(55112099003)(22082099003)(16102099003)(5113699003)(4113699003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LFMPsMr2AcsAoKbWiz+qbKmFZG2WBUnUNBU/jGA9hBIHefoCZUapBD8fHPf1oz+ALcuSjSVu+sDqr7CKpuOXFGjkW4W3b7CXOTAbYN4LtIdXIfZynqpHFpquWPOtpzEN+OY/jYw2WZo5oDCkxbC7TP0qn72DSz3WAWnKE/o7Prj5584Gx8DEPbZ0scIyPcDWshe/mEuC+swPjevHHmHRAtAmh97CcSjxnOFNxovi1N25z/WftvEmtTSm3gHntwPr7SUyK8lrYXVZ1+WQnI9LZm4nRCm3v7nFa3YyjVKFzIUKdGJInNVKi3dAlToOYXg8y439ykr1HVLjGYQBIt9sEf0XCVu27Pi8wSFAPYjs2ms6miBjuPRw5hVzur28cMuZt9+ESxrorisW0cZF61wck3GHxWggZCvvehCIJeta8itBxkPEWlxszhlCErQBFC5u X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2026 11:01:11.3946 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a1c6472a-5168-4e77-b7cc-08df38d09b31 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: MI3PEPF00008490.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: BESPR08MB598144 Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Medium] migration/cpr: cpr_is_in_progress() false on cpr-transfer source= mid-migration -- commit 0df75333875b9c7343698297c785a58149424207 Author: Andrey Drobyshev migration/cpr: add cpr_is_in_progress() This adds cpr_is_in_progress(), a helper meant to report whether a CPR migration is actually going on. It returns true on the target until the incoming migration is done. On the source it returns true when the CPR state file is open. > diff --git a/migration/cpr.c b/migration/cpr.c > index a149e790c103..3ea5d86bab48 100644 > --- a/migration/cpr.c > +++ b/migration/cpr.c [ ... ] > +bool cpr_is_in_progress(void) > +{ > + /* The incoming mode on the target, the 'mode' parameter on the sour= ce */ > + MigMode mode =3D migrate_mode(); [ ... ] > + /* > + * Source: the parameter alone means nothing, it may just have been = set. > + * An outgoing CPR migration has the CPR state open, from > + * cpr_state_save() to cpr_state_close(). > + */ > + return cpr_state_file !=3D NULL; > +} [Severity: Medium] The commit message says the helper is true "on the source only while the outgoing one runs", and the comment says the state is open "from cpr_state_save() to cpr_state_close()". Does this hold for cpr-transfer? On a cpr-transfer source, qmp_migrate() only registers a HUP watch after cpr_state_save(): migration/migration.c:qmp_migrate() { ... if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER) { cpr_transfer_add_hup_watch(s, qmp_migrate_finish_cb, addr); } else { qmp_migrate_finish(addr, errp); ... } When the target closes the CPR socket, qmp_migrate_finish_cb() starts the outgoing connection and then closes the CPR state right away: migration/migration.c:qmp_migrate_finish_cb() { ... qmp_migrate_finish(addr, NULL); cpr_state_close(); ... } cpr_state_close() sets cpr_state_file to NULL. From then until migration_cleanup(), the source has cpr_is_incoming() false and cpr_state_file =3D=3D NULL. Can cpr_is_in_progress() then return false for = the whole of precopy, the vm_stop at completion, the VM state change handlers and the device save? The helper would be true on a cpr-transfer source only between the end of cpr_state_save() and the target's HUP. Nothing has been migrated and the VM is still running during that window. Callers such as VM state change handlers and savevm .is_active hooks would take the non-CPR path on a cpr-transfer source. That includes the VFIO callbacks later in the series: vfio_is_active(), vfio_vmstate_change(), vfio_vmstate_change_prepare(), vfio_switchover_ack_needed() and vfio_save_state(). Only cpr-exec keeps cpr_state_file open until migration_cleanup(), so the two CPR modes behave differently. I did not find a later patch in the series that changes this. Also, cpr_state_file is assigned only at the end of cpr_state_save(), so the helper returns false while cpr_state_save() is still running. Is that intended? Could the source-side check use a state that lasts for the whole outgoing migration, rather than cpr_state_file? --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261102-vfio= _v1-v6-0-9bc7cabc850d@virtuozzo.com?part=3D24