From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from PA4PR04CU001.outbound.protection.outlook.com (mail-francecentralazon11023127.outbound.protection.outlook.com [40.107.162.127]) by lore.virtuozzo.com (Postfix) with ESMTPS id 7616F80799 for ; Tue, 6 Oct 2026 16:38:09 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pWn9fxyPcxJpMXZHBNNe1koB0JuStVF7AYbde/3fsc+7zBAQ5FanRP+iTQFAUUnM0IZJQjmnSPXxYjQZWZ5UrqjzE9WpYmN/pJupkjNgo4Y67nVHYpZTUrTEoR58Dx0o9Y42Pw1qJ58AxQ3qJoTZ6xQOIqqYrsufCcwAxfPUKY5CMEPQ/TRysKd2opOvZsAvlibVwW0tTThAFYSgdbjVuI7qLDA60tKwj4Bds9jHle6OcDIOs9QQLzHOEGT4VOrc4kf+7D0b984R+Dos0HCauGaZ33YTfwoDt+6eFplwlcItC3MLGUvWpP7l/665tk+MZEhVktROHmONEPxK/69cRw== 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=1We5kjOb/HAGIVFv05+/mcBFC11XWsLPZr1FfsV6urg=; b=a4qecQkWGSoAHFyhVkk9vBfLzGcOFsMAfZ+5KxGtkRFVfq+HQABvdy3cb3ocg46UX5uIykcAVMh9x/eAnEHUqvKNmSsdBbw0szObtZRWjlipWeRMXPE8ptoXaSo10zw2/C2ErNZhCTY1IQKOfIQroZ9WB34DY6m+jdipfaClSmBUM1lME7ql4IGJrYZdEf6Wpy2Lhz6Olwpja4rhuqLe0ZcndrMfbL24YNtZ6WycISQ1F0iuslPelTjT/Yg8PqFnmzn+6vo7btOgW+hFlWVBqAWpXerLpWvCf6BZZbTn6IbmDztTUbHXHnLNFGBlcujMHUQwaeMxTyPXqs5JFb1ZFw== 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=1We5kjOb/HAGIVFv05+/mcBFC11XWsLPZr1FfsV6urg=; b=Vlnp2+vPqaeQjFJPm2hn+lTD4EJDI1D6r5n7wewnqlq6P+xqnEopAWbe9Ki1NVZ24ocI5n2ojySnTlNhcK75Xreq6IpLXgnmGcebCg5o8QIJSqBAEJKQqBID7B3wOTq57+IfZv8SZJ2d7jnIiAsTNp+2t4qM6ANMf+70EMkb7hE= Received: from PA7P264CA0484.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:3dc::24) by VI0PR08MB10757.eurprd08.prod.outlook.com (2603:10a6:800:1b8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.496.14; Tue, 6 Oct 2026 16:38:04 +0000 Received: from MAD0EPF000008C7.eurprd05.prod.outlook.com (2603:10a6:102:3dc:cafe::1a) by PA7P264CA0484.outlook.office365.com (2603:10a6:102:3dc::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.496.5 via Frontend Transport; Tue, 6 Oct 2026 16:38:04 +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 MAD0EPF000008C7.mail.protection.outlook.com (10.167.241.203) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.496.14 via Frontend Transport; Tue, 6 Oct 2026 16:38:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1791304683; h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Message-ID; bh=YpETytDYqw9XgfPv7Q4NNgHpeuc7HlZA+1MoImw5gzc=; b=RbJ51zN31JAVnmNJwnhxTKiTrTLaw4VKKy599eK4h5pTO2GRIMA2uiiCi8AYVIZY Ym/g2/2QlSqljs43V/nYs322grpInCOKGjTg2NrEvsRlToyaWHX+vR+v6/Yspgy5qca jANg3B52kDkQMDYczscm1APHOKdb55QPU9YUkluB7m/VffEPH3YzIzpMdbpbB8b9RtZ +FJXC8MGNPVVkeIiSTV8p3iF9LLxkU/b9OfsjSmhLvx1naTcvHEA/zh8hVoq0+B+CJi kUGH78/cfNq/3AvI6jK4fRVGqyBfrk4PXW3Zakticdwxu9G1cRctFcQ1wzQUwIyp9KU 4hhZtD3Wew== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=sokbgaaqhfgd6qjht2wmdajpuuanpimv; d=amazonses.com; t=1791304683; h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Message-ID:Feedback-ID; bh=YpETytDYqw9XgfPv7Q4NNgHpeuc7HlZA+1MoImw5gzc=; b=YZWR181VQZJbcfBzf4CZ+8vnrquWKNzNnKfchQO52P4iI1cQtLjlSD4gxbeRg8nl 7VhrVdLrwUxvhG5026ADBFBxEsv+u4xqiGTtd2h0S1FPCo9bMYs+fBC0rDufQR6DghK 7Q0MKEulIqhOexOr/UlyAM9RQM7X/DDPbxKoRy/I= From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.0 v8 04/14] usb-host: preserve hostdev FD during CPR migration #VSTOR-137800 To: Andrey Drobyshev , svt-core@virtuozzo.com Cc: den@openvz.org, andrey.drobyshev@virtuozzo.com In-Reply-To: <20261006-usb-host_v3-v8-4-72ae4fb8977b@virtuozzo.com> References: <20261006-usb-host_v3-v8-0-72ae4fb8977b@virtuozzo.com> <20261006-usb-host_v3-v8-4-72ae4fb8977b@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 6 Oct 2026 16:38:03 +0000 Message-ID: <010701a11214506f-0ed4ea31-38ad-4588-b12d-06bc909648c8-000000@eu-central-1.amazonses.com> Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.10.06-69.169.224.6 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MAD0EPF000008C7:EE_|VI0PR08MB10757:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 31e032d9-7d5e-43a6-b06d-08df23c8319a 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|48200799018|32142699015|376014|61400799027|4113699003|5113699003|18002099003|55112099003|16102099003|22082099003|4143699003|5063699009|56012099006|10067099003|5023799004; X-Microsoft-Antispam-Message-Info: QIDbRCA1+J3NnyUSE0W9AxNtZwbHG6HzqWV1jfjqhKfkdgg7tMqUUkGqRqNn5exUHZALSb8QBbCR3fguJ/TaQqprf5qnOmUKhGQGyBuWMMP2OyIyC/oLSV4/ZzZyuMKGOovQAIxyVMRuS/ubayiAPHrBtUIMzxh4Om4WCm4TK5zPmq5xId2f1m73Q4F1bNRcsukjkXmFYYEL9PB8I84CwVo/cJdwQOq7vatuBaJAcb/lBPhLr8YjGmT5vi0rvHdxU7h2rJn3Y68cmODga/jYBnaOhkfY0D8fEjeaB42fwxjWrtn09Jd1kLZPrheyn37oIgaI+B1vR9e6PeCcouSS2oTIU1k7Dkz8QqSeXS/zFq77iUOEghp/6tUv3aXPjSEJDRAyzVPh3gaxogfTLhl/apntQuCKFEhiWMH4KBHJm568pY5uLNgtbTnR2RW5SNDDUWIAHzU2wqErNcEqYt0mKdgi+zoH2pT9qeV5JaJzJX9VZfSr8/Z2Yi9Ygtgvtw+4FZVtWW/oUV3fPEGfsxTnQ5U6LZLpoJzHE/Kdo9PzkdQWdk/acYDShjM7esMRbqrdX06ZY40ZMI9GRRUEFvhp6DbI/JVKd2m/xyVygK3wLt72UBve+6ViTXVEj2cQb2sA24Qxnt7glHebdNx0+Y2wSQZKqj/xfRcSCBhYav6tAy29Qu5TIlcxDQR1XFXk3tRlo8E2+DLMlXjeLvxR560AczW+maknNMBr/Mel7EC4RtiD/B+BexQ2ZQWyUgVtjnUeux429hOLJWf3MLBP8ZxNH6F1ULfqQ2fIzmm8FBRs7Tc4X+h/n3iAL0uiHFKgoCHedQ97CoyFZv4VZRZI51G7lTVDFzMXNBIYgRR04iakbac= 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)(704161411799003)(9140799003)(48200799018)(32142699015)(376014)(61400799027)(4113699003)(5113699003)(18002099003)(55112099003)(16102099003)(22082099003)(4143699003)(5063699009)(56012099006)(10067099003)(5023799004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9mHfVnS7jY1yEdKujep1a9/nkBkgfzBzlS14o+twOTo4gy8V1Vo/l1FQ7lH8LwH3QpfCS/Gy47WFg0GHhk3bWgs7TWVp9s3QRZDpVaXHQA3WYlz1i/JMgUWjOcrVKrFx3Kcw3LmZjY2xU/ifYYjF+RZNpece4CSvbEiNpcLnn4gn3LCPvXnUGaLUdqJuXZimczJfu2EEOMuILNFkGWOnhSxVS/AfbNndI3d+9CZ9bgFX3ggAGXE4jr67tiouKluADA6b4L17YnlHKBTiENQUo7R0VC4R/P67k0uJXyRSVOFMtasltcf1mOjmLrU6bXXdwgGQkWrGoXJnOjk3sv81j/C/cpCcx6RVp4qPkR5cjnqPSkt8F/7ZjxYl5Q9Axobec7xO1Tle/x7XmHWYQDq8uTw+xRDz2GwlFNTrcbrLhgczNaa4YSKWLhhiP6gcZO3U X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-Auto-Response-Suppress: DR, OOF, AutoReply X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2026 16:38:04.1599 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 31e032d9-7d5e-43a6-b06d-08df23c8319a X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: MAD0EPF000008C7.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR08MB10757 Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Low] usb-host: cpr_is_incoming() in post_load stays true for the whole p= rocess lifetime -- commit 09775f4cee7af08e9fba2832c78f5e0afc56f940 Author: Andrey Drobyshev usb-host: preserve hostdev FD during CPR migration #VSTOR-137800 This patch saves the host device FD in the CPR registry at realize time and reuses it on the CPR target. It also deletes the FD from the registry in the usb_host_open() failure path and in usb_host_close(). Finally, it makes usb_host_post_load() skip the detach/rescan bottom half when CPR is incoming. > diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c > --- a/hw/usb/host-libusb.c > +++ b/hw/usb/host-libusb.c [ ... ] > @@ -1764,6 +1785,16 @@ static int usb_host_post_load(void *opaque, int ve= rsion_id) > { > USBHostDevice *dev =3D opaque; > =20 > + /* > + * For CPR migration, device wasn't released/reset, and the guest > + * is unaware of the switchover. The detach/rescan performed in > + * usb_host_post_load_bh() only exists for cross-host migration. > + * Skip it for CPR. > + */ > + if (cpr_is_incoming()) { > + return 0; > + } > + [Severity: Low] Does cpr_is_incoming() stay true for the whole lifetime of a CPR target process, rather than only during the CPR vmstate load? cpr_is_incoming() is defined in migration/cpr.c as: return incoming_mode !=3D MIG_MODE_NONE; incoming_mode is set via cpr_set_incoming_mode() in cpr_state_load(), and nothing in migration/cpr.c appears to reset it to MIG_MODE_NONE afterwards (checked at the end of the series). If a later, non-CPR vmstate load of a usb-host device happens in the same process (for example loadvm of a snapshot), usb_host_post_load() would return early. The detach/rescan emulation in usb_host_post_load_bh() would then be skipped, and in the final series state the CPR reclaim path would run instead. This is speculative, since it depends on a snapshot or other vmstate load occurring in a CPR target process, and I did not confirm that this is a supported flow. Is there a way to restrict this check to the CPR load itself? --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261006-usb-= host_v3-v8-0-72ae4fb8977b@virtuozzo.com?part=3D4