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 89C47433D8 for ; Mon, 11 Dec 2023 11:13:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 850DC410F6; Mon, 11 Dec 2023 11:13:50 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2044.outbound.protection.outlook.com [40.107.223.44]) by mails.dpdk.org (Postfix) with ESMTP id 1800640E0F for ; Mon, 11 Dec 2023 11:13:49 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ilLfvzR3HCRZcd8JtRI9OWl4SuIoAp8uCAZHo7d9m9ALjGYejDNus/Kjj1SUksXE+/oQVy+if0I79ustP3a3/G0mR83ptbAFS/nwePHAs0xCsetd9AxhMUER2dU+vXRQ6rTLvn1MFKVI196mir43I2AG/VVe8bg/kua9yMBtfT+HmU3MSqBnYxVn2vDv1NxCj5+Y5Er/zfgSwagqRxNT5rw+KwednP+vjosvmaCRTEbgkai/f26tKEuAIxbefyPNkyQnRfiazcRZ8Rpj4v8s6XX7Itsg5odnUUT/vO8ObeIWEmUUJbZ2kVfFoglPD//S3qCYFjxkFZDYBofxBo2hHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=HXpLBWGEU4NwqUET4LfHVEbvmmdbJPTBWdZP2SntUcU=; b=oSWKBZoMYa5Fl0KpRi5h5HvQsCXKydqc6u5lDF7yFDJ2vWGbYN7nMtKElr6b/KOrDKA/jvgeY+HJb4lIftkmo8Q4qw9woqndM6T9FWHuPObGpUOIN4GRCUYWKnt+yh4qzUTmX5kRlOlizBadnTr6dox1Wwr2tssWVyZyURwD17Ay6YMgyv7/AqPkCfMp92xWNXOEeF1dy8f22Wdz9NiYlP4wK+5vOF1y8H8JFC9ZDZ80an8SVYj2jcz2VGyN5Qi0Rso4RKLOOUTjP/0WuWtbJKEOkNOBOyRQ54vcI0EPT2+Gbj2MaLMKGSxDciIE1JqrgpVvewOmh2e6dJDG6N8GGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.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=HXpLBWGEU4NwqUET4LfHVEbvmmdbJPTBWdZP2SntUcU=; b=C7iA91CW61vo67LBCOi+ydSqrfgdXi2UWyf87UykBUruA/hudP0Sh3OwMVIL+GBNpDEeYoxPm7ycSH+kegCfn9sSCU8A2Ez8El68v7vLXco5ACs+OXPf+Erd94tmPpVF9j00uh6dqo1YpMReCNtveG8AONuw/5MIPiDYTXzO/0d/1YjOcVvqp4JWUu2PvFi8dgRquoMc6nAqHg8zTXPWY9GMUFlET8NBIPIs7sgz+3BiAofLuV0ud2+ukcSuLC65Q2WOkweywTgy+haU4yO98cPwtZKgdSe3bZmQ4gcrloGustnyQerZrFPFGefe8Ae3o3db5pDNWOKRgMKiTRTRKQ== Received: from DM6PR14CA0037.namprd14.prod.outlook.com (2603:10b6:5:18f::14) by LV8PR12MB9081.namprd12.prod.outlook.com (2603:10b6:408:188::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 10:13:46 +0000 Received: from DS3PEPF000099E0.namprd04.prod.outlook.com (2603:10b6:5:18f:cafe::74) by DM6PR14CA0037.outlook.office365.com (2603:10b6:5:18f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32 via Frontend Transport; Mon, 11 Dec 2023 10:13:46 +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 DS3PEPF000099E0.mail.protection.outlook.com (10.167.17.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.18 via Frontend Transport; Mon, 11 Dec 2023 10:13:46 +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.986.41; Mon, 11 Dec 2023 02:13:34 -0800 Received: from nvidia.com (10.126.231.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.986.41; Mon, 11 Dec 2023 02:13:33 -0800 From: Xueming Li To: Maxime Coquelin CC: David Marchand , dpdk stable Subject: patch 'vhost: fix missing lock protection in power monitor API' has been queued to stable release 22.11.4 Date: Mon, 11 Dec 2023 18:10:36 +0800 Message-ID: <20231211101226.2122-12-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231211101226.2122-1-xuemingl@nvidia.com> References: <20231022142250.10324-1-xuemingl@nvidia.com> <20231211101226.2122-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.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: DS3PEPF000099E0:EE_|LV8PR12MB9081:EE_ X-MS-Office365-Filtering-Correlation-Id: fc2ce0f7-5c09-419e-7fcf-08dbfa31dccb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ktaQxYAkoD/+yNTeZkGd7DHFbjBupLaTn5m8ImqdZLAXIEi+luHwlNuLXRgl3Ui4EFpNv2KeM3wFLElTugVDcLLoActuINwokh4CNhCmr61tmz1oCVSvFd/fZpfOFMqNAKROx8azdJRFSepUk1c0NocQsv4CEaMYJn9bZizr5tL7EoPSNvgt4eomZKeEa+CFJaQOWVW9q2Um7UGo9lurKOlbOtOi0roMTsh/C7mOb++myka/l+Ff0Fsjm/fvtRPIQHEp4L0vwo+w4RzMhtoy1GyFjqOYLRL++2yEWSyoxMiN35onODFz1k6FTf56SvfXVArKVup8EIMORZ2+7+m2qWlqD1UbpgHtNrULeH5vqzXYnmAc4NQ0+bOhX1XGpLlNOaRJeVvtRrgWI0+T8ssf0dsr17auO73CJFPovhQL5OUWd06TMyGQiiizuwssDftYUhBhTezHuMBbPiCoVe/ernCyzCN2H6iNzQg0tVqNYfJ8ZSnEjly9JeN2SarjYnnurEz4UhpTJ60EMKZZj95635icyDTQxgkWOb+02WuHOgbIf84b+nmmUf4k8+jXZsMd6XHYTJQFoMUfgjF0Uqa/aMZOTpHU6vX2Htx1Id/5Ey9F21z0xA7tV/b0y9hWQES82A4idtjcIZDWjTQ/JsAi6GdAubNAduhiaIRvUV1WUBtSe6D68DjUsBpOfrdZlM8Vp5ybNM9hHfq3lOdifDOfp/QM3EtHeFuS0/zYpdwM6IrRPXszGNll4d8alFNy0m6juBMApA0WDZLgyInjRQLKIMlL8Mp3SUl1XQHAdKpHh2o= 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:(13230031)(4636009)(39860400002)(346002)(376002)(136003)(396003)(230922051799003)(186009)(1800799012)(64100799003)(451199024)(82310400011)(40470700004)(36840700001)(46966006)(40480700001)(55016003)(36756003)(40460700003)(2616005)(1076003)(6286002)(7696005)(16526019)(26005)(4001150100001)(53546011)(966005)(478600001)(8936002)(2906002)(4326008)(8676002)(54906003)(70206006)(70586007)(6916009)(316002)(36860700001)(47076005)(426003)(336012)(41300700001)(5660300002)(356005)(83380400001)(7636003)(82740400003)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 10:13:46.6160 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fc2ce0f7-5c09-419e-7fcf-08dbfa31dccb 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: DS3PEPF000099E0.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9081 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 22.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/13/23. So 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=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=a07736eb68dab3ea52e189b07a71d77e92abb65f Thanks. Xueming Li --- >From a07736eb68dab3ea52e189b07a71d77e92abb65f Mon Sep 17 00:00:00 2001 From: Maxime Coquelin Date: Fri, 20 Oct 2023 10:48:03 +0200 Subject: [PATCH] vhost: fix missing lock protection in power monitor API Cc: Xueming Li [ upstream commit b4c4e5675c85a9b471c252305811d15f6a6d2aa6 ] The power monitor get API is missing both access lock protection and access status check. Fixes: 34fd4373ce76 ("vhost: add power monitor API") Signed-off-by: Maxime Coquelin Acked-by: David Marchand --- lib/vhost/vhost.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index 4edb76d0dd..6e1bba4391 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -2070,6 +2070,12 @@ rte_vhost_get_monitor_addr(int vid, uint16_t queue_id, if (vq == NULL) return -1; + if (!rte_spinlock_trylock(&vq->access_lock)) + return -1; + + if (unlikely(!vq->access_ok)) + goto out_unlock; + if (vq_is_packed(dev)) { struct vring_packed_desc *desc; desc = vq->desc_packed; @@ -2090,6 +2096,11 @@ rte_vhost_get_monitor_addr(int vid, uint16_t queue_id, } return 0; + +out_unlock: + rte_spinlock_unlock(&vq->access_lock); + + return -1; } @@ -2157,6 +2168,7 @@ int rte_vhost_vring_stats_reset(int vid, uint16_t queue_id) { struct virtio_net *dev = get_device(vid); struct vhost_virtqueue *vq; + int ret = 0; if (dev == NULL) return -1; -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-12-11 17:56:23.597356200 +0800 +++ 0011-vhost-fix-missing-lock-protection-in-power-monitor-A.patch 2023-12-11 17:56:22.887652300 +0800 @@ -1 +1 @@ -From b4c4e5675c85a9b471c252305811d15f6a6d2aa6 Mon Sep 17 00:00:00 2001 +From a07736eb68dab3ea52e189b07a71d77e92abb65f Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit b4c4e5675c85a9b471c252305811d15f6a6d2aa6 ] @@ -10 +12,0 @@ -Cc: stable@dpdk.org @@ -15,2 +17,2 @@ - lib/vhost/vhost.c | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) + lib/vhost/vhost.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) @@ -19 +21 @@ -index f86516324b..9a7403c28d 100644 +index 4edb76d0dd..6e1bba4391 100644 @@ -22,9 +24 @@ -@@ -2123,6 +2123,7 @@ rte_vhost_get_monitor_addr(int vid, uint16_t queue_id, - { - struct virtio_net *dev = get_device(vid); - struct vhost_virtqueue *vq; -+ int ret = 0; - - if (dev == NULL) - return -1; -@@ -2133,6 +2134,13 @@ rte_vhost_get_monitor_addr(int vid, uint16_t queue_id, +@@ -2070,6 +2070,12 @@ rte_vhost_get_monitor_addr(int vid, uint16_t queue_id, @@ -34 +28,2 @@ -+ rte_rwlock_read_lock(&vq->access_lock); ++ if (!rte_spinlock_trylock(&vq->access_lock)) ++ return -1; @@ -36,2 +31 @@ -+ if (unlikely(!vq->access_ok)) { -+ ret = -1; ++ if (unlikely(!vq->access_ok)) @@ -39 +32,0 @@ -+ } @@ -44,2 +37 @@ -@@ -2152,7 +2160,10 @@ rte_vhost_get_monitor_addr(int vid, uint16_t queue_id, - pmc->match = 0; +@@ -2090,6 +2096,11 @@ rte_vhost_get_monitor_addr(int vid, uint16_t queue_id, @@ -48 +40,2 @@ -- return 0; + return 0; ++ @@ -50 +43 @@ -+ rte_rwlock_read_unlock(&vq->access_lock); ++ rte_spinlock_unlock(&vq->access_lock); @@ -52 +45 @@ -+ return ret; ++ return -1; @@ -55,0 +49,8 @@ +@@ -2157,6 +2168,7 @@ int rte_vhost_vring_stats_reset(int vid, uint16_t queue_id) + { + struct virtio_net *dev = get_device(vid); + struct vhost_virtqueue *vq; ++ int ret = 0; + + if (dev == NULL) + return -1;