From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <010701a169ca0ab7-c8a97994-ea51-4eec-ab29-6c086da91e5f-000000@eu-central-1.amazonses.com> Received: from GVXPR05CU001.outbound.protection.outlook.com (mail-swedencentralazon11023111.outbound.protection.outlook.com [52.101.83.111]) by lore.virtuozzo.com (Postfix) with ESMTPS id B95AA8045D for ; Fri, 23 Oct 2026 17:23:38 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qqlzOVVPluIcRjRBVjdmSxl8d746W+864QRgoV/+sFGmviBf5vUvEuzEHpc+ScTfDRVxWOXVvvEa0cGuhPmg1EdvN8PQH18BS+rLmXO66nNwxbzZ6Rr0VGcaLRx7slgYe3S0AzmueYpoZ2ZkQwvA0zCoC9sL62jU0ComdatdPem6rI2z3rk84yRBdwdB15to4D9cPIJsRuXTAnNs8j6SW3tpchBnWO5uLBFYphAAlSsDju6u7LbjSsj0dyyUVqm5eMyMVFGU4DE9m48AILa82k/+UZHnl0VE23o75VETg/e4kGmBF/ZUayjhWfsJYIFPTus5Zb3lCzUQ1B1xFgTyKQ== 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=6ZsEIPWDerqyb2wOBqOaVecrPa4ZZaUqiqK11433foE=; b=PF6u4wFAIXWFxgsmZX0Ih4hQFhWlWgGnVqz9n5zFIejLvyERt+UyRwQTFuWLHWW6vXxwu9in/du4K1FBRh1MhluVjggVSyr7eY1FPd7ov47TDFRw7ZXpWW9vIyUvjyWU6LKx58/qCgWRdQ9DSUbDlkb+IIDGYw3gMYqzkfR94GNXXAVAO/aZtLRStCf38nWydLSG14EFa/BiJTF9E0Z08rNQA+NR/OPBSbnEB6VUZoK1NczjCUmmpO+AGocddGjeBHgdEitmQIwigDwAn5dP801WuH90TDAH5MNQPJgvByOLApT+6bdK8BHNWTldxl09C3U8A0Dj3r1V6UkZi3Pjvw== 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=6ZsEIPWDerqyb2wOBqOaVecrPa4ZZaUqiqK11433foE=; b=AXBXFY04OwcZ4o7nPV7NUaEOCWEIJr6x2tdv/c05DU0Tyt+LqT0rfr0c9GqLpkOMngIOVQ+IwGFSdJnaNRfqm8IVUUWG3OkePSIj20LuPxdAdsodbwCzZ/xwnRTh3Lf8PU+Dxny77EYpUGB8XT/Blh3vnakVFUbM4Pt7kQjKFMk= Received: from VIUP296CA0006.AUTP296.PROD.OUTLOOK.COM (2603:10a6:800:34f::13) by GV1PR08MB8105.eurprd08.prod.outlook.com (2603:10a6:150:96::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.546.15; Fri, 23 Oct 2026 17:23:32 +0000 Received: from MI3PEPF00008486.eurprd02.prod.outlook.com (2603:10a6:800:34f:cafe::9) by VIUP296CA0006.outlook.office365.com (2603:10a6:800:34f::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.546.20 via Frontend Transport; Fri, 23 Oct 2026 17:23:31 +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 MI3PEPF00008486.mail.protection.outlook.com (10.167.240.133) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.569.4 via Frontend Transport; Fri, 23 Oct 2026 17:23:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1792776211; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=cCG4bdpQPH9JpkYieY7nV85osq3jJ5sNChLwGgHYv7U=; b=u6+5UBnkhY9HJ80TvYuvz7Rt81XqT4zqv+GkadONb80/FisOhR/rH/ZfvU67W+G8 MVBjPXmPJnuZGCb7ge0Vj30uW87X5v3f0n833JmNdKz4oj0P27Fp20cgVJs8FY/XhMS oFwdsN0TDw9Z7AgDxOQ7hnQCUFj9YMR4RfyA4NY4ntsFaxsZi1c/u3VPRUteWOO9Bq4 NRZnFF6z1rM2HFyoMvFuuV1eTiggY1VdU1oglu2EDW25FmSEjB/Ccurp+5hhEka49FR P1U8AAJD1oUL0rsXmWPuXAytzHTsnk0jdjhE0aPY3aI4JIRcKbWtqF8ba27EwFwj09v LOZJUVUVfQ== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1792776211; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=cCG4bdpQPH9JpkYieY7nV85osq3jJ5sNChLwGgHYv7U=; b=P1wR2lczkEuyXINGchM2TZ/1Um8m8pkMAhs7DwjOgHNlrEJoh6WM/RrAC1VWK15O nfTFTO/6DMU23uWjuRGfiehVWeuhvgazKZIHRafDkRSCwN/Im3eQg83BcTINDy7mdwA QRew5O2QMweSDA21ItUW2jpbgoN4iURkImrbIb1Q= Message-ID: <010701a169ca0ab7-c8a97994-ea51-4eec-ab29-6c086da91e5f-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.1 v5 26/36] vfio/migration: don't assume the device is running on CPR incoming To: svt-core@virtuozzo.com, Andrey Drobyshev In-Reply-To: <20261023-vfio_v1-v5-26-ba0bf3c6d122@virtuozzo.com> References: <20261023-vfio_v1-v5-0-ba0bf3c6d122@virtuozzo.com> <20261023-vfio_v1-v5-26-ba0bf3c6d122@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 23 Oct 2026 17:23:31 +0000 Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.10.23-69.169.224.6 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MI3PEPF00008486:EE_|GV1PR08MB8105:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 716c7b94-aaf0-421a-98df-08df312a5c44 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|32142699015|9140799003|61400799027|48200799018|376014|261021121427099003|6133799003|4113699003|5113699003|55112099003|10067099003|18002099003|16102099003|22082099003|13003099007|261009223027099003|5023799004|261022105027099003|4143699003|5063699009|56012099006|261022075727099003; X-Microsoft-Antispam-Message-Info: eE+3rQq+8tWdw+T1v3b8dnkywBHQ3Ik/93LBHbPkfkbD5l9s4G3ize203GHaMt8lFxtU8OJMo1N1PMA3E3KkCKXM4rmekqYNEEP0XJqBNNfRyfIUhenytd9SkiLUEEjm0Dr2UONof3SshuCtphDPtkELNZ+isbxBwgJBxUelkxkLvk58bE6akxuvOAaqIgjiV36PZt4FfRFWxVso69TrWZyxIWDTqxZ7lf2K9FqcLoBiWcW+1pTUPRLm+POUKcbH4N+0xIbH8z4fl1DPXA2k4Ja2MtnvRu//h7PsWCLALdVf3coE9+ZXeBdMWHCeLZvN0P9q2/TZ5XXBsPp6jcmmdO3K1W3fg3e+tV1sKRiW36Dpml4E7ssbXDr8DL9x1NLGkQtFzX6W4aFKEfrA05HYKSRHDL2QGgwDoDypAJFF+tYlTW8fK0qE/NQi8PiWKgAecML6WVe0F0bCuWutzG4v/0AIarT7P/IJ9QpvabfLfZNoiCqurL1ucsdBYoHOKAl05HCOxME8RmZy4b2Yb8x9AAg2pBOb7lH62UswpGdJb4+ys5t+5b10ZRcc3UjJYh+W4tgi+jMs3Uku53S90SEvEMrD1b1gVI3oERl5ds3F4LWkLDVU80qfMLm9U8nonUnx9f7Tl7lfqjtlUXWJ3AGULk90KPywW5Nr87Q0N9o3ojLrfrvMOuT+oaVKR43Cs+rHx6TlLqweoOMeNpqhKj86fw7wTyR1KilTSK3p9poLdm2jjWss4uVLkjpCNYxOqrJzbKyORSPYh19Yui2Tz/hzI0ZDnm7trriGQ987nDenUoS/JwceGpkuz63C7iEs6L7QCfOjB0l+FQeEI52+dZASiYBu+NcZoZgT9zV/RJFKMqPsZ/s+BlI6ydtEO8gypOfg+Cg6Zy2toIsRAWw1Sbv/lg== 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)(32142699015)(9140799003)(61400799027)(48200799018)(376014)(261021121427099003)(6133799003)(4113699003)(5113699003)(55112099003)(10067099003)(18002099003)(16102099003)(22082099003)(13003099007)(261009223027099003)(5023799004)(261022105027099003)(4143699003)(5063699009)(56012099006)(261022075727099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: w5HnUrIUcRkGolu9KwMLtHAxRxfTUZy1O4Kmqk9KUblJoc1qYScAzSnc/1JRecOHtgR9JHVaayvBa0TjWXaEAF7oRiSxGYzvLvH9BElZZB3tED+B85rtcjbPVTrsXYhe/c4RFc/e057WHOaMJ2gtqsnengDP/j9Lf+x2b0XPALtAj/5SnaWE/fv0/y0z1YKnAYz/2bDAdWXMPWB5BByVulIiiZTfjhISQ/rMLO9NLgqTdErgtre+s8Klv13DCQJh89Vx/r0csDO8lWW5s/3iYMKOXawq7bnQnrTVVr7Fr7bVl/dd7UbsAJRNyRUYqwjFIT10Axmjlo4SO695tkj2ChJZAfR29Qy/A70wGuk6NTWZEnyPLGDlgRRoOFr318MuqNrEFqjmEktTA+gk+1Xu0Gyie/Ae1/BMhrSDFBTezmxx0Tk/0Rpf+Ojsbp7rEWeP X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2026 17:23:31.5611 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 716c7b94-aaf0-421a-98df-08df312a5c44 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: MI3PEPF00008486.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB8105 Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Low] vfio/migration: cached STOP on CPR incoming is wrong if target stay= s paused -- commit 2d2dfcb91b4c065d544641a9b16c0991feb658d5 Author: Andrey Drobyshev vfio/migration: don't assume the device is running on CPR incoming This patch makes vfio_migration_init() cache STOP instead of RUNNING when CPR is incoming. It also makes vfio_vmstate_change() record RUNNING or STOP in the cached device_state on the CPR target, instead of leaving the device untouched. The goal is to stop 'cont' from skipping the ioctl when the source VM was paused. > diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c > --- a/hw/vfio/migration.c > +++ b/hw/vfio/migration.c [ ... ] > @@ -914,6 +914,14 @@ static void vfio_vmstate_change(void *opaque, bool r= unning, RunState state) > Error *local_err =3D NULL; > int ret; > =20 > + /* CPR target only: the device kept its state, note where the VM lea= ves it */ > + if (cpr_is_incoming()) { > + vbasedev->migration->device_state =3D running ? > + VFIO_DEVICE_STATE_RUNNING : VFIO_DEVICE_STATE_STOP; > + return; > + } > + [Severity: Low] Can the cached STOP be left stale here when the target stays paused? If the source VM was running, CPR skips the device stop under cpr_is_in_progress(), so the kernel device stays RUNNING. On the target, vfio_migration_init() then caches STOP unconditionally: migration->device_state =3D cpr_is_incoming() ? VFIO_DEVICE_STATE_STOP : VFIO_DEVICE_STATE_RUNNING; If the target stays paused (-S, autostart=3Dfalse, or a block-activate failure), process_incoming_migration_bh() takes this path: migration/migration.c:process_incoming_migration_bh() { ... } else { runstate_set(RUN_STATE_PAUSED); } ... } runstate_set() does not call vm_state_notify(), so vfio_vmstate_change() is never invoked. The new cpr_is_incoming() block above is therefore never reached, and the cache stays at STOP while the device is really RUNNING. The commit message says "STOP if it stays paused" and "At CPR the device can only be in one of the two". Is that accurate for a running source whose target stays paused? The cached state is also consumed elsewhere, for example: hw/vfio/listener.c:vfio_log_sync_needed() { ... if (vbasedev->pre_copy_dirty_page_tracking =3D=3D ON_OFF_AUTO_OFF && (vfio_device_state_is_running(vbasedev) || vfio_device_state_is_precopy(vbasedev))) { return false; } ... } Could a cached STOP on a really RUNNING device give the wrong dirty-sync decision there, if the still-paused target is migrated out again? A later 'cont' would also issue a redundant STOP->RUNNING transition, and vfio_device_state_is_running() would return the wrong answer until then. Would it be possible to determine the real device state on CPR incoming, rather than assuming STOP? > + /* CPR source only: the device keeps running across the exec */ > if (cpr_is_in_progress()) { > return; > } [ ... ] > @@ -1039,7 +1047,9 @@ static int vfio_migration_init(VFIODevice *vbasedev) > - migration->device_state =3D VFIO_DEVICE_STATE_RUNNING; > + /* A device inherited across CPR is in STOP unless the VM gets start= ed */ > + migration->device_state =3D cpr_is_incoming() ? VFIO_DEVICE_STATE_ST= OP : > + VFIO_DEVICE_STATE_RUNN= ING; --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261023-vfio= _v1-v5-0-ba0bf3c6d122@virtuozzo.com?part=3D26