From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <010701a135f9d1de-eb3a7ef1-a9c6-4003-acb7-52d0e2a31f85-000000@eu-central-1.amazonses.com> Received: from AM0PR02CU008.outbound.protection.outlook.com (mail-westeuropeazon11023098.outbound.protection.outlook.com [52.101.72.98]) by lore.virtuozzo.com (Postfix) with ESMTPS id C106B808A3 for ; Tue, 13 Oct 2026 15:55:32 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hLO7W2iZnObKur+fnhY0jGoMW8qcI6nsaU2ra+VvpDDIwjNKDAOEFKbY9XRERuucvJPFuLKVxqGUDlUS+E2VyZBEs578ukSZcQrLuBW/B03gje94GoW3dANIo7vy3dk/OfkpFAoJXinIbSNxYxIvYSTulJbFCt5wVB2gJUyEt3tBmmwFPL5duzxI13xZKcaBJOMxG4mnNMa93LbegJ2qItFWMSU5Cs3Vb+ieIx7Y0R/y9UZkh5iPZ9aIXU+JzmdB4L07C7MFUFJvrn5AFWm7ATD7OtFc9dxSb2ikyizWQdo4odfYxl1Nlrydd/xF7Gi7sQLvytMqRGur3qru3rrZ3Q== 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=VnmMScILdZl6StfzYUIwnvw3yLbxLaZecumWTgvOSPw=; b=gFD7I+1AVgmwyik/JNQxHqBd5j6oWOW4Bz0nbiYY0sNK+Z7i6r5PyQ14JpKC5vhZxxiqckTXxmHdzlA9+uohNoiCSjFxEh7VHEP74Sw2vfCRM0Rc2JO7gVRyZ5AJjMdojsueyrdHyOBQkq8QvTcWeDwgKuqB59mqcBJ7RzkPKDF5NhJocnTaYceTvldvT4fl0oGPBCYH8c9fl3GbprVg2l8udc3lfw4THJ2Eb307QpjcPtBItB/IpiDVapB+uFQxWkEgUDWGvkbDyVjIcsQ98Iw2uheG8lGpOp6PUiO0JqhDVDDIcszof3/20kfVgA2h2OFOCxo3okuU76IfTsZ+sQ== 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=VnmMScILdZl6StfzYUIwnvw3yLbxLaZecumWTgvOSPw=; b=QZK2dVK1Udld2qYcSnW5mtTrbc5PW84HErbmOUoNU8q1xFGhbvnNmbtNKQvOehjA71vZBmH24lhrYDydquZzBKeizlwqqRMjiCFXKoX3jxxf6g7yJ2AjVH8w8j+4D5LaxvDjR8gshIz4FN0e8O6qkIAEv46wecvjVcYEvxjG5O0= Received: from PR1P264CA0115.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:2cd::11) by AS2PR08MB10293.eurprd08.prod.outlook.com (2603:10a6:20b:62f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.522.12; Tue, 13 Oct 2026 15:55:27 +0000 Received: from ZR1PEPF0000E6B0.eurprd05.prod.outlook.com (2603:10a6:102:2cd:cafe::29) by PR1P264CA0115.outlook.office365.com (2603:10a6:102:2cd::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.496.5 via Frontend Transport; Tue, 13 Oct 2026 15:55:27 +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 ZR1PEPF0000E6B0.mail.protection.outlook.com (10.167.241.87) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.522.6 via Frontend Transport; Tue, 13 Oct 2026 15:55:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1791906927; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=iWpDeagKgNwjGyWvSUv3PnNJQu6BHfzIBmYRxcGps+k=; b=Vml8KYU8Z5IfYXkSzd37dkBfs48jXmm6y6xp1xj4UVi4uPJLfvT6IAsEhFc2YuXO 51FMxr3kS67jFETFHCVlWLNdwWzfrA9A3ZwxDYp0UXgC17/5LhsKUhUOLQhJSOWhDvL yHUQKxGNGgyBoBbtRplTX4Ny0zIptL048gAJcsbTL/q9ODHWQ3ujSKo7FK0AhOGDNIh dcW1TZ3s+1AGMyR+qB1QW0owt0PZdxTnAUAQoYAK55i0gJQH/23jk+7Kr+SyVa89/tu U2JqlB5gxC0RNCsRJCfYdUlaH+qNJe8V6AvGk1DxUb3Nx3hgIRDxtCRefmlP+/n1V/E Tx9O9Dst+w== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1791906927; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=iWpDeagKgNwjGyWvSUv3PnNJQu6BHfzIBmYRxcGps+k=; b=Te7647IgEX46R6ELo/NItvuweyKxq8r/yHHflC6n54yCQjukaMX6kGR7ok8POopr NyGCTyDEIBBbJ184PSi7jSJ3EV20wKr1Ii6VE4TZzMXYN/HPwv6bYC697lgJz5MxUl8 tDO141rnBrkXY3227tgoA9uHGFwyZgwzVCd4PSkU= Message-ID: <010701a135f9d1de-eb3a7ef1-a9c6-4003-acb7-52d0e2a31f85-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.1 v2 22/24] VZ: migration/cpr-exec: take the vhost-net devices back if exec fails To: Andrey Drobyshev , svt-core@virtuozzo.com Cc: andrey.drobyshev@virtuozzo.com In-Reply-To: <20261013-vfio_v1-v2-22-433455c0a294@virtuozzo.com> References: <20261013-vfio_v1-v2-0-433455c0a294@virtuozzo.com> <20261013-vfio_v1-v2-22-433455c0a294@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 13 Oct 2026 15:55:27 +0000 Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.10.13-69.169.224.5 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: ZR1PEPF0000E6B0:EE_|AS2PR08MB10293:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 8082e3d8-d69d-4319-b0bb-08df29426695 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|9140799003|48200799018|376014|61400799027|32142699015|5113699003|13003099007|4113699003|22082099003|16102099003|55112099003|10067099003|18002099003|4143699003|261009223027099003|56012099006|5063699009; X-Microsoft-Antispam-Message-Info: k8VluyilLccL3hhi2R5Tr6LZ5H/kVYGqpXSZLaCCNyRCM7CyHUhzV3ntGiUu7dmLScGBYPsQv0lIzwsVs6ULaogfuVsK5RcnNlcQ9GCikp1WFK4lO0Kt3Sd40HxTHQ1gY8ELirERe+iWegGfuydE8fjmm184uINrUAXymDMMX0iwPsFtxLv0q6tQ73FO2A3GtPP3U0zZAkFx663nOvORnw6VHnX1RpBiz5YuyQsJcXkvJ6FzOcipw0AB2meIjAqiICoPpSzSz+7ZHT3umxoP4c/OAJ++wJ91Prxjwt7jZzNSFRKaaw2f+IgrwhHJteIFDZa5L+3OS/Sqsl4R43PESVFBtFZIP1ax3UNLfJN9vjQEUi8daHnVZYduTUOVKesaEmTsEyRtHtzoLTYttCSxUN3Xeq3qkLxKZ320ZxqXu06dhdNhmehbPToUpoLUsTtOCODaQO3i6du3rv82lCAVrq9c3PRunwBGeRunTZZ5QklIgc7z5Gn9gt1/xrWHGsNUSzGBoqnqWf2SnQjxXB6TgR9zuj5YYUVgWcM5OZpmFWO+jkpegYPGNEJOe37WO/nVdGBVWrE6+uvF7N6I7FuXYIZ4MAWMNKjQvEFaVUZrNoPKWuhGrR5jzMoI++iMKiluovtOW2o/+DVi8Ywif90LT6K9BB2ig/+wiyuM1qCzN2Ws8TvVrROAcWvTxbRa5KhnssW7xfNj0hdF9oHGw8dmJkHFpNCsWFwCvaKNchmCT/VM3JLHozvTSiJMzunih27qBguAz2UQTWmgDUW1E3jkvhz3bM+0n9IrSbvIL8fl+46BywazozVQHCIHW8UqSIsb0ljsrSmMxawNpPXBeD4bEbN1SmP6DAIqDySgkWUTrymdZKphBHzK3ZuO8U2F+ONYbw9EBDuK6vbm5pnPAOPa/Q== 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)(9140799003)(48200799018)(376014)(61400799027)(32142699015)(5113699003)(13003099007)(4113699003)(22082099003)(16102099003)(55112099003)(10067099003)(18002099003)(4143699003)(261009223027099003)(56012099006)(5063699009);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H5fwRfbkmYBjvSSIy02j4IIB+azDupwJ/Yj9YagAnuEZysdUTGonkjq+OoeZ3FFmlCtzxZJ4E5iH0V4PzUkL1+krS6mPEhP9/208Ivy69oZHjBHdusjfSGKz3kkZ5YYXvRC/9Q1sD+psx7q7KkHqkwb1lHLMxgumGiWvKOMAFjrqdszGpvpovrdAVhzpMV76Sk3hp+KhnDT5Po22eJNAdq2AJslmRVLw/dJa2sH+kO0SQzLyvT54IpYkfGg78w7640VqikC8IFVs/aWTN4X+tH1WgqZ7p6yZjG56Miiq1oZFLErFuOCy4F/ASch+hMTvokOOQTT7qvV/T5yN53qQvjHM1IsRr+dS60ZqnP45gl5myGszAPOMw8jtoF0ITYc2qD5fFtoniQUsCGFHdDHxnQP7tzwODN2Z78eSoAelzLrSgqyOkqOqIcy172UWYp7y X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2026 15:55:27.4857 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8082e3d8-d69d-4319-b0bb-08df29426695 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: ZR1PEPF0000E6B0.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB10293 Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Low] vhost-net: cpr_set_owners() retries SET_OWNER on devices whose rese= t failed -- commit 5dfb07a07fff9bf62ccc97d74b7cefc2e5892991 Author: Andrey Drobyshev VZ: migration/cpr-exec: take the vhost-net devices back if exec fails This patch adds vhost_net_cpr_set_owners(), which issues VHOST_SET_OWNER on every kernel-backend vhost-net device. cpr_exec_cb() calls it after a failed execvp(), so the old QEMU takes the devices back that it released with VHOST_RESET_OWNER before the exec. > diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c > --- a/hw/net/vhost_net.c > +++ b/hw/net/vhost_net.c [ ... ] > +void vhost_net_cpr_set_owners(void) > +{ > + NetClientState *nc; > + > + QTAILQ_FOREACH(nc, &net_clients, next) { > + VHostNetState *net =3D get_vhost_net(nc); > + > + if (net && net->dev.vhost_ops && > + net->dev.vhost_ops->backend_type =3D=3D VHOST_BACKEND_TYPE_K= ERNEL) { > + int r =3D vhost_dev_set_owner(&net->dev); > + > + if (r < 0 && r !=3D -ENOSYS) { > + warn_report("cpr: failed to set vhost-net owner for %s: = %s", > + nc->name, strerror(-r)); > + } > + } > + } > +} [Severity: Low] Can this issue VHOST_SET_OWNER on a device that was never released? vhost_net_cpr_reset_owners() only warns when vhost_dev_reset_owner() fails and does not record which devices were actually reset: int r =3D vhost_dev_reset_owner(&net->dev); if (r < 0 && r !=3D -ENOSYS) { warn_report("cpr: failed to reset vhost-net owner for %s: %s", nc->name, strerror(-r)); } A device whose reset failed is still owned by this mm. After a failed execvp(), vhost_net_cpr_set_owners() then calls vhost_dev_set_owner() on it as well. From my recollection of the kernel code, which I have not verified, VHOST_SET_OWNER returns -EBUSY for a device that already has an owner. If so, the rollback would log a second, misleading "cpr: failed to set vhost-net owner" warning for that device. The device would still be owned by the old QEMU, so I don't expect functional loss. The vhost-vsock sibling avoids this. In vhost_vsock_pre_save(), owner_reset is set only after a successful vhost_dev_reset_owner(), and vhost_vsock_cpr_notifier() restores ownership only when it is set: if (e->type =3D=3D MIG_EVENT_PRECOPY_FAILED && vsock->owner_reset) { ret =3D vhost_dev_set_owner(&vvc->vhost_dev); Would it make sense to track per device whether the reset succeeded in vhost_net_cpr_reset_owners(), and have vhost_net_cpr_set_owners() restore only those devices? > diff --git a/migration/cpr-exec.c b/migration/cpr-exec.c > --- a/migration/cpr-exec.c > +++ b/migration/cpr-exec.c [ ... ] > @@ -243,6 +243,9 @@ static void cpr_exec_cb(void *opaque) > error_free(err); > err =3D NULL; > =20 > + /* Still the same mm, take the vhost-net devices back */ > + vhost_net_cpr_set_owners(); > + This is the only rollback call site. It runs after a failed execvp() and has no per-device information about which devices were released. > fail: > g_clear_pointer(&argv, g_strfreev); > cpr_exec_unpreserve_fds(); --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261013-vfio= _v1-v2-0-433455c0a294@virtuozzo.com?part=3D22