From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <010701a1456fdeb7-96b93de3-5f98-4485-baa5-f842a6cbd5db-000000@eu-central-1.amazonses.com> Received: from GVXPR05CU001.outbound.protection.outlook.com (mail-swedencentralazon11023142.outbound.protection.outlook.com [52.101.83.142]) by lore.virtuozzo.com (Postfix) with ESMTPS id 5062D8017D for ; Fri, 16 Oct 2026 15:58:46 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qfro/x7+3j01dJRSed6mKGs1HoTax2I/VD/J7lPcT4zQBvsRImum9jza1u9t91SUm+Uvb/mx7hC5A7mgiCmqtOTUO/xzuQGo45/n3iV8qk8gJQU0rWuAtWZHIqEmN8oPex3Y7ALsJ0N+wnT4u0aNACAjrzu2XwzqxL0nMm9R6EkBYbm9RjMHqKBNasvna+9ZYvNo2T5yDH28W87/LmOlxDxeDo54ciY+XIfEmTpI/dC6K0gseuGcR27WL0qAJ7TzFBT6cyKsuiVfBQCdCXH/JAfQk22HGtO81Xnb7uuI3X+LDyzZrdCsTIqlSs75En2ghXCZq76nfSIG/h5bS5q4tw== 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=FGhDoty0wnctBeUHRtfIYVnTmj4H3S3n4KONx/aGVic=; b=C8zQud2J8B7Abs7seTRWDlcqn3D/60WFIvi4XWKaIciHcdhA9yLiySLRFoBIJ33vHvEIHQv+afDo/QHiNp1rYg4E8FJuLBp6BftADs0gqAlEakV+PgI6+XiyXlEgiUe+G7jV9xcatSINMbLkTsycWDousEI6468Cm0gbs6GlSl1749GQj/aLkPnlB4Ju3B2LTp49S1EfI5Xuwr5jbblCCK2uO6hWMSq5VjyVGQVSQrRK67t58JRE0VRbhEF/xscYkmVOjfNB+k8//OHaNg1R+Z9GpvvTsCnFD5b9/X0CN9O8NPUZBQrsaKYbca6Gn4irj6CCwUSyGzI7e6QKpk/xsw== 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=FGhDoty0wnctBeUHRtfIYVnTmj4H3S3n4KONx/aGVic=; b=cbunK1R0mottvNsM9Mg9prRPdsynK0iaKGD+KsloU42IaQagWycF8E2RZNo7d3UCH7XNK3sk2J2tDSN75VVEr3gHqCWSAgthx1U/X+CzogqM1dFXzQcxEyZ/NXBpaU0UYh4biNf/FpBQZubKA9GaAYb1yeUaDAmvAonXy8HRnaQ= Received: from GVZP280CA0026.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:276::17) by DBAPR08MB5815.eurprd08.prod.outlook.com (2603:10a6:10:1ab::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.522.12; Fri, 16 Oct 2026 15:58:43 +0000 Received: from WA1PEPF00009B3D.eurprd05.prod.outlook.com (2603:10a6:150:276:cafe::14) by GVZP280CA0026.outlook.office365.com (2603:10a6:150:276::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.522.4 via Frontend Transport; Fri, 16 Oct 2026 15:58:42 +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 WA1PEPF00009B3D.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.522.6 via Frontend Transport; Fri, 16 Oct 2026 15:58:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1792166321; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=c857oM8IWkhiIoXYy/DyqZJ6EL7gBrUpBNrU3nDY32Q=; b=2N3Un43XOMF40lVsfTNldnK71wzXuIiw6TtQAawyOTNw6VJoZ6dhxMmHOR1/WW79 sZAHUiHUE4YiSBdhDA6kEtwZDgwKWPmOxIcbZ/7e2c+sXBtH9G6cfGYpmMtgeQuZsH1 g80LOK3Sf634Z94z8KXTHh1wKt4n13ZnZhQbMEBrdMmG2yGIgq6jSqRCzqpKZbsALKi B1TtloAASmRxAxeKmKsi2tIUITBLM3Nb4DA6rL4lOY0LR35K9m3reuypMe9bc/QvG87 zm52tfE1WYyGxO/cpqPvFJe4yzAZ7+E86Ba/Vj7YlIVvQ0TmGXDG7lCkhkqeajzz6PF mqVP1tgN7Q== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1792166321; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=c857oM8IWkhiIoXYy/DyqZJ6EL7gBrUpBNrU3nDY32Q=; b=WQAOkCO0Shaf/yc4FMKBovZKhTAdgEzhNqVMeEhJ1EzuSJvu5hBYoPM8yJs5mhLV p0C6KCx2JfIWlerznWhQuc6bIjaX+K1dlNmnYe/qMZE6f5OLCw6rbPIS31TWbVrV5+g 2cIjtENl92qzPE/DvA5YcwG30q56dgP/v0QyG/58= Message-ID: <010701a1456fdeb7-96b93de3-5f98-4485-baa5-f842a6cbd5db-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.1 v3 25/28] VZ: migration/cpr-exec: take the vhost-net devices back if exec fails To: svt-core@virtuozzo.com, Andrey Drobyshev Cc: andrey.drobyshev@virtuozzo.com In-Reply-To: <20261016-vfio_v1-v3-25-47487cb5a8e5@virtuozzo.com> References: <20261016-vfio_v1-v3-0-47487cb5a8e5@virtuozzo.com> <20261016-vfio_v1-v3-25-47487cb5a8e5@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 16 Oct 2026 15:58:41 +0000 Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.10.16-69.169.224.5 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: WA1PEPF00009B3D:EE_|DBAPR08MB5815:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 7415858f-2844-4649-724f-08df2b9e59f9 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|61400799027|32142699015|48200799018|376014|9140799003|261009223027099003|4143699003|5063699009|56012099006|16102099003|13003099007|10067099003|18002099003|55112099003|6133799003|5113699003|4113699003|22082099003; X-Microsoft-Antispam-Message-Info: Mt3iT9vaY6HJts6GE0iSGZ0HKbl9FaGl1C2P1CHEEFuVTsPQOArSitqwIbaaVAGT0YMI4jyaJMTHVZYDN042Vk9vIw8zasx96Ku0XvSVh1LOibOZogEw0rk8tfeTw++3SjbedmOPxJnotjZUS2ppsK3RZ+TzQ8dIu6ZqSJ6PCOvIXgLmen5lbnK8QwP0gP+5ww559vAO9hHW43GlGAfnmtZnATO9swDoTacl1T43hmUhwog0s1Chpvb33sgj4mQtSB+isylicNj6sc9WmfVpwKgFf2/zHbEP8qdJ4bBDuXJYo5EKX3SvTmsa69c2TKyDeq8NnRgWuC9w/NDGHDZokv4T1htBAJQ58HbHRZ5csMlJSy92og7gy1DbW0nr8nbQo2ttsgjvk+dpkK4iU0LzsmbJjyTlH3q0aiVv7eZneuHuxAkHoZyRbCro+65c1B/9gdiVQW+dsvblervrtblXHbbcB0/M+mZUV1n6j8gN4P99kbuOHI0Nb1xpi1iE2Qv1OFPnfs2mPZQz1kQ7EbDAkfFU9c3CqOjFs2kA6ojiw7jHX6EtU3ngxkFo7Bm/w+WtF8Mll5I8xnLMXONt6QTDAI80rXI3ZyCOhIXJVlDl1JcxrbKM2YJ5mPDNwws70VqTJMTR4gbnHbM8nXx0zjmtBPP0q6xCFObkgZL1dWe5qZ2G0pSKJQWS5iKn+OITUGuir7hS+JNq3NnK+oU1kY3HEL2gMWb0gFA9Nna6bMAM7Byh/P9HgkoWjURPX6WLjZ6H8RigEAoeBxBsQfCSTaCjg6iTPlWvhMO/cSGsq9a56nV/cYFDmiewFbZ9L7OsFnGlCeddYVYRfWuq0AWukz6uodJy/7GTgo/pJk48pPMG3UY= 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)(704161411799003)(61400799027)(32142699015)(48200799018)(376014)(9140799003)(261009223027099003)(4143699003)(5063699009)(56012099006)(16102099003)(13003099007)(10067099003)(18002099003)(55112099003)(6133799003)(5113699003)(4113699003)(22082099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: X8UfANcvMLa75uTFZsQZczGQSw9NbfGtRDafiyEQsJfK3pVf3/MXIY3togegx8rYQyLygdhU2fWLe7ju2OBdRWoQw3pL0YyQltgmdrJB8EniuRdJE2874nWeId/f0xL06wt+/jqEN8o9SrGCVbj4+kN9sb4dBxxR6k5CDxdkkTHNxfL9y+q6+iueIee0CXlEIQHzXM2bOjeNXf9sCsvmK+6V+K4dcsEGPBQeeI94bkHyUD7y5BQMpqzU8j48+4x54BSG79VsvyI1UNRwoJ+BWRBWAlr2CTQlr9Fv6zY0cdXq6MmaC5sr4vYzDg0c8ZI7P39kFczZVoRelO1rH6VAHzQm9KFqa/xAd9lgvboYTd+NdJU2LbHDWLKXimzDTOuKzQhy6MQiJ6vhlxr5bYedwAq+DV34Ue99D72aFst4E5N2ik6+YNmqfbnbTrjx5PKy X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2026 15:58:42.3176 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7415858f-2844-4649-724f-08df2b9e59f9 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: WA1PEPF00009B3D.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR08MB5815 Thank you for your contribution! Sashiko AI review found 2 potential issue(= s) to consider: - [Medium] vhost-net: cpr-exec failure path restores only SET_OWNER, not th= e vring err/call fds - [Low] migration: cpr-exec calls vhost_net_cpr_set_owners() with no stub i= n vhost_net-stub.c -- commit 4559492d0874959294013f874fff0e018375087a Author: Andrey Drobyshev VZ: migration/cpr-exec: take the vhost-net devices back if exec fails When execvp() fails in cpr_exec_cb(), the old QEMU keeps running. This patch records which vhost-net devices were released with VHOST_RESET_OWNER in vhost_net_cpr_reset_owners(). It then takes them back with VHOST_SET_OWNER through the new vhost_net_cpr_set_owners() on the fail path. > 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 [ ... ] > +/* > + * Take the ownership back when the exec fails and the VM goes on in the > + * old QEMU. VHOST_RESET_OWNER has reset the kernel device, but the dev= ices > + * are stopped, and vhost_net_start() sets everything up again when the = VM > + * resumes. > + */ > +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->cpr_owner_reset) { > + int r =3D vhost_dev_set_owner(&net->dev); [Severity: Medium] Does restoring only the owner here leave the vhost device without its per-virtqueue error and call eventfds? vhost_dev_init() registers them right after SET_OWNER, through vhost_virtqueue_init(): r =3D dev->vhost_ops->vhost_set_vring_call(dev, &file); ... r =3D dev->vhost_ops->vhost_set_vring_err(dev, &file); As far as I can tell, vhost_set_vring_err is called only from vhost_virtqueue_init(), and that runs once from vhost_dev_init(). Neither vhost_dev_start() nor vhost_virtqueue_start() calls it again. Would the error fd therefore stay unregistered after VHOST_RESET_OWNER followed by VHOST_SET_OWNER? The call fd looks similar. In vhost_virtqueue_start() it is re-set only when guest notifier masking is not in use: if (!vdev->use_guest_notifier_mask) { /* TODO: check and handle errors. */ vhost_virtqueue_mask(dev, vdev, idx, false); } With use_guest_notifier_mask and MSI-X, a vector that the guest keeps masked seems to get no call fd after the reset. The initial setup had pointed it at masked_notifier. Could a pending interrupt on such a vector then be dropped, and go unseen by virtio_pci_vector_poll()? I have not checked the kernel side. This assumes VHOST_RESET_OWNER clears error_ctx and call_ctx, as vhost_dev_cleanup() does. The comment above and the commit message say "vhost_net_start() sets up the rest again when the VM resumes". Is that accurate for the vring err fd and for the call fd of masked vectors? > + > + if (r < 0) { > + warn_report("cpr: failed to set vhost-net owner for %s: = %s", > + nc->name, strerror(-r)); > + } else { > + net->cpr_owner_reset =3D false; > } > } > } [ ... ] > diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h > --- a/include/net/vhost_net.h > +++ b/include/net/vhost_net.h [ ... ] > void vhost_net_cpr_reset_owners(void); > +void vhost_net_cpr_set_owners(void); [Severity: Low] Is a stub needed for this function? hw/net/vhost_net-stub.c has no vhost_net_cpr_reset_owners() or vhost_net_cpr_set_owners(). hw/net/meson.bu= ild builds that stub file in place of vhost_net.c when vhost_net is not available. > diff --git a/migration/cpr-exec.c b/migration/cpr-exec.c > --- a/migration/cpr-exec.c > +++ b/migration/cpr-exec.c [ ... ] > + /* Still the same mm, take back the vhost-net devices we released */ > + vhost_net_cpr_set_owners(); [Severity: Low] cpr_exec_cb() in migration/cpr-exec.c is always built and calls vhost_net_cpr_set_owners() with no guard. In configurations that use vhost_net-stub.c, would this give an undefined reference at link time? The existing vhost_net_cpr_reset_owners() call in cpr_exec_cb() appears to have the same problem, and this patch adds a second undefined symbol of that kind. > =20 > /* Note, we can go from state COMPLETED to FAILED */ > migration_call_notifiers(MIG_EVENT_PRECOPY_FAILED, NULL); --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261016-vfio= _v1-v3-0-47487cb5a8e5@virtuozzo.com?part=3D25