From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <010701a169c67237-47ec45c7-bc18-42d1-86d4-f68cf5c777bf-000000@eu-central-1.amazonses.com> Received: from PA4PR04CU001.outbound.protection.outlook.com (mail-francecentralazon11023123.outbound.protection.outlook.com [40.107.162.123]) by lore.virtuozzo.com (Postfix) with ESMTPS id ABA6B8017D for ; Fri, 23 Oct 2026 17:19:38 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=k8nlz2y98w1K5E907k5rMS7zanw4ugZXP6xWbp+vI4byH0KvDlBZ+qKO7fZnN/CNcDN46IoF3L6sZZsmkrO4xE0W4jwasH/tW5WsZLBhKQzrb//rrqYwk37TSgXmpKqAiQrt/e4zuIueMl4uZShZyFF2eqrynk7KbQPCsE5bRT6hbz5Hu3fHsjvYZzIoVQAqyjnAqVz6cZPQW1h4/YfhRO0qJEayrFr3JblK2eT+SgqxiPZvSJ6Ig77l7+cB8o7/yld/8/TVz6DgOLW2HzUNK8NB2y+8xu7yF3iNXe1ZZuesaVYQ4Q4Y/2W650DqY0L2EqG5ApimuAxPmi4pJPTJIQ== 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=/y3lX7oZnP5I6jqXkTIGXm9kbqIOrSDcTPgDBLHHlLA=; b=YIh1v4lu1mTCshiSkEZlfs/QYOkgtHboXfJlQIAEKPMBHPQ4qBQBHhMOCYxOK/ZkR3qjs50AeHmFavclSUcyoXT3m16XiIGV3j/N3B13jg3egaFZvgcNIBTXGFiWJsXurX1UgnjGYzxVdbGqMgIHsHuhkxx7+VvTonUNa7ahvI8cCtcceTjoy0G3DifFzj72sQVHXjdZjFynk5MHCy/SvVxTi/+lUNc7jhtZK+5EfBW2RSF9l0R6mj+/C8ljnqiLY05id7aJckvaDW1yELgL8hrtkKZOBJVAzdysAjB/NlcknhJ4H4dkYM0ABGSaBTZsduoZ5RZVUimaaSfK2JPQAg== 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=/y3lX7oZnP5I6jqXkTIGXm9kbqIOrSDcTPgDBLHHlLA=; b=Oz7ZIFU7pwxJ45m68CIvPyDPeWWilX9MNWZXh2D0u4TKTfiA/tuXXOGdSvmJkYHh7n4iSMYHP7lG0ePWvORxt4sCJpXdSzlZG/BpT4aPNw28Vp5j7AV66yG9NLz8P7/DtbhMrn21HYW6cAGq06aOOvDLTJVJ0absgMuJ4yu8Gvk= Received: from PA7P264CA0208.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:36d::10) by MIWPR08MB868685.eurprd08.prod.outlook.com (2603:10a6:290:90::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.546.18; Fri, 23 Oct 2026 17:19:36 +0000 Received: from ZR1PEPF0000E464.eurprd04.prod.outlook.com (2603:10a6:102:36d:cafe::32) by PA7P264CA0208.outlook.office365.com (2603:10a6:102:36d::10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.546.19 via Frontend Transport; Fri, 23 Oct 2026 17:19:36 +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 ZR1PEPF0000E464.mail.protection.outlook.com (10.167.241.57) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.569.4 via Frontend Transport; Fri, 23 Oct 2026 17:19:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1792775975; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=8VnrE88lJ2dWIXKLU0sViYzAt563acEvEbRZyuWJBAo=; b=RGkl9+5iD16VtXi9iuxdNtZJvFk9U/iBz9Ni55JMimwuUwm2XdFqlpXpfUbtG/4v JQ4Gji6l8j3da+ERO0G16n1sOhL1GhzvZsuLcVE/Vjj28qgiaumpmnwLvqpd8111UFr GlYUq6wMPkzTZ39MrH5H/heZzMNC+nhnBox1EcJrmlchveGyuI1T01WsnPNUWr3Rpyg 1PJPXggWvz2veDOccAVxlVSlOdcjE5AZ/epS9zPtk6kQO3iuk5YsiH618AIpJ0kJag7 Lu1YZYq02bj1N2uMAYx9Kfzw4pMecn1G7RYfF/fhF6pZ+dp4h5u+H6//PNJE5wOL7iZ K+NUhZwr7g== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1792775975; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=8VnrE88lJ2dWIXKLU0sViYzAt563acEvEbRZyuWJBAo=; b=QPUn0msrVuR3Tibrbgww+mLLE99xfWZHOHyQzGMKm1kYQRDskFB6w1vF8kzn0ji7 Oq9OCgypUDmM09Xkq7PMgVPB2Ut+Et4ViumCcM1rwuMvYj019MC8+Y7zuVrFYcyogJC WqafLKBk/P7vHPtF2hZ4XENb/Usy0KEDuIlSLkeI= Message-ID: <010701a169c67237-47ec45c7-bc18-42d1-86d4-f68cf5c777bf-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.1 v5 24/36] migration/cpr: add cpr_is_in_progress() To: Andrey Drobyshev , svt-core@virtuozzo.com In-Reply-To: <20261023-vfio_v1-v5-24-ba0bf3c6d122@virtuozzo.com> References: <20261023-vfio_v1-v5-0-ba0bf3c6d122@virtuozzo.com> <20261023-vfio_v1-v5-24-ba0bf3c6d122@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 23 Oct 2026 17:19:35 +0000 Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.10.23-69.169.224.2 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: ZR1PEPF0000E464:EE_|MIWPR08MB868685:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: b4c92f06-416b-4c8e-08cb-08df3129cfd2 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|32142699015|9140799003|61400799027|376014|48200799018|260925021311599003|260925022911599003|260925021911599003|5063699009|4143699003|56012099006|5023799004|261021121427099003|261009223027099003|261022105027099003|10067099003|18002099003|22082099003|55112099003|16102099003|4113699003|5113699003; X-Microsoft-Antispam-Message-Info: itLBNA2peKgbnbQ4a2LTMQXXkKktzue/rq4GXFfz/itOBUVw2qSPzvEFfCdcbE0KsrD00Nb2coUs11XeMRx9tZfg/lVCkF4ObV+lwuX+G1+V86NOU54yLm/A3Z494HPcZ7GtyelKd9pQ7TA7aEVYVTGSaG+J/7MuE0EYFhft7yUNOWpk5pjIi5JPMxWg1JnURhoKtGmCBHWKTvU/SGWMK0FuOayPC9fIy/JOicSC6sed/llgL1Qrmu4LtY5V52h8+AGMQA21Vt4e+JR8TLUmeeUc6+Pr7AWmHXpLG5y9ymkLQneL0UOx58qZ88Ez/FWURSsHwdENqqZD+6WeiEATBlIIe5lguD9eb/JXODd5ZY5X52R1nDX59DmyKb72duKMlwknPutNpdiofk5AYHdq/ed2KWci32HEClDFdvlh1k+waS8ibcQAFBC25HV/JF5rW15pXdiQc2DNSGSrA7+p4yXyjwYYeBAOb68U0/t3szTZ+DTkefTxkVf4sy1AvAzIH7I14xdlWiroYES52zh6HAfym/xfFI7AP4RRO+bWHB3ykimlw8udwEhfi7D1uY0krt4bLQ6+pz+C1m/dTTkyY2hyEuKpl966aQWoFfnG1F9jZ7sI7WG2c6W+1uD7v7A4NOokioGyH4ayVx9sNCENG0IhBFFXi/DGLs2ifqlt+S9pHXUQK3oe9so7dxO/HLL6pPZGW+2Y78ozqnHW+2KNpl0t9X6nLBa0udQe6yzWzOB9Mj/dlo1P3AsPs6nzMLxqj9nqN/xC/oapCb9KoVreBwemmo2XoaSK4v4A/eCsbVmVtavrkH15kJDKtYSTHcuQO0qvorL6MT7Ip/SLJsXHzGqoD9TQsIRrEpIVdlJOo/dKtGM9sEqbLCqg1WKNZ4Al 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)(32142699015)(9140799003)(61400799027)(376014)(48200799018)(260925021311599003)(260925022911599003)(260925021911599003)(5063699009)(4143699003)(56012099006)(5023799004)(261021121427099003)(261009223027099003)(261022105027099003)(10067099003)(18002099003)(22082099003)(55112099003)(16102099003)(4113699003)(5113699003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: u8i/avxongAiGMz7iLzw9oQXLvg05TIAS1Jvep97SpmrNIirqX1Szxt4peTHlJWJSzLMajWbHQeOt0430o/FpBvp3ID/R47M+Q/XD2oITuwff0SNjfBaIox173KSGb38+8Ng7zPNQA5keEXohu9uRN7B6mijQaA/ajZhVhphuhITyxBbKItwCPYRgOiBC8GqqiXnmCIfQ+eb+yU7a7Pz0FkeK3Iw7pJE58dlKAgcfGcwq87amQklPaTa1og75R7U2MXwATj5DlNne5f4kR0oa8jOI+aqcGmkfTirZYMOKJ4y7i/f0U92WZL+jz9uQzTj0vfZnZ0lniZtWrcjvapNn3WuPvMyOBndqi4sNarS53amWJKjqwQwK0kUZk8zu0CUYjsmjO4gg1cHkN6S1y4gqhGSqHiE3wmdNzoU+HBp0tz0CRP7z5sthuw9V8JXOZW3 X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2026 17:19:35.9260 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b4c92f06-416b-4c8e-08cb-08df3129cfd2 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: ZR1PEPF0000E464.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: MIWPR08MB868685 Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [High] migration/cpr: cpr_is_in_progress() false on cpr-transfer source a= fter early cpr_state_close() -- Commit 453b7d2ec8b4fa272ccd4231894792f7b5e92c8a Author: Andrey Drobyshev migration/cpr: add cpr_is_in_progress() This commit adds cpr_is_in_progress(). It returns true on the target until = the incoming migration is done. On the source it returns true only while th= e outgoing migration runs, which it detects by checking whether cpr_state_f= ile 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(); > + > + if (mode !=3D MIG_MODE_CPR_TRANSFER && mode !=3D MIG_MODE_CPR_EXEC) { > + return false; > + } > + > + /* Target: the incoming mode is set until the incoming migration is = done */ > + if (cpr_is_incoming()) { > + return true; > + } > + > + /* > + * 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: High] Can this return false for most of an outgoing cpr-transfer migration? The commit message says the function is true "on the source only while the outgoing one runs", but cpr_state_file does not appear to stay open that long in cpr-transfer mode. In qmp_migrate(), cpr-transfer defers the real migration to a HUP callback: if (migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER) { cpr_transfer_add_hup_watch(s, qmp_migrate_finish_cb, addr); When the target closes the CPR socket, qmp_migrate_finish_cb() starts the outgoing migration and then closes the CPR state right away: qmp_migrate_finish(addr, NULL); cpr_state_close(); cpr_state_close() does qemu_fclose(cpr_state_file) and sets cpr_state_file to NULL. >From then on, for the migration thread, precopy, the vm_stop state change handlers and save_complete, the predicate evaluates as follows: migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER cpr_is_incoming() =3D=3D false (source) cpr_state_file =3D=3D NULL =3D> cpr_is_in_progress() returns false In cpr-exec mode there is no HUP callback. The file stays open until migration_cleanup() calls cpr_state_close(), so the result is correct there. The two CPR modes therefore give different answers. There is a second window where it returns false. cpr_state_file is assigned only at the end of cpr_state_save(): cpr_state_file =3D f; return true; So the predicate is also false while the CPR state is still being written. Later patches in this series call cpr_is_in_progress() from vfio_vmstate_change(), vfio_is_active(), vfio_save_state() and vfio_listener_log_global_start(). For example, vfio_vmstate_change() has: /* CPR source only: the device keeps running across the exec */ if (cpr_is_in_progress()) { return; } On a cpr-transfer source this check sees false. The VM state change handler would then stop the device, save and send its state, and start dirty page tracking. The series is meant to avoid exactly that. No later patch in the series changes cpr_is_in_progress(), cpr_state_close() or the cpr_state_file lifetime. The series also removes the "CPR is prohibited: passthrough (VFIO) devices present" blocker, so this path becomes reachable with cpr-transfer. Should the source-side check use something that lasts for the whole outgoing migration, rather than cpr_state_file? Alternatively, could the cpr_state_close() call in qmp_migrate_finish_cb() be moved so that it matches the lifetime the commit message describes? --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261023-vfio= _v1-v5-0-ba0bf3c6d122@virtuozzo.com?part=3D24