From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <010701a145650981-a02a2d52-3dff-4243-96eb-59652647da0b-000000@eu-central-1.amazonses.com> Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11020100.outbound.protection.outlook.com [52.101.69.100]) by lore.virtuozzo.com (Postfix) with ESMTPS id E7D418017D for ; Fri, 16 Oct 2026 15:46:55 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qeBwt93bXnFhtjcssJffqY8aZhH4B0vwMv9PpsRyqL1Z0OQ3mJ9g2un2ROOsUaKKwUzM4EhyRd1kz8gla21dKOU1MrRlOKbwV7GkMkfH5AUl2BtfJGMtObeOxGeWa6LTXaGzluqVvcyMs1raHwXYYWYmEUslnWunF+O18NkcEHvcwQO7sG5DEHB2UZAssb1VsgnipEb/faVupEfM7P3m2ojXbR0RIvnM+hDZbMsnsvFjCnp5q5vm1GVgoVisGN+JtYDZwSjJ43iZJBGF89y0zzsr8C3CJk1yWPPgMFB5S3Mmt37Ir1vGXHTT9/Oi8xRxXhllh+ljElG02qiL3jy9UQ== 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=3ApHfE0AJy4oMZ4T5knAd+0FHmDeUciB45sYUMyq3sU=; b=FTNc8mzj3UmMtnBoeXeaT082QcrAtasyrlkf8m5+knAC98foiop5iDy2Da38L9QZ/XKAU9Rusq47U11D2i8L2JzxOx6Lzi3FlBduCEBSyw9JrI9K4xiZ7TQ39hQKS4+gxO54xAhSkp9knfozjJAJ+CgiffCOMh4mcnX79lW/i+xkkBzfCaj/6XLfUmZJPEjibcHD/o6SFtzE1BfGmxpDsp1yn0gyGR0LbxAcfCof6b2XuGeCm845y6VAmaGRnydjFqwIwHj8c5HKzswMHxUx8EY3KsuynS9VttQKLJpcrBOV740ryDn3e/owhQ/MlwY09mkbqEdq+oZjAJ02HLA80w== 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=3ApHfE0AJy4oMZ4T5knAd+0FHmDeUciB45sYUMyq3sU=; b=guWlq8ensDu/gtXuowuNyO6H21acIHeM4n6cikM2WKyXr6hmQ+mLnyfS+cQ+MlqI5s4N0FPBGzaZJRKcuhIAPZdlS2ekdJXEaNVFy4wHfjwY8YcuknEi1uGo52ik+g0qYote4N/FLWYPSmMzuhx3nyP/flRLfc+se21OFR96dcg= Received: from PA7P264CA0493.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:3da::18) by MA9PR08MB412505.eurprd08.prod.outlook.com (2603:10a6:250:103::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.546.11; Fri, 16 Oct 2026 15:46:52 +0000 Received: from AM7PEPF00000054.EURPRD83.prod.outlook.com (2603:10a6:102:3da:cafe::5) by PA7P264CA0493.outlook.office365.com (2603:10a6:102:3da::18) 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:46:52 +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 AM7PEPF00000054.mail.protection.outlook.com (10.167.242.40) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.546.0 via Frontend Transport; Fri, 16 Oct 2026 15:46:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1792165612; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=cDArnXuVBiIpHVe0RcFPUJKiAbyRskI8Ky36wxLlb0g=; b=Du3jIRIDlDCRpGHpl3W9nV/U3CSCPJfhyL89Jdf3lc3XI5JuRcWhrABFi0CQJPZc bM6xouLOeoHk7M1Mh/sdrI2E6cqxV/WynPiOPOwaKG04y5pQQy851Kkhuh9McsknVt+ pOW5UZmzS5KbfAFFJoEC9Yo2sZOfaM/M4WDhpT1ujjE1nbIjbcWsqObdlKipD8uYaTD dM4aZooGaz92FHSwFvc27B1v/tq4NpVYu0tkYjetRDtiVjo/Gll6jsR8KOvLxbI5kkM DO3krzXA45DuK/xosmJGf8/HK5VoygwVmy/oUaGaFZ69ZBNWFMz8iyv+CJEklQ7NydA tCw+gdx9sQ== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1792165612; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=cDArnXuVBiIpHVe0RcFPUJKiAbyRskI8Ky36wxLlb0g=; b=hmNG/gnWWlcPUYLsLbkbPEeSA4/yfO8DELUd3P+0eX5AroOCcU5h8oX4RS8198xf u1UnzCPoNXHw1jxCKAlDlLyJcziqXbQzXBw+aVFkhdNMl8LNHzZRUnW3+H91MLT6RrU yyaS7dQ87ElvHvu9i7abct2xWGLDwPrBE7umYA7I= Message-ID: <010701a145650981-a02a2d52-3dff-4243-96eb-59652647da0b-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH QEMU HCI-8.1 v3 19/28] kvm: fix coalesced MMIO flush racing with kvm_close() To: svt-core@virtuozzo.com, Andrey Drobyshev Cc: andrey.drobyshev@virtuozzo.com In-Reply-To: <20261016-vfio_v1-v3-19-47487cb5a8e5@virtuozzo.com> References: <20261016-vfio_v1-v3-0-47487cb5a8e5@virtuozzo.com> <20261016-vfio_v1-v3-19-47487cb5a8e5@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 16 Oct 2026 15:46:51 +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: AM7PEPF00000054:EE_|MA9PR08MB412505:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 2718d0d3-2b23-42d5-f97c-08df2b9cb2c0 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|48200799018|32142699015|9140799003|376014|61400799027|56012099006|5063699009|5023799004|4143699003|261009223027099003|10067099003|22082099003|16102099003|18002099003|55112099003|4113699003|5113699003|13003099007; X-Microsoft-Antispam-Message-Info: TePB1BeQv0MDgGEVyRCxrjt+wEHi1foZ2DqXUQy7aLU8/iufO/3/HxXp9DV2teCvZQuXali90ih0+4AxQSOFAg1e3JYTCoZMK+0Scrpd7DiuMPgNzzTOJ8ypwUrk8o/9N2InnMiwziv2J9QrITDZ/r1TjqF7nseGVs25T85PsJ+0sEw16lyFGnQvFeLmKVWEJ5ScE6bqcGYL/dx1Mz50OVlNqy6CXCeskLgO06eW0Dks5YitWYfT0NuAgl/PYjj5l0C86IaItEytk7Rkb6+55XJyDmAWEgR4LPtT90ukhiMXwmEdogh428BJ8kViv93NkNu0kVpzRTBSC8fcBQGAdSJicdirkhuZgJsntQAC7E7TKpCsN4NpILxVpU+Et9P2lQfilTTygCCZdMXSwr0wWe3bnOMW4IHFxu6fSdNQWqacqT3hgHevbv74tnU1/A4mk4KcwY9vfORdGEH6j5tq5fuDO39SFKEixpNzolU95fXGRNut3krkD2v6bjEhKB8ZXpXM3AySoRgUdVQlKSeiB9W6DuwfXrUxt1sSZ+bHD2xzOoKdy9hvBpxCJiw49A0rOgkvmFXYlnzmYUnIrJKF9d74ZbqR3s60TzP+A7voKs6YmF8+AE7lIsgYFLLg83ZHnWmk75BC/d3hFlvE84lc9NjKGUHpLFexZjw0XCEMzoRKkVrPb0oh/jjVSvI+V/auzGdRI71pIKZWJJUDkwpzecjRK0056L4IiIp6odxRyQRKoVAtWxB2gywdvLKPLvfdgplTiFBCZ4deE1E7l7kngBs4v6k9rr34WFT6rsWeu8jCqH8pHPInAHJp7pU05ZbvwQWmYwJRxhMlUUe/R0Tzi4pR31tUv1EmSynr8xcFkNbHG8v9SoeUsFm+FdpBVpBNy2hypdIfd+EdCRoFUFjOMx0Ho87im5tPgsBIEPI+rNjq0U/wzVdMw7j+PW76mN1B 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)(48200799018)(32142699015)(9140799003)(376014)(61400799027)(56012099006)(5063699009)(5023799004)(4143699003)(261009223027099003)(10067099003)(22082099003)(16102099003)(18002099003)(55112099003)(4113699003)(5113699003)(13003099007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MJgXwNmvIb9FEPVo2+FgSxUwq1Usf+WWJraVH0th38eK8OfOsnrkG7Co0b4qwbeWgVfx2nCEg3NDVM/q0PohpoYKc/su0rNDXat4bVcdrG+/KODdlfbqN3VMpoM1tcPdbUeXmlMquwk5S5prKzj1447WvN5hgJKETSN3DIyQ70CQgamFqJOJhHXwvjIeCcGnJ0Z9Elx2QKSrkho9GbBStUyJmh+GcHkCdO/nBAU4pzve8PK/Etb7hlChDrBaP5Sp8Xj389wIxcvKXpQ0MxQ9EoTzvhXoG4Px3LaScrKPHnCr7ZBZoooCu3Jm1unx2Fh5GNL7SQkP5heUbcI0gkXUF7sjx/eWEQtINRYHw20UCFchjlP4LoN8V/JflWUQduTUPnl5e1zddLDAXX3yjxl95lNh/JKahW1mGmFVgzEOEmiMqcZzi50+wCyjUDiumreK X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2026 15:46:52.3144 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2718d0d3-2b23-42d5-f97c-08df2b9cb2c0 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: AM7PEPF00000054.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: MA9PR08MB412505 > kvm_close() destroys the vCPUs, which unmaps their kvm_run areas, and the > coalesced MMIO ring lives in the kvm_run area of the first vCPU. Nothing > stops the RCU thread from flushing that ring at the same time: finalizing > a memory region of a freed flatview calls memory_region_transaction_begin= () > and thus kvm_flush_coalesced_mmio_buffer(). kvm_state is still set at > that point, so the flush reads the ring after it has been unmapped: >=20 > #0 kvm_flush_coalesced_mmio_buffer accel/kvm/kvm-all.c > #1 qemu_flush_coalesced_mmio_buffer > #2 memory_region_transaction_begin > #3 memory_region_finalize > ... > #10 flatview_destroy > #11 call_rcu_thread >=20 > while the main thread is in: >=20 > kvm_close -> cpu_remove_sync > vfio_kvm_device_close > vfio_cpr_kvm_close_notifier (MIG_EVENT_PRECOPY_DONE) >=20 > Seen as a SIGSEGV of the old QEMU during repeated cpr-exec of a VM with > a VFIO device. >=20 > Clear the ring pointer first, so that new flushes skip it, and wait for > the pending RCU callbacks before destroying the vCPUs. >=20 > Fixes: 7ed0919119b0 ("migration: close kvm after cpr") > Signed-off-by: Andrey Drobyshev Sashiko has reviewed this patch and found no issues. It looks great! --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/20261016-vfio= _v1-v3-0-47487cb5a8e5@virtuozzo.com?part=3D19