From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5C44C4625C for ; Tue, 18 Feb 2025 13:36:19 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 56F15402A0; Tue, 18 Feb 2025 13:36:19 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2082.outbound.protection.outlook.com [40.107.236.82]) by mails.dpdk.org (Postfix) with ESMTP id 02186402A0 for ; Tue, 18 Feb 2025 13:36:17 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=atH/96a49ZQiEHLVm0C+OrBjzKRd4gMPlHqRwt3IPz0YX80EAshPxd7wxJGgWxT/3+qUno8AQAnr8E6vKEELSpjutvc4esxdm4k6ACeq7YF/HTFh5K4KSDiHOZae9AwCpG2cxkmF8ZFxw5qGhT/gDy5p0VKxK+cUBI9xbPh9Rj1M+wtzSnqAsYq6xgKhOnFAbkTnZ8MnqlHqZ/kzEGTOfwKPgzzW8xrBUKYQ6gRcpopXl3ugQourFv9NbR5gyq+sd69hB+RzOHa636GJD8WylzH3uFTG2/4itMGgHno92tPGjUBVBE2dKe7q4Of694Zj3NdA7HqI/JRtaR1P/knibQ== 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=KTarqE9o+HLNqnfMruKbCvd+HzfTDioUukvqu2Kj2i4=; b=oDXr1STE5X6oz00xoHMeFo1Qi6ELMOSfiyswhS3Q4mGx1/GSXG7oMP6UrpBCIJaT/4LEwLx1nZWc5lmcIrLOk4EIfsWzcGHmHSMTn3Cx31EB9NFjNIKnzqJRAZ70gM54qTSNTV3co8S5WIykbfkPy1tAvtiiJVOYW5Fc9lSxzGpcdtiSaJidKGYH1xC4nDXYlGfljeGOuREOVJxaK8HWgh1LB7+3PmfGu1Xm3uYdKaA6wuvdc5S6SEJwPSJUxFdCkSMl+x/rsW+Zga9APAzVAg+kWN90QUHMSLQAZel5MmfIQEymhHW93TE70QsoTuLZCSfDYgUorjEFtZJOa1e1yg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KTarqE9o+HLNqnfMruKbCvd+HzfTDioUukvqu2Kj2i4=; b=atoZ6HMw+bEEi8diaGYr1bCJze2v7K3gZ7iTEYcERxt1FbQYRTVSJMm8Vcc4KjpmXJ9WqPSczTRBoRfoif/ea6D/zemzZQKmpcRFMb04hoTUJ0ELuylC5HVt+dP7pWJEWY31i31Lfgn4Xm59SrvfxuJxGOfoEB2QBtaPZNWhjCCoQkQeVo6ITn3AWv6nwodJRkP2jGJC4Ilw3PY+5SMpxrbm0vWYkjD07g6eGyC1SSp7B3eHIR0EIl4osdW2PpuXlNrdDGOOt/JOZ+iWGZOyz+X871sY2LwCUqg2sIbvgFfZWNfdzrNKhnU21ew5xQbYE06mVh1dBhzJObemfKBqKA== Received: from BYAPR08CA0070.namprd08.prod.outlook.com (2603:10b6:a03:117::47) by IA0PR12MB7775.namprd12.prod.outlook.com (2603:10b6:208:431::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8466.14; Tue, 18 Feb 2025 12:36:11 +0000 Received: from MWH0EPF000989E7.namprd02.prod.outlook.com (2603:10b6:a03:117:cafe::e9) by BYAPR08CA0070.outlook.office365.com (2603:10b6:a03:117::47) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8445.12 via Frontend Transport; Tue, 18 Feb 2025 12:36:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by MWH0EPF000989E7.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8466.11 via Frontend Transport; Tue, 18 Feb 2025 12:36:10 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 18 Feb 2025 04:35:55 -0800 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Tue, 18 Feb 2025 04:35:53 -0800 From: Xueming Li To: Jianping Zhao CC: , Maxime Coquelin , "dpdk stable" Subject: patch 'vhost: clear ring addresses when getting vring base' has been queued to stable release 23.11.4 Date: Tue, 18 Feb 2025 20:33:57 +0800 Message-ID: <20250218123523.36836-3-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250218123523.36836-1-xuemingl@nvidia.com> References: <20250218123523.36836-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989E7:EE_|IA0PR12MB7775:EE_ X-MS-Office365-Filtering-Correlation-Id: f7928d69-b438-41db-75d2-08dd5018d327 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|1800799024|36860700013|7053199007|13003099007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?0MkxHFIN27Fm3ZsCjwPd8T+BZxe6eEGiFemXimbIpHgYlMNh7dV8uKrVyNGv?= =?us-ascii?Q?QcCueG0b26SYyv4nj9DM+RtJQzmhGZBoPBWcheqtbzLEA5OQOnF/jjzvpuc2?= =?us-ascii?Q?eb58j2HFy/NAI5nEU4s2WA6zcURns1jFsCkL7ryYW11HSPFfwIy0QONsAQtt?= =?us-ascii?Q?Z6xk0Qahixskm7RcJIcHNROmPNMl+8ILV+6+1wQd3xLWMyVAUIwNrw8v1/pT?= =?us-ascii?Q?MIR3bMKOzrY7FzPVyLpeaVwyMM6SmsXck06xWY3Ott8RXIrsQVwkvOOGHjnO?= =?us-ascii?Q?PXzp59AhvjMqhwJEEskPUdr3+8nC3wR4plUFcoE8UXep3B9oKBhx0ELlI87W?= =?us-ascii?Q?HG9iKnDIoABp5/PMWbWZ+Uqo0TX+caQ9Q5LqxBx4MGi967NYqO/VQPxb3JdN?= =?us-ascii?Q?hmu8iuvd9h82ZEcKLKn4jl15LTUIsjcHqOY6wWeOoSGW6calWqLmQNnhj/sI?= =?us-ascii?Q?sk80jg604exxvwX5fowdjReqsF+4sxs918IYFAf1Vx8H4ZeLCwG6uQE1m5qc?= =?us-ascii?Q?gzxrtB3HoQYgpc89ZyYeTxmfH4JUqSKdA+jXFP5Xm57Wd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gh31ZopKYvnHvRzvJeZzUI/ik6D0oJKxXoWShyXNa7PB747?= =?us-ascii?Q?0+hRu01nhjt2S+E=3D?= X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230040)(82310400026)(376014)(1800799024)(36860700013)(7053199007)(13003099007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2025 12:36:10.7556 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f7928d69-b438-41db-75d2-08dd5018d327 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7775 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 23.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. Please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=9148bf9355898108b2351a153293b2f8932dd460 Thanks. Xueming Li --- >From 9148bf9355898108b2351a153293b2f8932dd460 Mon Sep 17 00:00:00 2001 From: Jianping Zhao Date: Wed, 27 Nov 2024 10:03:49 +0800 Subject: [PATCH] vhost: clear ring addresses when getting vring base Cc: Xueming Li [ upstream commit 1846fe767f00a9d0dade333e7838f81e6721b694 ] Clear ring addresses during vring base retrieval to handle guest reboot scenarios correctly. This is particularly important for vdpa-blk devices where the following issue occurs: When a guest OS with vdpa-blk device reboots, during UEFI stage, only one vring is actually used and configured. However, QEMU still sends enable messages for all configured queues. The remaining queues retain their addresses from before reboot, which reference invalid memory mappings in the rebooted guest. The issue manifests in vq_is_ready(): static bool vq_is_ready(struct virtio_net *dev, struct vhost_virtqueue *vq) { /* Only checks pointer validity, not address freshness */ rings_ok = vq->desc && vq->avail && vq->used; ... } vq_is_ready() incorrectly considers these queues as ready because it only checks if desc/avail/used pointers are non-NULL, but cannot detect that these addresses are stale from the previous boot. Clear the ring addresses in vhost_user_get_vring_base() to force the guest driver to reconfigure them before use. This ensures that vq_is_ready() will return false for queues with stale addresses until they are properly reconfigured by the guest driver. Fixes: 3ea7052f4b1b ("vhost: postpone rings addresses translation") Signed-off-by: Jianping Zhao Reviewed-by: Maxime Coquelin --- .mailmap | 1 + lib/vhost/vhost_user.c | 1 + 2 files changed, 2 insertions(+) diff --git a/.mailmap b/.mailmap index ff5b0821ba..71967f7247 100644 --- a/.mailmap +++ b/.mailmap @@ -638,6 +638,7 @@ Jia He Jianbo Liu Jianfeng Tan Jiangu Zhao +Jianping Zhao Jianwei Ma Jianwei Mei Jiaqi Min diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index 5b6c90437c..14808bd5bc 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -2201,6 +2201,7 @@ vhost_user_get_vring_base(struct virtio_net **pdev, rte_rwlock_write_lock(&vq->access_lock); vring_invalidate(dev, vq); + memset(&vq->ring_addrs, 0, sizeof(struct vhost_vring_addr)); rte_rwlock_write_unlock(&vq->access_lock); return RTE_VHOST_MSG_RESULT_REPLY; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-02-18 19:39:00.833629012 +0800 +++ 0002-vhost-clear-ring-addresses-when-getting-vring-base.patch 2025-02-18 19:39:00.398244087 +0800 @@ -1 +1 @@ -From 1846fe767f00a9d0dade333e7838f81e6721b694 Mon Sep 17 00:00:00 2001 +From 9148bf9355898108b2351a153293b2f8932dd460 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 1846fe767f00a9d0dade333e7838f81e6721b694 ] @@ -36 +38,0 @@ -Cc: stable@dpdk.org @@ -46 +48 @@ -index b90ff0444c..cc1ffe1ad9 100644 +index ff5b0821ba..71967f7247 100644 @@ -49 +51,2 @@ -@@ -674,6 +674,7 @@ Jianbo Liu +@@ -638,6 +638,7 @@ Jia He + Jianbo Liu @@ -51 +53,0 @@ - Jiang Yu @@ -58 +60 @@ -index 6d92ad904e..52d8078d7c 100644 +index 5b6c90437c..14808bd5bc 100644 @@ -61 +63 @@ -@@ -2277,6 +2277,7 @@ vhost_user_get_vring_base(struct virtio_net **pdev, +@@ -2201,6 +2201,7 @@ vhost_user_get_vring_base(struct virtio_net **pdev,