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 61F4D45E41 for ; Sat, 7 Dec 2024 09:02:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E09A4065A; Sat, 7 Dec 2024 09:02:31 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2056.outbound.protection.outlook.com [40.107.223.56]) by mails.dpdk.org (Postfix) with ESMTP id 59A4340DD7 for ; Sat, 7 Dec 2024 09:02:29 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Y838mRv8jLyzNVpynwYLoGgmaDV4u9wGCGIoWdCtZD1KPdS0VqpU8NyrXe3nLOQQu5ZwsqPrEku39kQmMk27i3S+mWmjYwbipy98XuB9RX9w4XyMmod4vI/Seo4tvQHqAabgECYwpNHBxVNQDiiSTcCMLvasaEgfxTX2Sx5W0T8W9zpJBPgW+AM4pS2RzpclG0gsWEvgX50wLPqg1bSpcJAWYtVB4/hpyPtidlMZhlNwp24ZsMIqZcNCLQpdhV2vIniA3iLFiJGf6b7OcMgxNoDkorGthOu/GiElqzM8BRUnrsdghD5JfvCzfM5VNomJ+as4crs094SwyE64Y7asKQ== 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=nKyxcAgUCexfwB0nnlBDiQUjVDlR2XLAMOAA2n+0uWQ=; b=dYctQctFbYeFj4qAJyWfyERjM4PQj1av8oz1dK4yn5F2D7bixRSKLepUdWVAt1xvIR3bshNSgWUICwBR92MGD1zNZKiY19vRbDRcWQC9E9KRPsnuLW0/g4FnSk0o9vH03xkPdVwGDpAgaI59i46rNyKPjhzv2F6bWxve6bFKCI5bCUFTq6h/6dUXH5pDS1lcXYvu9CC7o1Rb/Gil4W8cv2iM/eKezWEr62a1KLOUWOqBgA3ueGiGB4kbJs6C5nPZNDWapRxSXpieyUQe5Z8FQOsFPBV0sInuXakDLCwi2k2ApLwuUXkn6F31FqAyZ0sI4W0N7h678wbMTxuHpMs1rA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org 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=nKyxcAgUCexfwB0nnlBDiQUjVDlR2XLAMOAA2n+0uWQ=; b=ODRdYLbeN6UVxsOvRZ/rFr/9JqHlIZaYR0qcf6LES70l5QCGU3QojlA56EeFjBJIMwIO+r2OXH77sbsOVTZRVGQaySzsUoPisflNel7Xxgj14azY1/c1Dmot86sSi8CHptWA3LAPLh3YP6QkgZO0C2JRD/v9IyEjsG1NK6BpmtDKEJl4FXffJf9EspcvroZ/MZk9ggiDLkvtSOV5S5zpja+Ydno3rvPyXF7jYUhIxedTxu0eMigGEuuSrr+f6u9atOmlrIxN3iMPK1uIjMGD9d3SfmyBKNprABXeFIkjuLmG7k5qohmVq7OtywxPAZktU2JIHFaml6iX5vnfjbSnUA== Received: from MW4PR04CA0037.namprd04.prod.outlook.com (2603:10b6:303:6a::12) by BL1PR12MB5971.namprd12.prod.outlook.com (2603:10b6:208:39a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.18; Sat, 7 Dec 2024 08:02:25 +0000 Received: from SJ1PEPF00001CDD.namprd05.prod.outlook.com (2603:10b6:303:6a:cafe::4f) by MW4PR04CA0037.outlook.office365.com (2603:10b6:303:6a::12) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.12 via Frontend Transport; Sat, 7 Dec 2024 08:02:25 +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 SJ1PEPF00001CDD.mail.protection.outlook.com (10.167.242.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Sat, 7 Dec 2024 08:02:24 +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; Sat, 7 Dec 2024 00:02:17 -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.1544.4; Sat, 7 Dec 2024 00:02:15 -0800 From: Xueming Li To: Shun Hao CC: Xueming Li , Bing Zhao , "dpdk stable" Subject: patch 'net/mlx5: fix memory leak in metering' has been queued to stable release 23.11.3 Date: Sat, 7 Dec 2024 15:59:31 +0800 Message-ID: <20241207080055.488538-14-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241207080055.488538-1-xuemingl@nvidia.com> References: <20241111062847.216344-122-xuemingl@nvidia.com> <20241207080055.488538-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: SJ1PEPF00001CDD:EE_|BL1PR12MB5971:EE_ X-MS-Office365-Filtering-Correlation-Id: b8ef87d9-cd56-4fdd-2b07-08dd16957c6c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?HD1rCjUgcrigRIj0sTbWeUS12dgOZXrwWlX6Zd4dRl7lrHgtYZNx514SPsMB?= =?us-ascii?Q?/2YzM+1BTUvqs38gU1hML/NMt7vZ7uXntDydhN7kUI8pdEWirx/oljA8YPkg?= =?us-ascii?Q?+0VcoaNSxV47ungItM6rVSUJhTXy9/Hr0rv3XAMonNjRLoX4eUXLEzKfGrdq?= =?us-ascii?Q?4pVcYY9Uix63rqNnb8jbZxcrlwQ8CooayN+AxOoKGe58pLD3nhKWoCa9/723?= =?us-ascii?Q?6B7CQLwcipYkAebPrGa0+nyVdUWSWt9S501AvNy+TK4Kj87SE90E1EsyGfPB?= =?us-ascii?Q?ECS7cnjN2WGmAmzbce20SXYNOCGZZztf9LrdTY1/thT8mKaHvE8IXL9gQRK6?= =?us-ascii?Q?cqJJxi9ds+D6k1NyLezLCe3xj8dVYiOOQZTeFFG/yrQ/VuM9Sadmr8mOSdJg?= =?us-ascii?Q?dQInvqM1t3+vShPBzDAcxOUc5GxniDhFWY5pMYUTeOKMDB31DWH4v2uGUGLs?= =?us-ascii?Q?QWVI1dA/RPAQj6CI16N5p43w05xKspbEGy7ILxwDyhRWjAs7Wb5TRRCa2ra8?= =?us-ascii?Q?4mYtzomOTY526zU2a36D1seQSwVJScj4ysYhiaMRxs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8etrmbrx7so+uIp4sWG?= 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)(36860700013)(376014)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2024 08:02:24.8630 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b8ef87d9-cd56-4fdd-2b07-08dd16957c6c 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: SJ1PEPF00001CDD.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5971 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.3 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/10/24. 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=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=4e2de6fbed81e68f9a92807bfbb259482b6973ba Thanks. Xueming Li --- >From 4e2de6fbed81e68f9a92807bfbb259482b6973ba Mon Sep 17 00:00:00 2001 From: Shun Hao Date: Wed, 23 Oct 2024 09:22:15 +0300 Subject: [PATCH] net/mlx5: fix memory leak in metering Cc: Xueming Li [ upstream commit 4dd46d38820e0bf5e74f99b84f4b098d1b7220dd ] Avoid allocating memory for meter profile table when meter is not enabled. This memory was not being freed in the close process when meter was disabled, potentially causing a leak. Fixes: a295c69a8b24 ("net/mlx5: optimize meter profile lookup") Signed-off-by: Shun Hao Acked-by: Bing Zhao --- drivers/net/mlx5/linux/mlx5_os.c | 8 +++++--- drivers/net/mlx5/mlx5_flow_meter.c | 4 ++-- drivers/net/mlx5/windows/mlx5_os.c | 8 +++++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 2241e84341..9dcdc8581a 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1570,9 +1570,11 @@ err_secondary: priv->ctrl_flows = 0; rte_spinlock_init(&priv->flow_list_lock); TAILQ_INIT(&priv->flow_meters); - priv->mtr_profile_tbl = mlx5_l3t_create(MLX5_L3T_TYPE_PTR); - if (!priv->mtr_profile_tbl) - goto error; + if (priv->mtr_en) { + priv->mtr_profile_tbl = mlx5_l3t_create(MLX5_L3T_TYPE_PTR); + if (!priv->mtr_profile_tbl) + goto error; + } /* Bring Ethernet device up. */ DRV_LOG(DEBUG, "port %u forcing Ethernet interface up", eth_dev->data->port_id); diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c index 7bf5018c70..a4d954cb1f 100644 --- a/drivers/net/mlx5/mlx5_flow_meter.c +++ b/drivers/net/mlx5/mlx5_flow_meter.c @@ -100,8 +100,8 @@ mlx5_flow_meter_profile_find(struct mlx5_priv *priv, uint32_t meter_profile_id) if (priv->mtr_profile_arr) return &priv->mtr_profile_arr[meter_profile_id]; - if (mlx5_l3t_get_entry(priv->mtr_profile_tbl, - meter_profile_id, &data) || !data.ptr) + if (!priv->mtr_profile_tbl || + mlx5_l3t_get_entry(priv->mtr_profile_tbl, meter_profile_id, &data) || !data.ptr) return NULL; fmp = data.ptr; /* Remove reference taken by the mlx5_l3t_get_entry. */ diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c index b731bdff06..a9614b125b 100644 --- a/drivers/net/mlx5/windows/mlx5_os.c +++ b/drivers/net/mlx5/windows/mlx5_os.c @@ -518,9 +518,11 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, claim_zero(mlx5_mac_addr_add(eth_dev, &mac, 0, 0)); priv->ctrl_flows = 0; TAILQ_INIT(&priv->flow_meters); - priv->mtr_profile_tbl = mlx5_l3t_create(MLX5_L3T_TYPE_PTR); - if (!priv->mtr_profile_tbl) - goto error; + if (priv->mtr_en) { + priv->mtr_profile_tbl = mlx5_l3t_create(MLX5_L3T_TYPE_PTR); + if (!priv->mtr_profile_tbl) + goto error; + } /* Bring Ethernet device up. */ DRV_LOG(DEBUG, "port %u forcing Ethernet interface up.", eth_dev->data->port_id); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-12-06 23:26:44.581205921 +0800 +++ 0013-net-mlx5-fix-memory-leak-in-metering.patch 2024-12-06 23:26:43.863044829 +0800 @@ -1 +1 @@ -From 4dd46d38820e0bf5e74f99b84f4b098d1b7220dd Mon Sep 17 00:00:00 2001 +From 4e2de6fbed81e68f9a92807bfbb259482b6973ba Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 4dd46d38820e0bf5e74f99b84f4b098d1b7220dd ] @@ -11 +13,0 @@ -Cc: stable@dpdk.org @@ -22 +24 @@ -index 7d0d4bf23b..69a80b9ddc 100644 +index 2241e84341..9dcdc8581a 100644 @@ -25 +27 @@ -@@ -1612,9 +1612,11 @@ err_secondary: +@@ -1570,9 +1570,11 @@ err_secondary: @@ -41 +43 @@ -index 19d8607070..98a61cbdd4 100644 +index 7bf5018c70..a4d954cb1f 100644 @@ -44 +46 @@ -@@ -378,8 +378,8 @@ mlx5_flow_meter_profile_find(struct mlx5_priv *priv, uint32_t meter_profile_id) +@@ -100,8 +100,8 @@ mlx5_flow_meter_profile_find(struct mlx5_priv *priv, uint32_t meter_profile_id) @@ -56 +58 @@ -index 80f1679388..268598f209 100644 +index b731bdff06..a9614b125b 100644 @@ -59 +61 @@ -@@ -521,9 +521,11 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, +@@ -518,9 +518,11 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,