From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <010701a15a3ca7ff-1c28d7e9-5c62-4563-a378-4b72d8cc636c-000000@eu-central-1.amazonses.com> Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11020084.outbound.protection.outlook.com [52.101.69.84]) by lore.virtuozzo.com (Postfix) with ESMTPS id 131A0802A5 for ; Tue, 20 Oct 2026 16:54:53 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=i5p8ji7zPDb+uAk0WcILOizK/89M0bcQ6UW6YLqfknqSQ7swbl6cdVN1mHzVLj1KkeSHSXJXhJxagoWtjVncNZ4sX4jTe8ljf3Eg9I51OWVpRN1pk1QtxLnA7IZ+tkHsaSAouckzdir6OB8+hcoatvZPb1RaTIAAqgOk+TtwP8untZlrhVwTU8M8W3CUzls4CNKPmlVS99rdpEXW24bhZyfunZpbrWdRNVdIuQUmm5iO4FJ4/IjysVzs6IG1hURfHu7CuRUMYMPb3P9RkN4py0kY9nnr1DYgMp7BerFCTT4+zWmUOYHzlEWqZtimUxad7CM47iACJE0qeQT9gTYpXg== 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=J6XgDZwID8cJeBHKoxSq+vx11QpJyAKr0eb51QFMvfg=; b=nHh20ZIqeMacBIpjVkQf8TjavkkddIRzR5T/Pun2NPe4fSJJJu3yye2ib/UVexsOa1ZBZH9GAiAglt4fzTgyhpb29ovrPAHTAIVRS59OZFVzKWepEy+JFnwNWqJQzUAL0ow0Gg44AnF5+8XqaCzFYBDC7g9eUdROdCmjPskiNQvXdmUu4HiuX7xw5fsduGASf71QQz2Nu1i47YbXQmxBgBSsr3gzCSKxlS6RltYpl3oJM/iYPFwqKIgv1d5v/0kgN1TjGYC8KjuPP6ClX1ipDQJnKqdbNj8czoOwbXH81Xug9DrVjSXTYcWzJyDqykQ2Y5I+XH5hKEbry7vakuzQSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 69.169.224.1) 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=J6XgDZwID8cJeBHKoxSq+vx11QpJyAKr0eb51QFMvfg=; b=Hl6fPIgVmKT85m72JChkqakDGjYi+ANYDLQAtO2Hlzw5YNYCPPniwqrVI9IhFlVElcxsPbC+YH6u7kez5XmwxJfqF1ySkxqb1kxyqlwvMqqzN8m+hFXnrSOXpVj6gzj5IWrCkgvvYZPX+JUTcZRv7gCuJRQBKfxV2wzgcm9qxAM= Received: from MM0P280CA0058.SWEP280.PROD.OUTLOOK.COM (2603:10a6:190:b::25) by AM7PR08MB5477.eurprd08.prod.outlook.com (2603:10a6:20b:10f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.546.14; Tue, 20 Oct 2026 16:54:49 +0000 Received: from CPH1EPF00000530.eurprd05.prod.outlook.com (2603:10a6:190:b:cafe::50) by MM0P280CA0058.outlook.office365.com (2603:10a6:190:b::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.522.20 via Frontend Transport; Tue, 20 Oct 2026 16:54:47 +0000 Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 69.169.224.1) 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.1 as permitted sender) receiver=protection.outlook.com; client-ip=69.169.224.1; helo=b224-1.smtp-out.eu-central-1.amazonses.com; pr=C Received: from b224-1.smtp-out.eu-central-1.amazonses.com (69.169.224.1) by CPH1EPF00000530.mail.protection.outlook.com (10.167.241.171) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.546.15 via Frontend Transport; Tue, 20 Oct 2026 16:54:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1792515287; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=81A12vkHwe0fw5mBBCNgIbN+YYAov2NmFRNX1KaTvCw=; b=AsL3UylxAkjybhalm05r0JOwAVZgYdq9EGrHsq64GEhBEDXhKXiSkgdKSCOoNAuk RaAq6qV5QgIRoq3V2Brl8KIz+yOSJbUQM+qJkndETyxhC2eF/NrAudSZcpd0u1z9kh3 w5/hMNQwCl4QJ7X4CPiazRexYAznnIRfCvbwyK6aAL3TkHK8mLabzMU4FgR+ERNoB6+ 5w7UykSbcRxUr8FP6XHWRBA6LPHu/Tp7eD7Oi+yC9gUs/HNSCmiCG+P5j+QFw0KSHzD KqfjGTCdYd+P2FVlufAXiaBizmvPPHC7vXPiDstucz0frWekCMpcmLCoNgNQ3KQTbTo 0/J/THQejw== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1792515287; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=81A12vkHwe0fw5mBBCNgIbN+YYAov2NmFRNX1KaTvCw=; b=GKJR+V9ujUAM/mXCHMCAd5U7UZYAqCXZ2+v0n61a+a/RDUI8K1TirdKeX6uJh/+K wJYLopNNT01PoCLyS8yPI9r6rIEwD2WwfUrel5nGZqHdjzYyGQ9wxNmgXytf3zeI1YA oFKXF8MtgeqVmE5Z8sNhv7OA/89E7qVQXXnyVDrQ= Message-ID: <010701a15a3ca7ff-1c28d7e9-5c62-4563-a378-4b72d8cc636c-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.1 v4 22/31] migration/cpr: add cpr_is_in_progress() To: svt-core@virtuozzo.com, Andrey Drobyshev In-Reply-To: <20261020-vfio_v1-v4-22-83a5668230e5@virtuozzo.com> References: <20261020-vfio_v1-v4-0-83a5668230e5@virtuozzo.com> <20261020-vfio_v1-v4-22-83a5668230e5@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 20 Oct 2026 16:54:47 +0000 Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.10.20-69.169.224.1 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CPH1EPF00000530:EE_|AM7PR08MB5477:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 2f0849d8-3ab9-4755-3f71-08df2ecad970 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|9140799003|48200799018|61400799027|32142699015|376014|4113699003|5113699003|16102099003|18002099003|10067099003|55112099003|22082099003|13003099007|4143699003|5023799004|261009223027099003|5063699009|56012099006; X-Microsoft-Antispam-Message-Info: wAo8Dl7T/ll76Hosa7DkkC68b+ZDip3c1i6E+Y2wTozvaOtFqBIlBPukTzoivGFzWnPg2eQaAQ4Ra8TTnhXyxLLlUCAqj5u1GZReWRQNUswzpcll+SjkOq27TZtDrGd0FyHH0GFW6jjenHxFXjXR2L8osoRJbLWvDvcvezNwFxoCPIUXClzDUxcbjBqQn4am5r8Fj5CIVijZYnVwvMjEE4CzE0m4l5YJRSnLwRxY6L0tOlPqOVF1aO7YaZQ/89pTQNnALPnmOCTnnmax9IVuV+7jeQqU+yfkWr0S5T3sbI80X0njQl9+5ziVr6Uk8gElhKtwRNqwvuQBBvVnIFZH48b38E1neKT8vyNjXoUENqGlfY8HAw9hQI+qmJqzKAybLciZ0i9zY5mXIw8fiOlGNXDiPOgNAkdSnl7SA0WSar92mCoe+lONDEv7FJVEyfzxAG9K2Hq+Ei7IvvABpgSHGB7gyMNVy61ADxIoQH/c/PoRpMR44kVVUBiBDNXnm4ZJprhV3J76Rh2yU7175DVSGP7G3JUq5bTs/ICzwazacLb8soiWQpdMQ+BvG6k8vrbq9olkTohOUjDVwYnP1pcOtPmyAScDVDYvUmRoJRxxrICC0/e7ziYdETEDAFtXaek0repqOgmc5ui21RYQAHzoTDyN9ILy8JLSGAoagc1Fc8Z9SU1kwASRtdlTOOTQLMWLH1pEVcDb3zptVmBejX7nOhjprEEoWhXb+5FM50VZe+3FNF4LKQ0vfNdTAXk2btTVOtSe93qe9VwenZg8I8jmJ63ixKqcuSMON26e2bUEHzWKHqBQH7D3rTFAvEN5p7wr64lpWsSzfj0+WsZWiuuT8TInd2LVHfhTuOQ9PgQ180BybYD2DcJFZw7JMaHKo2QK/GEl2Xx08QvknC9hGcOpsg== X-Forefront-Antispam-Report: CIP:69.169.224.1;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:b224-1.smtp-out.eu-central-1.amazonses.com;PTR:b224-1.smtp-out.eu-central-1.amazonses.com;CAT:NONE;SFS:(13230040)(704161411799003)(9140799003)(48200799018)(61400799027)(32142699015)(376014)(4113699003)(5113699003)(16102099003)(18002099003)(10067099003)(55112099003)(22082099003)(13003099007)(4143699003)(5023799004)(261009223027099003)(5063699009)(56012099006);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: D91JqxOsClVo0vbDLe1oIgSmoYvlWodyz101CIgVH6cMibfJ4xsxhZjFwxZSZvi/QyAmxXFdLDVbs8gQY+DebbLs3HfQJl/6DBbuZAB9ZYBRc2kt18pIgQ1jMoig9nqljpZ8/oqFspwcU/wQMRbxonHNAt9N0b8lPQx+sMxc4imzygb9Kdta5lv4xJZa6BkEEf9JsWlyTQMAYMJSctTYWHxmuYIrGvxbao9wO+rSm1MTROoessHIR7wYImD7KvkeKhgsByzSVfk7jN6vACy3f/Zxu4xuCKgvyok1g3CRp2U3WVYy1vHLWEzhBS+LiSDBZMhZxac/pwK9hauqOGT4OC06XO5Spf/oKtxzuvTCDTorVHURnVGETDkHruw5fgH1sleME5L8kR7HOc6HE+Hh5Nxp789lPlwf2fZ4080Qy0PiXnGK322FdT25aUTd6j0U X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2026 16:54:47.5263 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f0849d8-3ab9-4755-3f71-08df2ecad970 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: CPH1EPF00000530.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5477 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= after HUP -- commit 6f0604877a0fdc026e4268cdb035a9a9897fd0b4 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 CPR state file is open. > diff --git a/migration/cpr.c b/migration/cpr.c > --- 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: Medium] Can this return false on the source for almost the whole outgoing migration in cpr-transfer mode? The source-side check follows the lifetime of cpr_state_file, not the lifetime of the outgoing migration. In cpr-transfer mode the file is closed early: qmp_migrate() cpr_state_save() /* sets cpr_state_file */ cpr_transfer_add_hup_watch(s, qmp_migrate_finish_cb, addr) The target then closes the CPR socket, and the source runs: qmp_migrate_finish_cb() ... qmp_migrate_finish(addr, NULL); /* only starts the outgoing connectio= n */ cpr_state_close(); /* cpr_state_file =3D NULL */ After this point the RAM transfer, vm_stop, device state save and completion all still run. During that time migrate_mode() is MIG_MODE_CPR_TRANSFER, cpr_is_incoming() is false on the source, and cpr_state_file is NULL. So cpr_is_in_progress() returns false. This contradicts the commit message ("on the source only while the outgoing one runs") and the comment above ("from cpr_state_save() to cpr_state_close()"). The cpr-exec case is not affected, because there the state is closed only in migration_cleanup(). The function has no callers in this patch. However, the later patches in the series add source-side callers that run during the migration: vfio_is_active(), the vfio VM state change handlers, save_prepare in hw/vfio/migration.c, and the dirty-tracking start in hw/vfio/listener.c. In cpr-transfer mode these would see false, so VFIO device state migration, device stop/resume and dirty tracking would not be skipped. A VM state change handler that fires at vm_stop during completion is the use case the commit message names. Could the source-side check use state that lasts for the whole outgoing migration instead of cpr_state_file? --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261020-vfio= _v1-v4-0-83a5668230e5@virtuozzo.com?part=3D22