From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from GVXPR05CU001.outbound.protection.outlook.com (mail-swedencentralazon11023129.outbound.protection.outlook.com [52.101.83.129]) by lore.virtuozzo.com (Postfix) with ESMTPS id 9109F8017D for ; Tue, 3 Nov 2026 14:21:14 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Csduf0I8tOOpmVw8h/kzqsZSSV7ismetwZNpE3i4WfFX89VeD5icd41RuwyMysQ9scUI1915HHDe6kUUzSC65L8qfja1ppBvfw4ORMDgchBt1A7FDFvZO5rASpnX8WJJtqt4WPyRiQjhs2+s6Edm1hohsVfqdl4dq7eaVWFKWqttqb5ef21bt04M4FRCJr475Hq4qp5A+Qt4cP0X/oMITCZJ8W9i53a8jPo00ikt+kCmHDsbcqS7bm5cWEMISYLLCPrcCeIW5RUJcKnjQoSPmvvvdQ6G5oBoPAUO8nFm1v5R3MUhPvL1ncKoaHvwGJxqp9gAzkPYTi6GjC8584y0VA== 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=p7pDAAxPW72l6eN7ZOm6pvGndg5VEaPFNpOOMOACP2A=; b=Crmg1o0mHGSrje96Wm+BiJo0xnNcUfEYoeAqL5MM7+ddizUi4prKGvfOq5XwwnhwLvVdvLjwMfvwwyQ+mRQshjL4pmZQ/OGGhXIIDn0Msrdg6IZvJBdsWh6yewDhFV/Tm5f5s6AHKGJCMRi0NVY4ytnJo28KhibB83ux7lZTIBUg9SnD7N/GXovvBK5H0NN8CeXN8Nr2vXepDRirhVZgpWWhHdozlBRlzwfPgSeGsPUe84Zihbnd5rJ2m8Kt/+pIsgCgjImmJUvtR0zvg0X8t508oKhPn2cEicos1b5y6Ryj8Ik1IXjnsmB7+LepccR7jGMH5QhQ6SDg3XBtXlQbVw== 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=p7pDAAxPW72l6eN7ZOm6pvGndg5VEaPFNpOOMOACP2A=; b=WB06h2/uvTW85L+OaS3g2RE2lwL2HVQXPoODdAuD06JeKGlAuIMg8WrrIRZOarsm3eFU0O5IcEWoJsXKdK3r6SyQbY912KncB+Z5ZOYWpvH1HJUwtzLSFzrJawSsbBJzxGmnIgw5BoDhcYJmfCBo9tRN2hpvl61x3OMqEphg9mc= Received: from DU7PR01CA0019.eurprd01.prod.exchangelabs.com (2603:10a6:10:50f::22) by DBBPR08MB6044.eurprd08.prod.outlook.com (2603:10a6:10:207::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.592.8; Tue, 3 Nov 2026 14:21:11 +0000 Received: from DU2PEPF00028CFE.eurprd03.prod.outlook.com (2603:10a6:10:50f:cafe::72) by DU7PR01CA0019.outlook.office365.com (2603:10a6:10:50f::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.592.8 via Frontend Transport; Tue, 3 Nov 2026 14:21:11 +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 DU2PEPF00028CFE.mail.protection.outlook.com (10.167.242.182) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.592.5 via Frontend Transport; Tue, 3 Nov 2026 14:21:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1793715670; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=MeZcHABZs1g0P4tJ70m0v5/xCwz1/0Bv+wlcRTLIQM4=; b=qSqQzYpLcBu2G6BvcJRHkch2RWMeyqR6qg2DTxStXacxTzQCsC3djP5/PevZNzDL Bt/byYgXS5qVSIpautpAzY4EfV5YH6BkY595/OS+MCTjWN4XoicqAaukaVJ5u4kgTAL cQ684od0ZA2lQ4Wd0kSiKhqLuObUEWjnQYifvontjuJMLTBLEZpegJAhUISd5/slGPT uGW2MtOixyMM1CzkrsPYz5H3pk4IkvpGJZG9QzNQlbBWXvGTtzZOsw6O4RQ1uRidBvm dYN6zlzTJpOW+Mio2IRsQNTDq3e2ivhP4XZDklsVemXJpMEy+nz3g0+ek0JDrQuXUuC Sb5EKs7O8w== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1793715670; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=MeZcHABZs1g0P4tJ70m0v5/xCwz1/0Bv+wlcRTLIQM4=; b=KY0gc3rht/xG+hDVUAZ9bh5VAIOCUvQBRWkW6FhRm/AFi11IrdLmAJFPWrU0S2in feTymkVLQ4D4SpQzMo2Cv4NoFoLbQbo/JplwRTTu2sE3bqi5dVR60w57dY4K1tGZ73M PZrnvCXTqcEMb2T8Iuin/9e4NIgwTdh7lFOvGtdQ= Message-ID: <010701a1a1c90d1a-116027ca-c67e-4632-878b-0413f8a34662-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.1 v7 25/35] migration/cpr: add cpr_is_in_progress() To: svt-core@virtuozzo.com, Andrey Drobyshev Cc: andrey.drobyshev@virtuozzo.com In-Reply-To: <20261103-vfio_v1-v7-25-4467fdccbbe6@virtuozzo.com> References: <20261103-vfio_v1-v7-0-4467fdccbbe6@virtuozzo.com> <20261103-vfio_v1-v7-25-4467fdccbbe6@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 3 Nov 2026 14:21:10 +0000 Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.11.03-69.169.224.5 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028CFE:EE_|DBBPR08MB6044:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 5881e86e-bb6f-4739-01e8-08df39b5b59d 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|32142699015|376014|48200799018|9140799003|61400799027|5113699003|4113699003|6133799003|10067099003|22082099003|18002099003|16102099003|55112099003|13003099007|56012099006|5063699009|4143699003|5023799004|261021121427099003|261102123227099003|261022105027099003|261028144727099003|261026140227099003|261026121527099003|261009221227099003|261009221727099003|261009223327099003|261009223027099003|261009220027099003; X-Microsoft-Antispam-Message-Info: FrtXjn21L+wR1zJzLJRsfcXGnd0MvMFh99MFWfZHdL3E8enQqSSbLCiu8k7eDB9HHpz11RYM5IooNfcLC6jsJUQyJ2o14GULTplw+l/sKEqDZntTFtpd5mqcNIM5/k1CAl58tn5mFrjf+JUZTr3bWGB22MRFjuwrDaUVTz03uIfgwRFzB3qz9xMS7NKpN9pMKudzW19GYgOv5olBcwLCUY8qsxpI4EHh/3BcSydbnzvahf2RZCcVvJNxLL4/y5Q51JbzGZp/CPYSVXlvT9lvQF7VsgUiTd8QHbX3XCqGSPIzBaOBKwAYh4fusRKvFbY/nXEIQQotVfCM4zQ5osoAS0a7T7QP6o5HjJ2iJO/vEyVTbv5Hrqgj4Izi4h2gnV6y+bf+US2bagwijlXuMIcvKwNXGyKCj5Gq4IuFc4hbXPLYTVjqiSn1/Foj17L5Q0ddNWnEBz8v0KzBhWue8F/mG/xQHPxnF3JITo/g48EzRdVKySd96E3dQA3p9uTzszwhjswYLLSuxpPACKnYW9b00Los8Eoi/7Ak+Fthl3qILuKg5eyXMZFR6ZI05thHE96mp9dG3ZquyLX68bcW/H3p7Hvm1ggGR3g8hFli5k8wsZEsG6gATU9KNAftk/f9yAJbA5UbyXXth4Wlm+oQgucHqOH0kYzi4F5DBMGjwNH93TN2MrFwLMJSiChXmuxd7Ikzt2fQLOnh14RQdwzaQLdpf/ZJs6BnkwUmg/u3cQ8W2klyo4x9Lq6Ldt/vBJEYnvZgc24CBwXVCfCa+T9axZCn0eMHvBNyuIYF5H/47WAJfIwWk0i9xIxQ6fY7YHP3s1rJR1pza34e78lVroCMDJgzdFFfuTX0MyMpxz4Q2b/Fm9123W87WmZdhMFmpvw3EqM+tcGMi2eLUsvUB8mUp5oD7v/0k4p2bCSmo4VmdZ1QQWg= 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)(32142699015)(376014)(48200799018)(9140799003)(61400799027)(5113699003)(4113699003)(6133799003)(10067099003)(22082099003)(18002099003)(16102099003)(55112099003)(13003099007)(56012099006)(5063699009)(4143699003)(5023799004)(261021121427099003)(261102123227099003)(261022105027099003)(261028144727099003)(261026140227099003)(261026121527099003)(261009221227099003)(261009221727099003)(261009223327099003)(261009223027099003)(261009220027099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aSuSK0jHzj15+LVFefgGY9f2GlEnccRTyY0E+S+YIsOKvK4AACoqLI9Jd0Hv6R+ryQ6sr3yjbdw411oDBAyiHPC5pOD8EVSwx3tuqU1EPgqOGPlL3JUfXzNwk5N9uVUuU98c85h4cwfrNqc0pSckmWnVEha2ftmBpZBEmRlCtAXQXqerVabXA4gw3WYYq1FFc82kMA9EVqls3+CwcbBhATGeSmXKO9yGXrq6s84VhDPjLGHDasXpYmIn4Y7BBR4OdBdfNF7Ay1wkSkZ9ah2fU3k9TqYc3Q8iGQxl39fZY+q0Da2bus1xtKZu8E3gZXXAt52Z+ULImujmJsbo/1DuWAkuuArklK1f2IfcCiD8WxaAwu3WhKYPObJhUK/pZvsxjrxFu64/cepANrjJvceTM7xulGGexRBWfvEVA0m26eCZY96Msy9Ch4iCktJuzNhE X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-Auto-Response-Suppress: DR, OOF, AutoReply X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2026 14:21:10.7848 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5881e86e-bb6f-4739-01e8-08df39b5b59d X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: DU2PEPF00028CFE.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB6044 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 HUP closes cpr_state_file -- commit e23ec35308ad2aa64ca670bb065479111e90c011 Author: Andrey Drobyshev migration/cpr: add cpr_is_in_progress() This 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 the outgoing CPR migration runs, which it detects by checking whether cpr_state_file is open. > diff --git a/migration/cpr.c b/migration/cpr.c > index a149e790c1035..3ea5d86bab483 100644 > --- a/migration/cpr.c > +++ b/migration/cpr.c [ ... ] > @@ -549,6 +549,28 @@ bool cpr_exec_is_incoming(void) > return incoming_mode =3D=3D MIG_MODE_CPR_EXEC; > } > =20 > +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] Is cpr_state_file a reliable signal for "the outgoing migration is running" in cpr-transfer mode? The commit message says the function is true on the source "only while the outgoing one runs", but the comment ties it to the lifetime of the CPR state file instead. In cpr-transfer mode, qmp_migrate() calls cpr_state_save(), which sets cpr_state_file, and then adds a HUP watch: cpr_transfer_add_hup_watch(s, qmp_migrate_finish_cb, addr) When the target closes its socket after loading the CPR state, the callback runs: migration/migration.c:qmp_migrate_finish_cb() { ... qmp_migrate_finish(addr, NULL); cpr_state_close(); } cpr_state_close() calls qemu_fclose() and sets cpr_state_file to NULL. qmp_migrate_finish() only starts the outgoing connection. The migration thread, RAM transfer, vm_stop and the device state save all run after this point. >From then on, on a cpr-transfer source, migrate_mode() is still MIG_MODE_CPR_TRANSFER and cpr_is_incoming() is false. cpr_state_file is NULL, so cpr_is_in_progress() returns false for most of the outgoing migration. Would callers that depend on this then take the normal live-migration path? In the later VFIO changes in hw/vfio/migration.c: vfio_vmstate_change(): /* CPR source only: the device keeps running across the exec */ if (cpr_is_in_progress()) { return; } vfio_is_active(): return !cpr_is_in_progress(); If the guard does not trigger at vm_stop time, the preserved VFIO device could be put into STOP or STOP_COPY. vfio_is_active() would also return true, so the VFIO device state would be saved and migrated. cpr-exec appears unaffected, since it keeps the file open until migration_cleanup(). Could the source-side check use a state that lasts until the outgoing migration finishes, for example the migration state, instead of cpr_state_file? --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261103-vfio= _v1-v7-0-4467fdccbbe6@virtuozzo.com?part=3D25