From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from PA4PR04CU001.outbound.protection.outlook.com (mail-francecentralazon11023111.outbound.protection.outlook.com [40.107.162.111]) by lore.virtuozzo.com (Postfix) with ESMTPS id C583180E7E for ; Mon, 2 Nov 2026 10:57:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MrSN5sI4+vUybNBgMZkNKjERYUOyEXf8MAjAJZdCHfIwJe5LyEmSP7MyCJMiarCulztN1RV7Qe16e+D+mIudejAgD6NtKrvNiVVOnwacxJvq3mhx2P8TXeP8QWmILy7knrhJCF6uZd3G8OLjFgGB2zm2qu8N6VL/6VRWUwafpbA1BpuHp8fGQmPTF+aiM8JPapELjtjxSIvulFoH72I+P3y8VCQU1+3x0CPBjcpNFyJMERotFIloiQ8mb0SPBrVa5PlcyXB8OxgX5GII9yS5xhApIi7n78IW75MT/hrUYy2twZhqa6JUXPa2bsS8b7Aavm2XlvGmzVp375X82j7Uag== 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=LWQ37mf+RgGfCMatgMNvt/ojTIAXL2xrf6dSDxetZSQ=; b=X1vPj5rStRDgIfpLk0aX/nqD8kaBmneRiw9BS2TKGLsTBBKFXyNYgWS2qF1iT9UAU/BACHBI7CfSrC8Ari+47X6kkEuCtCPyIgAtGdcoNZfRnGWwsMn3/XVBm+rJbdWlNk3aRb6wGnVN0zNAaHkavCjCDr68Dt/3KeCyM2LUX652NFLRB+zYrsvvCvAPAirPR/95XUZMJYU6GvU2lHa1E3azi6mbVbyAtvJe1GeTvI81fTiAlxFvdPfL5IE/26jb+VfIaEV1THhjPmbUOpbq/obmlhq3o4OH67tYG7p/fvQFwkux6YGdYNz0H/nfPw1PPWUjPAYz38Nq/GAEnwmV4g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 69.169.224.6) 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=LWQ37mf+RgGfCMatgMNvt/ojTIAXL2xrf6dSDxetZSQ=; b=XfTebp6nuiMFcxIO5CnlYdSpPPniPC1WInm8UMXB0dy7MtELsb95Oe5giRPoFPH8FXKv5n50EWeQj7yOK9Kjdo65KS0ETbTPy1w8bdKLCpJJyxSVLLR4RPqdWiLzd1hJwIDBpsQD0Ex8QVIHHjCzoXnMq+iz5Tj7/21omcMLfkg= Received: from MA3P292CA0020.ESPP292.PROD.OUTLOOK.COM (2603:10a6:250:47::6) by VI0PR08MB11171.eurprd08.prod.outlook.com (2603:10a6:800:256::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 10:57:30 +0000 Received: from MAD0EPF000008B5.eurprd04.prod.outlook.com (2603:10a6:250:47:cafe::5b) by MA3P292CA0020.outlook.office365.com (2603:10a6:250:47::6) 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 10:57:30 +0000 Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 69.169.224.6) 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.6 as permitted sender) receiver=protection.outlook.com; client-ip=69.169.224.6; helo=b224-6.smtp-out.eu-central-1.amazonses.com; pr=C Received: from b224-6.smtp-out.eu-central-1.amazonses.com (69.169.224.6) by MAD0EPF000008B5.mail.protection.outlook.com (10.167.241.137) 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 10:57:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1793617049; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=14/BpnhPdhtGYdBqI6rG6Vplp+T2VyP80giNnoWSRG4=; b=B8j99OiMPZSUdPk53nBRETTsGc8QHdeXOdMdmvFxV+uPTz6VaoAj403eKLS3SUA1 5aaeUrxWA2Z0+sc3TCMoO84mMXeGIMz3t76vAUmcEZ7EeSXL0xWL0d9a5Bq4+PoICjl L1BeYf7NOVrPM08Jz5jwYFlkee3Impj/ClwNEtbpjltGZiqcAP1bCaxJUg3U12niaEI kvIP3obqnBiajEGJCIh7rRhZbByhVt3fPjKZ6bAGnnzBx9VTza7nYgxxb63txclKxrd wSlH1d+yl2htk1neS//hjYwA0x7GQQFAnV8mR1nPDthPxNbCiww+TrCPTxljpknfOK/ PWYdXa9S1A== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1793617049; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=14/BpnhPdhtGYdBqI6rG6Vplp+T2VyP80giNnoWSRG4=; b=hxYFJNRiFhew///coeYseu2pDP4WITXA/AEJY/xpn1I47RC+xtVymBujUQ06DCtK uLYSzm+Xmg98fgAsZP4bM8uEOx1p16K7z9mj17PnfU4wlf8vbPL9HaDi3ByHm6f++L1 VfKThWFcYetlWA287MZVHCqyXzP+0DlknRimmeHg= Message-ID: <010701a19be83734-637960a1-537f-4fa8-957f-a9db6361d64b-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.1 v6 21/34] migration: Fix crash on second migration when cancel early To: Andrey Drobyshev , svt-core@virtuozzo.com In-Reply-To: <20261102-vfio_v1-v6-21-9bc7cabc850d@virtuozzo.com> References: <20261102-vfio_v1-v6-0-9bc7cabc850d@virtuozzo.com> <20261102-vfio_v1-v6-21-9bc7cabc850d@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 2 Nov 2026 10:57:29 +0000 Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.11.02-69.169.224.6 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MAD0EPF000008B5:EE_|VI0PR08MB11171:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 46275072-ca1d-409a-1e9f-08df38d016fe 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|32142699015|61400799027|48200799018|376014|9140799003|4143699003|5063699009|56012099006|261009223027099003|261028144727099003|261026121527099003|261026140227099003|261022105027099003|10067099003|55112099003|16102099003|18002099003|22082099003|5113699003|4113699003|10063799003|3023799007|13003099007; X-Microsoft-Antispam-Message-Info: N0IeRs7jXuuA2K1nk4hxiwNAgA6DN5Vc95Kgv1VILVlB5HHRZqNk2F+dP7IG6HO4tsFvHH6iFkAA2dd3sjXCgQdslglcW5+TMmeVIQgu9nBRR+uKcdPbeMPuZwngVrf2lbDuJCVPm36lNSUQybKT7ygNGPoq7iOW1KXS+HotA98lQC2NBDJy5tWMrM3lqYhTvdJNReUeJaBwgMeCucOSnsSIFXyCmoQHYiOhNZQjgjOh6Jd8c3tkD0uiQnzXYMM+kS6UEA/6fN06ng9Jl8HYSoV7rdKpUKnIq4Ng38VCmwhm+IRK+vLG9DMl48E8mZ43o/JpKXT65dMQEKWg+Yc40u4f4rbFlFmovAT8PvMo8B3UuOSXtDgUxsqQWq/2r0J3ms/WdeCSW2CJDt3spHYhg9Ioig1aqmxX3HtlkmS/uxM9AoPWrqxj3XVTbsAD6dZvl6qtVp919/lOMlsrOhm8yzYYHtE9fOrUhOMmsmdShGlK2ZMTDpmXEhH16s6OcNFsSACywPrMuE1mkrQKdP7pKf9lAAdOcbzw8+fNGn3NEjtKQeItlmXreld34gEI03nP5cebNHbHsoY+CNKidbyK9Mt/skaI1qdA/qOPTScEsk7HZrJrN7pxYz7HA1aFYrWgM8sfxwSM34Jzy8jMTyOa29cdFvhB2KU7ZIu7nnJwMqCS8Qo1CR83kC/Je5KjUKdSYp0vwdFsny3n9iIJcdmwuhAmX9zBUjGHsO+PQoYl0dzMENTkr/ZgfL9mlpzIrEsla9fRciL9y6XafQ6A2tls9ZHInSkOEJsqRlCvEMEivgQRSI4RSeDMZg0tCWKMNnM3xz8j3m/KVxWBT7hx3DEAxQ0rXPi44gdF4EooprmvJfqIUd8P7cKL3S+OcwPxgan/ X-Forefront-Antispam-Report: CIP:69.169.224.6;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:b224-6.smtp-out.eu-central-1.amazonses.com;PTR:b224-6.smtp-out.eu-central-1.amazonses.com;CAT:NONE;SFS:(13230040)(32142699015)(61400799027)(48200799018)(376014)(9140799003)(4143699003)(5063699009)(56012099006)(261009223027099003)(261028144727099003)(261026121527099003)(261026140227099003)(261022105027099003)(10067099003)(55112099003)(16102099003)(18002099003)(22082099003)(5113699003)(4113699003)(10063799003)(3023799007)(13003099007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3myrA8/Y1Gy1w9UMa9h8zYgav8WzROIUVGvBz9ihi8jeTLk3C72JTIimMIdhjYjby6NfAuUE6SHqGNQSQxyNvNjyekRIy6bgglBGMLLurb8B8i82K/8lE01P0JFnBpFluAMN970h+8hrHFfRrOgb56YTFKtkyBvQaVBD55UIondI18rBXhurtK5KCzE3Gw7GUNhpcCeBemG8/O+Gyfe2b1MLOT9ch8Iq8priddp4mlXogJYymsHOAFX17x4wkB4NheiA3ehkM54mrtvlHLfLp48bxGWI7P9Q0GIn9kqOoT18lA7pLOTrkHTVovqctXYOmo0Ty9/OtXc68gDT4tHRWzabTQVDi+zLlRTqRc8gSr1Uosqef7p6mPJUpLyC8QixWGX9vcZ2qbbAIPbC2FUcEIrdErRzhMlJjmhkY6orp45m+gmJd/GqE1S8p5OkOwNX X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-Auto-Response-Suppress: DR, OOF, AutoReply X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2026 10:57:29.9074 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 46275072-ca1d-409a-1e9f-08df38d016fe X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: MAD0EPF000008B5.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR08MB11171 Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Medium] migration: assert(migrate_mode() =3D=3D CPR_TRANSFER) in migrati= on_cancel() can abort QEMU -- commit 4600a9bb3fca173c79b21943fa97310ae3af2659 Author: Peter Xu migration: Fix crash on second migration when cancel early This patch makes migration_cancel() call migration_cleanup() when the cpr-transfer HUP gsource is still armed, rather than special-casing the SETUP state. It also detaches hup_source at the start of qmp_migrate_finish_cb() and adds several assertions. Link: https://lore.kernel.org/r/20260417184742.293061-1-marcandre.lureau@re= dhat.com Link: https://lore.kernel.org/r/20260421175820.302795-1-peterx@redhat.com > diff --git a/migration/migration.c b/migration/migration.c > --- a/migration/migration.c > +++ b/migration/migration.c [ ... ] > @@ -1661,14 +1661,19 @@ void migration_cancel(void) > } > =20 > /* > - * If qmp_migrate_finish has not been called, then there is no path = that > - * will complete the cancellation. Do it now. > + * This is cpr-transfer specific processing. > + * > + * If this is true, it means cpr-transfer migration is waiting for t= he > + * destination to send HUP event on CPR channel to continue the next > + * phase. If so, do the cleanup proactively to avoid get stuck in > + * CANCELLING state. > */ > - if (setup && !s->to_dst_file) { > - migrate_set_state(&s->state, MIGRATION_STATUS_CANCELLING, > - MIGRATION_STATUS_CANCELLED); > - cpr_state_close(); > - cpr_transfer_source_destroy(s); > + if (cpr_transfer_source_active(s)) { > + assert(migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER); [Severity: Medium] Can this assert abort QEMU? migrate_mode() is not latched for the running migration. It returns cpr_get_incoming_mode() if that is not NONE, and otherwise returns the live s->parameters.mode: migrate_mode() mode =3D cpr_get_incoming_mode(); if (mode =3D=3D MIG_MODE_NONE) { mode =3D migrate_get_current()->parameters.mode; } As far as I can tell, qmp_migrate_set_parameters() and migrate_params_check() do not reject a change of mode while a migration is in SETUP. Consider this sequence: 1. qmp_migrate() with mode=3Dcpr-transfer runs migrate_prepare(), then cpr_state_save(), then cpr_transfer_add_hup_watch(). hup_source is now set and the state stays SETUP, waiting for the destination HUP. 2. Before the HUP arrives, the client sends migrate-set-parameters with mode=3Dnormal. 3. The client sends migrate_cancel, or QEMU quits and migration_shutdown() calls migration_cancel(). In that case cpr_transfer_source_active(s) is true but migrate_mode() is MIG_MODE_NORMAL, so assert(migrate_mode() =3D=3D MIG_MODE_CPR_TRANSFER) fails and the whole source QEMU aborts. The old code in this window did not depend on the mode. Would it be better to drop this assert, since hup_source being set already implies that cpr-transfer armed it? > + assert(setup && !s->to_dst_file); > + migration_cleanup(s); > + /* Now all things should have been released */ > + assert(!cpr_transfer_source_active(s)); > } > } [ ... ] --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261102-vfio= _v1-v6-0-9bc7cabc850d@virtuozzo.com?part=3D21