From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <010701a1214a8e71-c4898e2f-2bfc-4f6a-b3ec-c45d4ea1a080-000000@eu-central-1.amazonses.com> Received: from OSPPR02CU001.outbound.protection.outlook.com (mail-norwayeastazon11023137.outbound.protection.outlook.com [40.107.159.137]) by lore.virtuozzo.com (Postfix) with ESMTPS id 13E4B802A5 for ; Fri, 9 Oct 2026 15:31:40 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uXvl7ov+TLhl0q2V1iIjREobf3nYx9Uf23XaJWwNJAxNW2URDZXVFnsaZDp0sRrWYp7pcvK5M3/ysejLSxB15KWgYM5o5VO2GfuUMK0UwUTpcZpwBPKe8fmzp9iUFEmAxcb32uLXHgN6heeXa44XlsHKuJy6yl0aBrfO7VqqM02iqmT8ypjwqYU7MzkKWEGqvbixFvQ1VZVYVhcGiO7SUaMkzoWs0qLTK4tlWukCJKHisAPOa93YswmoPOy9DjlyRprX/cdcR3IOyXZ9reXgGkbKjSFow1xs00CI9xtcQqvW4Ug20qCjgFBxYaOFXoIUXcUKt3XbqIqqINjEwRywAg== 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=7gyBKeu5A7RjSizyb7xWpA8YoD6RsaWWtVDKEdvmNAg=; b=WOxwEvzsHmKbnIIViynVka7/EmSFYVw6rEwsOMRbtLORDc/4dh9BuNxq32cx3DWsMEnFmvZ0qMoEntZMTopQCMFvdfAOF5Uig75wWGLaf9dqir2069DlxFIcQMOZ1o8ys3OvW+zgtgz928qLWnCkqyZU3kPE0Zh3Nc1q9GMqODUu8qWOBC0LwLt0ZMyrIeg3K21pNMhU/K871IhLvXvxg14YPv/zY4ecPPuXg9fexMKCXGKSd+o7jMlkSJdGQAUKTUoujmtRBSuEMKVHOwY8qm/OT0q0w4VgDrDphkKvWRuIq4brd2nBwlx6kUvG5zllwT/q8xDeo9yBGnumComCVA== 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=7gyBKeu5A7RjSizyb7xWpA8YoD6RsaWWtVDKEdvmNAg=; b=RLbJV29heOwEKwbtHojL1b2kp1xucQ0Pvd+dGlkHYYKcH9DX3Lavnen9JwxTIWWmJzV13IT9f2/282xKbAFndyby597/0XnhpZPfx4xF/hLPZsAmbTTXVgdc6s+wgX+CZOAwgb9D/Jy4KpNGhc3ig+/0IhZYpuerzK6pt0Ah4Vk= Received: from ZR1PEPF000077E1.CHEP278.PROD.OUTLOOK.COM (2603:10a6:918::418) by BR2PR08MB999933.eurprd08.prod.outlook.com (2603:10a6:2c8:14::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.522.5; Fri, 9 Oct 2026 15:31:37 +0000 Received: from MI3PEPF00008490.eurprd03.prod.outlook.com (2603:10a6:298:1::57) by ZR1PEPF000077E1.outlook.office365.com (2603:10a6:918::418) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.382.11 via Frontend Transport; Fri, 9 Oct 2026 15:31:37 +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 MI3PEPF00008490.mail.protection.outlook.com (10.167.240.151) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.522.6 via Frontend Transport; Fri, 9 Oct 2026 15:31:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1791559896; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=O1KhQva+elaVrUVU4+Rkm2f/7C2u9XRfwbInDo9nxdA=; b=12CHciQk+m1EF0AohF1QWeBdr1ntR8eDhguFq4Si0FnxhXPv8pV4uuDXveGIEZ4e naCzQ1PA0CEBGKTGreBlJlqqXnIPrcrwZndV/KDLnMJnSOEuZQKQsBC+ouEstMbJM3Q tBT/pLK6UivSHYv5mcY+tPZiwNAWdAemrPgaXFTQzhvGPAaDqWxo5Ma05FCI5S3zHEe iIqK/b6X8E3lDlxwzQls57Y2apvYIuWrBtK81o9kM/exBP2Cf5SPqjyBqurPQtKBDfH AGAKUnCFbmfsx2qxBYJyW0lpKXyrjFDsPOJ24+HldbdBDF+YeZ0DRfwmyFmvca3hRri 2WutfLhN1w== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1791559896; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=O1KhQva+elaVrUVU4+Rkm2f/7C2u9XRfwbInDo9nxdA=; b=LIvZOB9CDQBgjFkGbDeoJZ5V0TuWMGDrhrqJkY2tjv2feo+bsfH+qgx8NWD9kkPU s2HiOL8cdDGcU90kkxyEFrmeF9F0l9qIymZ0LpNGpDqqloX65cMNR22UJIH2yJEor2o n90ciUI3xCQGGDY6mk7GL2G0d87ROr88zd35CM3w= Message-ID: <010701a1214a8e71-c4898e2f-2bfc-4f6a-b3ec-c45d4ea1a080-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.1 19/21] VZ: migration/cpr-exec: abort cpr-exec if memory can't be preserved To: Andrey Drobyshev , svt-core@virtuozzo.com In-Reply-To: <20261009-vfio_v1-v1-19-2ae91d5b8048@virtuozzo.com> References: <20261009-vfio_v1-v1-0-2ae91d5b8048@virtuozzo.com> <20261009-vfio_v1-v1-19-2ae91d5b8048@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 9 Oct 2026 15:31:36 +0000 Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.10.09-69.169.224.1 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MI3PEPF00008490:EE_|BR2PR08MB999933:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 24ba3f04-e0bf-46ef-5b08-08df261a686d 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|376014|9140799003|32142699015|61400799027|48200799018|5063699009|56012099006|5023799004|4143699003|260925022911599003|260925021311599003|22082099003|10067099003|18002099003|55112099003|16102099003|6133799003|5113699003|4113699003|260925021911599003; X-Microsoft-Antispam-Message-Info: yjfR+A8CGBEEbzolQU10T52Mcv2RREriIEe3NJr+IlWSeVFo5YmeHEW2rWAbZ3/A2Kr7C8Z8ifN+vJSso0jBUSd9D61bYzZiuJ2GcRDqTrI8xMeYWV2BOd+FK2za71KXaDoauzw5ftEyulkuH7YM7c3T8D6grfEOvWgavG6k7HVmEu8v60viLMmI8Wm29tTjPr1f7r8qiSptlpmyaf/Q/tJziI0bQhUDQp0mboH6EXoPsWX1CeEhJeX0y1aBRs+tR808+ePj5xdYexZ2L+X2n/EDdRXj0GpnzZUE8RWxENCb2xSBLonWcBmjhpsGeyYMg6r+tea8lQXbgkd4I6oNylXrSydVgKFwO6jyjKr97K8Cz2ijQUuRNk1JChKCVKjHWDhagR8nRsY+D08LLYjGScucJJADxEA4M2DEiY76qRpY+OTDtwO+Kw7BDSFNTsq3CuRsJRU3qi8xtu9jvP8Anw/ETz0IJYqRyguFyvMNmwOvViVLwJAZAXvY5fWbIUFUlNOw4p16zhOQOCNVhR8F8If7aSCDqGAuuETnhwPXP0EMR/Sm1HGFfru1RNCLpzXXkbEpIsyWGlWwUV9NLbadposW0WrBhoBzYZyWReUXrQ/jzRlN+GB6g4tJgH+QiQ4dUXU9zx6/B4GLiEkScHbfJ6PnUJ7o1/bSdKcWoqjTW7wR4qqsenZZXBkiBDiEHyuCQaPGDO3386KvVCZ77+hc5CHPHxVq5kMxKmbktePUcUhLRG2t+KHRdBY0tv98ws/bxXrdRU2Oa8CKgj24piutHUDQUxP7z9z/b3OmJDAvRZfLMxZS65J6DoMKZa/OEQH6fHxp/MbIW2vdZfjzLCh9Un+Re4BI7VcFwm57ETQ8gD8jHquImyhWoVEwkg3sJyN+EPx6ABzSpBV6kLUBES+S5A== 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)(376014)(9140799003)(32142699015)(61400799027)(48200799018)(5063699009)(56012099006)(5023799004)(4143699003)(260925022911599003)(260925021311599003)(22082099003)(10067099003)(18002099003)(55112099003)(16102099003)(6133799003)(5113699003)(4113699003)(260925021911599003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: K2sdl0E3R7rvStU4hvmrg8CiIq3zLytfMRtSH7vU37hSSnIKxrAg6OKBzpeEMqyaUExaLLx1fG5+UzUur32Pes+UxYOw+1GvDqMO2nE2/Eh3rhIHhrVVKwWwfCDpcN+0VRmJOE6sSoKIEb+tgy+1PfD+oNXjyOOwa3aVaxKRuJOK9URKyrExDqeiXX7YpfdHVFGvOsEOxpizzcqd/GgFOpnb7sjREP4QvFQbhiPo/eBoSp1zMLCrIKz9pZ1HT5o7clZ6gmeWHpyojlVNJplOCfHYLyhlyc1EVtXaFY6c4dw9Mf2Jf9wdN1jZoLC1cWgfga6+OKNSp5ANxAewTiIaEx2jaxwUyjzf5ylOitjN3Jt+6LjjYUDASsM+/YYK9QKf0ei7GLCUWDHEF8vL0Rgv9ZL2UNmzWppMUMkKnKp1TonVzQskS9Y+POUud73oy+q6 X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2026 15:31:37.1500 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 24ba3f04-e0bf-46ef-5b08-08df261a686d X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: MI3PEPF00008490.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: BR2PR08MB999933 Thank you for your contribution! Sashiko AI review found 2 potential issue(= s) to consider: - [Medium] migration: cpr-exec failure rollback does not restore vhost-net = ownership - [Low] migration: unpreserve_ram() ignores MADV_DONTEXEC failure in cpr-ex= ec rollback -- commit e886be97f560362e9b11744697b4398676717c11 Author: Andrey Drobyshev VZ: migration/cpr-exec: abort cpr-exec if memory can't be preserved This commit makes cpr_exec_cb() jump to the failure path when cpr_walk_ramblock(preserve_ram) fails, instead of calling execvp() anyway. It adds unpreserve_ram() and cpr_exec_unpreserve_ram() to clear MADV_DOEXEC on the saved ramblocks, and calls them from a shared fail: label that execvp() failure also uses. > diff --git a/migration/cpr-exec.c b/migration/cpr-exec.c > --- a/migration/cpr-exec.c > +++ b/migration/cpr-exec.c [ ... ] > +static bool unpreserve_ram(cpr_ramblock_t ram, char *name) > +{ > +#ifdef MADV_DONTEXEC > + qemu_madvise((void *) ram.addr, ram.length, MADV_DONTEXEC); > +#endif > + return true; > +} [Severity: Low] Can a failed MADV_DONTEXEC go unnoticed here? The return value of qemu_madvise() in unpreserve_ram() is discarded. If the call fails for a block that preserve_ram() marked with MADV_DOEXEC, the block keeps the flag in the surviving old QEMU, and nothing is logged. By contrast, preserve_ram() reports a MADV_DOEXEC failure with error_report_err(). The caller, cpr_exec_cb(), also drops the return value of cpr_walk_ramblock(unpreserve_ram). Would it be worth at least emitting an error_report() when the rollback madvise fails? [ ... ] > @@ -221,15 +237,17 @@ static void cpr_exec_cb(void *opaque) > trace_cpr_exec(); > execvp(argv[0], argv); [ ... ] > +fail: > + g_clear_pointer(&argv, g_strfreev); > + cpr_exec_unpreserve_fds(); > + cpr_exec_unpreserve_ram(); > + > /* Note, we can go from state COMPLETED to FAILED */ > migration_call_notifiers(MIG_EVENT_PRECOPY_FAILED, NULL); [Severity: Medium] Does this failure path restore vhost-net ownership after an execvp() failure? Earlier in cpr_exec_cb(), just before execvp(), this is called: vhost_net_cpr_reset_owners(); trace_cpr_exec(); execvp(argv[0], argv); vhost_net_cpr_reset_owners() calls vhost_dev_reset_owner() for each kernel vhost-net device, which issues VHOST_RESET_OWNER. If execvp() fails, control reaches the fail: label. The cleanup there runs cpr_exec_unpreserve_fds() and cpr_exec_unpreserve_ram(), but nothing re-issues VHOST_SET_OWNER. The only caller of vhost_dev_set_owner() in the net path is vhost_dev_init(), which runs once at device creation. After vm_start(), virtio-net calls vhost_net_start() on devices that have no owner. My recollection is that the kernel rejects the vring and memory ioctls in that state, because vhost_dev_check_owner() requires dev->mm =3D=3D current->mm. I have not verified that against the kernel source. If that is right, virtio-net would log "unable to start vhost net ... falli= ng back on userspace virtio", or fail outright for vhost-force setups. The new early goto fail after preserve_ram() failure runs before vhost_net_cpr_reset_owners(), so it is not affected. Only the execvp() failure path is. Since the commit message says the VM keeps running in the old QEMU on this path, should the rollback also re-take ownership of the vhost devices? A diff of migration/cpr-exec.c and hw/net/vhost_net.c from this commit to the end of the series is empty, so no later patch appears to address this. --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261009-vfio= _v1-v1-0-2ae91d5b8048@virtuozzo.com?part=3D19