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 2A2FC45DB9 for ; Wed, 27 Nov 2024 18:22:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 265F8402E4; Wed, 27 Nov 2024 18:22:15 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 3D434409FA for ; Wed, 27 Nov 2024 18:22:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732728133; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VcFjxHVsagm+0dOETkr73L94NJNL7jLVhL+XczU7wBw=; b=dcJh291yRmiQvoTrWJJQ52Z8B4HJmbXGuoKYeS6ZAKBu6u5POY1ZQP2MHbfZNG0rCQOISM 4QUaHqUTqoEqqedevno+z+5OcLVzl6EJaE0XDQGTodZllHzQA5KhiJN9fBvyTye5aT3EwF Jmb1rpcgFDVg1OZecptlitw+UEDeLLk= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-92-rzEBMQbzPqGt-gvrJVPTuA-1; Wed, 27 Nov 2024 12:22:12 -0500 X-MC-Unique: rzEBMQbzPqGt-gvrJVPTuA-1 X-Mimecast-MFC-AGG-ID: rzEBMQbzPqGt-gvrJVPTuA Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 753501955D4D; Wed, 27 Nov 2024 17:22:11 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.192.52]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 262FB300019E; Wed, 27 Nov 2024 17:22:09 +0000 (UTC) From: Kevin Traynor To: Shun Hao Cc: Bing Zhao , dpdk stable Subject: patch 'net/mlx5: fix memory leak in metering' has been queued to stable release 21.11.9 Date: Wed, 27 Nov 2024 17:18:23 +0000 Message-ID: <20241127171916.690404-76-ktraynor@redhat.com> In-Reply-To: <20241127171916.690404-1-ktraynor@redhat.com> References: <20241127171916.690404-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: BDeNUSguiIj_wpZmv9zS6g6Lu-zQl-e9FtAUy1iFza4_1732728131 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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 21.11.9 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/02/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://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/65c3055305aa57088ed84e05aa79edcf8dc6714a Thanks. Kevin --- >From 65c3055305aa57088ed84e05aa79edcf8dc6714a 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 [ 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 841512faa3..f5a61f38e8 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1663,7 +1663,9 @@ err_secondary: 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", diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c index fd3f993892..3623147bcd 100644 --- a/drivers/net/mlx5/mlx5_flow_meter.c +++ b/drivers/net/mlx5/mlx5_flow_meter.c @@ -99,6 +99,6 @@ mlx5_flow_meter_profile_find(struct mlx5_priv *priv, uint32_t meter_profile_id) int32_t ret; - 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; diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c index ba99901c5c..2f11bd1d23 100644 --- a/drivers/net/mlx5/windows/mlx5_os.c +++ b/drivers/net/mlx5/windows/mlx5_os.c @@ -584,7 +584,9 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, 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.", -- 2.47.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-11-27 17:17:40.648771905 +0000 +++ 0076-net-mlx5-fix-memory-leak-in-metering.patch 2024-11-27 17:17:38.277269643 +0000 @@ -1 +1 @@ -From 4dd46d38820e0bf5e74f99b84f4b098d1b7220dd Mon Sep 17 00:00:00 2001 +From 65c3055305aa57088ed84e05aa79edcf8dc6714a Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 4dd46d38820e0bf5e74f99b84f4b098d1b7220dd ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -22 +23 @@ -index 7d0d4bf23b..69a80b9ddc 100644 +index 841512faa3..f5a61f38e8 100644 @@ -25 +26 @@ -@@ -1613,7 +1613,9 @@ err_secondary: +@@ -1663,7 +1663,9 @@ err_secondary: @@ -39 +40 @@ -index 19d8607070..98a61cbdd4 100644 +index fd3f993892..3623147bcd 100644 @@ -42,3 +43,3 @@ -@@ -379,6 +379,6 @@ 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]; +@@ -99,6 +99,6 @@ mlx5_flow_meter_profile_find(struct mlx5_priv *priv, uint32_t meter_profile_id) + int32_t ret; + @@ -52 +53 @@ -index 80f1679388..268598f209 100644 +index ba99901c5c..2f11bd1d23 100644 @@ -55 +56 @@ -@@ -522,7 +522,9 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, +@@ -584,7 +584,9 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,