From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from OSPPR02CU001.outbound.protection.outlook.com (mail-norwayeastazon11023128.outbound.protection.outlook.com [40.107.159.128]) by lore.virtuozzo.com (Postfix) with ESMTPS id 58FDB80474 for ; Fri, 23 Oct 2026 17:13:18 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=X7NPPlKj46SM/td85qMWrgd2DO/COVikMn3RoKNdiEXm/nw9YTkonYudkdAes5wWZPT4jfWbw5tACorOGApsb5TddF+D4ajUHUav4waqmSHI8wDeqvmcBDc3XJGeUJrkYm9yzllv3lgiyuiV+2S6kaIWjcFMSKvlAhM5oNCjg7h2+2OnURgkMbfQrPjk9+d5W6Y51N7Yq30OMSnyDOmf8j80tkBZLzfgbb9o7I0910k90P11RA2YOstXgB/WgL0GrTSa9j7lMIL4N286E3LyNOzm5GGGW6Lptbf97VfDSqzRqHYK9fnsdfaBmBkP8F3qRUZNs9axlsiMiPlnD2sazQ== 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=geXdemFvEDxbQhuQgdxSGmbiFSzOBcsbtfVIcqqCEnk=; b=YyoCUo3zGl5AbiW3bwDCNMuJUCFnwk4sF/SHrW4ZH4Zg2Y21ybMEuLTmparjt5Ia/rXIQBYRBzHCkZOIr93Oqf80pvcQDkp0wjUX+1gn6A/26GA9oX6YORyAAdsE4qo95OK3P6U/Y5GzI/Jxnt7fY9nsXBe71+MoNwm4UZxw+eI4rPI5iK4K9pLeCx+foRlZ3gJjtNku+djA96UOZCpuEIyw3cMBQjjTv6Cw+k7ICaXnANWOJXg66CsYkdaoQfrJWR0ElsfdcfInVRuwIc5TH+7Vaf658gnR9ZK5ZGnEqRU2W7DqGpmWZe87mOtXQbIebnU2gmYAjw18FARYaZwkGA== 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=geXdemFvEDxbQhuQgdxSGmbiFSzOBcsbtfVIcqqCEnk=; b=npwHkF41fKixQtemNk9oCIHL6axgLkCW5m5F2emtXcs+QEZcXx0Iq9NqV2b8msXh0dAaIVcd5lHX9n4GytjSjJSHk9uOX8mshUxXDT7QN3K6dQkN7MkBDFGl9H0p9uFTbl2h+x/Lu/uUXjrqn5ZU2USgszn7v82uYOp8VLkkITQ= Received: from PR3P195CA0028.EURP195.PROD.OUTLOOK.COM (2603:10a6:102:b6::33) by AS2PR08MB9692.eurprd08.prod.outlook.com (2603:10a6:20b:604::20) 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:13:13 +0000 Received: from MI3PEPF00008498.eurprd03.prod.outlook.com (2603:10a6:102:b6:cafe::96) by PR3P195CA0028.outlook.office365.com (2603:10a6:102:b6::33) 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:13:13 +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 MI3PEPF00008498.mail.protection.outlook.com (10.167.240.183) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.546.15 via Frontend Transport; Fri, 23 Oct 2026 17:13:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1792775593; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=O+PcszLyw03CYSsMND/wEA018rpTfmSYAPslsoPWAG4=; b=hbZx+SH/O2XX0XEyv7iQwNJeZrVeaEqchG9BIix+HxemP3/GAVVKzmlIu/CCPbwA 8DI4n11nKC3wneL+jRGwZCHeGvHl1huI323nlBtufypTKzK3Opk4g075z+mEoOWg4+3 GhsuKoisVULURhVBh42lkz+a2MAgtxECoEBb+q8txpSNaur83M2Dmx/IhPN6Ou6nc6F wnC7ArBTCDd82jrudHNYXa8rplbqoqlJvHvwhbl7D9sIzOaODdnRLLKBwSOnthg/bjG Tx7wEVD1kr77YOT2g79sa+ANaUyHaye3hECJcxUd2ovVPoMA5EujtTfthC2Qe3++Q5E gWRIBKF4GQ== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1792775593; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=O+PcszLyw03CYSsMND/wEA018rpTfmSYAPslsoPWAG4=; b=oKpaMWUd5cfaifjmNNLmLkAie2pijPk6qQNHOlibXu/pLtyCThNDDQrEWjnGBg0q Km2vhPSrr6PCjYNEPY2I338c6SEfW5L+a6AD1ghzJysjAvSMcofJmeha/l8t3he66NM mhkB3WFexweFxToslW+NMQBH6/CjX3t4Uccae4co= Message-ID: <010701a169c09c1d-5c59e95c-e2ce-437b-835c-222a886e14e7-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.1 v5 18/36] migration: yank: Move register instance earlier To: Andrey Drobyshev , svt-core@virtuozzo.com In-Reply-To: <20261023-vfio_v1-v5-18-ba0bf3c6d122@virtuozzo.com> References: <20261023-vfio_v1-v5-0-ba0bf3c6d122@virtuozzo.com> <20261023-vfio_v1-v5-18-ba0bf3c6d122@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 23 Oct 2026 17:13:13 +0000 Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.10.23-69.169.224.1 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MI3PEPF00008498:EE_|AS2PR08MB9692:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: f8226edd-7789-4c31-818d-08df3128ebd3 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|9140799003|61400799027|376014|48200799018|32142699015|261009223027099003|5023799004|4143699003|5063699009|56012099006|261021123027099003|261022075727099003|261022105027099003|261021121427099003|10067099003|16102099003|55112099003|18002099003|5113699003|22082099003|4113699003|13003099007; X-Microsoft-Antispam-Message-Info: CDakEBBLr+X1V/Gmbg5A3KkI4LWN77hEuo2LHFa/zVdnenRbzkI5Q92znbNZQbwCPHvbOkSUtdmHrUneaev/2dpCwFJQ8Nh37gzI50EknpG4xYH3mMh6DrawjIgmnZLXXD3IMRF5QyntEdRG7Xg9vA6oX1sKLYJ6IUR7R88v0c3ubcj7cg6vaBq+yAu1MhcoP/xeRwiLRFLeGZ1b9GLNGjlIOCIK/7IAJwgdwYyt4snuStS/IfrvbKewqIVX1uGTPvsV5jicnKMy5JjE3C40i3W7QaG5WYQNXXfr2OEWi1RXvrqyOvsUlX+efXMb1ua3lB4TsDcOQAuIXaCxA92iu6HBCwFxL6NgRTcVBDPTInfqlsrCGikLD6w1ImTsbPpdACEjY6HkjGZhZKmCi9FOkzpGTljcql19l4ru+hx1WN38kC+dmVxAAOEwCfeQiL9VXboyJdqaf/khTlbhuMLyr72R0cz5paPv7o0xXRTbRPEOf9J0kZpcXe6d9duN7364DYqpkJBuxOls1ssK30PGSadxHatTZGsbQCPSimVuUEwBrkUCAKpGcEMu7xkZPQ1tlgpijbMMcJ38szML1ggmAJjV4ivD7WAr6tc7DWLo+MNVyX3ypeJ57/ks2QpvnwzDFIahkZut7blVru9K5ZiazOWBwNtZDVF/FDXHW6eBzJdJDWGUqQ5OJrk4ZGhLXZ2z3jUEH2loLBUA78Es92LgV6N8X2SDsdBhkWyHSYq2BTnPiYbuY/FpT2DhgNAFeqRuvKU5lCleNla6EmYq7LvB28SoVPc48zFXJCAmWUblqY5jOoB+Axyc8SDFjdw4gxOYobBrQvfNPoVMVPa1/Kg/4Aa6QJj9ylpDG9+EN2JvmQwPy7Mbqj6cwjBhzOKbmlXn 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)(61400799027)(376014)(48200799018)(32142699015)(261009223027099003)(5023799004)(4143699003)(5063699009)(56012099006)(261021123027099003)(261022075727099003)(261022105027099003)(261021121427099003)(10067099003)(16102099003)(55112099003)(18002099003)(5113699003)(22082099003)(4113699003)(13003099007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RErgnbxKbOlHQ95YkKbURhDWH7inFoLkk3Nn+KOgaNti5J0WykSsme03UsSjKCDztjOT4doLdkmfhExq6omXygEIcXmof2r1Qe4JQ6DaxlkfGYWPCflZPyOU17L0fg9DYpfRZ/8Wq4KpRsB8nr60aStfaYRipAWQZMGo9VjXzABta+v88ykq8bQkqblRZSnAicC6OekN+Fx7jhZIxnQGlKJxOaMiwDO2Uq0ge1tGjn9ns/ieydOGseb+niKojTA4R5dftK5BPuOUKKybX851KThHOyA4WdnRxMRTcoW24Fj1vU5sMtvAoAnu94PN61CLqGn75OGcRyIR8UP5/ALEp6qlY5PwvME3EyLIQxPCDciJMm07DCEZLUBI3aZGIjxNWYds9CMWogZgoRBXj4RSUQf7+o6hRmK75GLathOd9Lr4I5ZIgeq/xTepz92Ke4Oh X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-Auto-Response-Suppress: DR, OOF, AutoReply X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2026 17:13:13.4163 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f8226edd-7789-4c31-818d-08df3128ebd3 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: MI3PEPF00008498.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB9692 Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Medium] migration: yank instance leaked when cpr-transfer is cancelled d= uring HUP wait -- commit 19f402394221e6bd3b3aceafbab4a2479e855a39 Author: Fabiano Rosas migration: yank: Move register instance earlier This moves yank_register_instance() from qmp_migrate_finish() into migrate_prepare(), so that it can be paired with the unregister in migration_cleanup(). It also adds unregister calls on the qmp_migrate() error path and refuses migrate while an incoming postcopy is in progress. Link: https://lore.kernel.org/qemu-devel/20260123141656.6765-11-farosas@sus= e.de > diff --git a/migration/migration.c b/migration/migration.c > index d5a21da3129a..cc88f70ae593 100644 > --- a/migration/migration.c > +++ b/migration/migration.c [ ... ] > @@ -2243,15 +2252,19 @@ static bool migrate_prepare(MigrationState *s, bo= ol resume, Error **errp) > } > } > =20 > + if (!yank_register_instance(MIGRATION_YANK_INSTANCE, errp)) { > + return false; > + } > + > if (migrate_init(s, errp)) { > + yank_unregister_instance(MIGRATION_YANK_INSTANCE); > return false; > } > =20 > return true; > } [ ... ] > @@ -2366,27 +2377,26 @@ void qmp_migrate(const char *uri, bool has_channe= ls, > QAPI_CLONE(MigrationAddress, addr)); > =20 > } else { > - qmp_migrate_finish(addr, resume_requested, errp); > + qmp_migrate_finish(addr, errp); > } > =20 > out: > if (local_err) { > + /* A resume didn't register it, see migrate_prepare() */ > + if (s->state !=3D MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP) { > + yank_unregister_instance(MIGRATION_YANK_INSTANCE); > + } > migration_connect_set_error(s, local_err); > error_propagate(errp, local_err); > } > } [Severity: Medium] Can this leak the yank instance when a cpr-transfer migration is cancelled while qmp_migrate() is waiting for the HUP event? In cpr-transfer mode the call chain is: qmp_migrate() migrate_prepare() yank_register_instance(MIGRATION_YANK_INSTANCE, errp) migrate_init() /* state is now SETUP */ cpr_state_save() migrate_hup_add(s, cpr_state_ioc(), qmp_migrate_finish_cb, ...) /* returns, qmp_migrate_finish() not called yet */ The instance is now registered during the whole HUP wait. Before this patch it was registered in qmp_migrate_finish(), so nothing was held during that window. If the user then issues migrate_cancel, migration_cancel() sees setup true and s->to_dst_file =3D=3D NULL, and takes this branch: migration/migration.c:migration_cancel() { ... if (setup && !s->to_dst_file) { migrate_set_state(&s->state, MIGRATION_STATUS_CANCELLING, MIGRATION_STATUS_CANCELLED); cpr_state_close(); migrate_hup_delete(s); } ... } This branch does not call migration_cleanup(), and migrate_hup_delete() destroys the source, so qmp_migrate_finish_cb() never runs either. None of the unregister sites reached from here apply: the migrate_init() failure branch in migrate_prepare(), the out: label in qmp_migrate(), the error branch in qmp_migrate_finish(), and the unregister in migration_cleanup(). The registration then stays in place, so every later migrate command would fail in migrate_prepare() with "duplicate yank instance" until QEMU is restarted. This also means the pairing with migration_cleanup() that the commit message describes does not hold on this path. This appears to be fixed later in the series. At the series end, migration_cancel() checks cpr_transfer_source_active(s) and calls migration_cleanup(s), which ends with yank_unregister_instance(). That comes from the follow-up patches "migration: Move CPR HUP watch to cpr-transfer.c" and "migration: Fix crash on second migration when cancel early". At this commit, though, cpr-transfer cancel during the HUP wait leaks the instance, which affects bisectability. Could the cancel path be made to unregister the instance here, or could these patches be reordered? --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261023-vfio= _v1-v5-0-ba0bf3c6d122@virtuozzo.com?part=3D18