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 3A80845804 for ; Fri, 23 Aug 2024 18:23:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 346FF433A0; Fri, 23 Aug 2024 18:23:22 +0200 (CEST) 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 9A64C4337C for ; Fri, 23 Aug 2024 18:23:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724430200; 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=SROWcDuH6LucNHbzNkS6UxBk+aQoxarQuaFWKTG3V6k=; b=UmZIWYRVDOkeJwqm4n9+Q8dojadcF+D+g+0VioyqyCV7c6fh1ERdCSGFmq5DvfPTc7TbIj hMfVPZszUVYgcshOEJ3qzkRin0c1jIP4kryEnw1ZiZ1i5SFxWZxQ+FjPnp6rcdUzJ7UrTA b3WPTBMFFmLbnoBfG3JKUrLBpkt4i9s= Received: from mx-prod-mc-05.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-462-JktAV8GjOu-G03ihcPX5gA-1; Fri, 23 Aug 2024 12:23:18 -0400 X-MC-Unique: JktAV8GjOu-G03ihcPX5gA-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0A0541955F65; Fri, 23 Aug 2024 16:23:18 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.193.224]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A8CA41955F54; Fri, 23 Aug 2024 16:23:16 +0000 (UTC) From: Kevin Traynor To: Jiawen Wu Cc: dpdk stable Subject: patch 'net/txgbe: fix memory leaks' has been queued to stable release 21.11.8 Date: Fri, 23 Aug 2024 17:18:53 +0100 Message-ID: <20240823161929.1004778-105-ktraynor@redhat.com> In-Reply-To: <20240823161929.1004778-1-ktraynor@redhat.com> References: <20240823161929.1004778-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 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.8 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/28/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/f557ab4dbe79cd36592c9b751ad84ca705c0926d Thanks. Kevin --- >From f557ab4dbe79cd36592c9b751ad84ca705c0926d Mon Sep 17 00:00:00 2001 From: Jiawen Wu Date: Tue, 18 Jun 2024 15:11:45 +0800 Subject: [PATCH] net/txgbe: fix memory leaks [ upstream commit 9a4abe8dfd85376b8ef35bf958332d837f4a3ee1 ] Fix some memory leaks caused by not release resource in time. Fixes: e1698e383c2a ("net/txgbe: add device init and uninit") Fixes: 635c21354f9a ("net/txgbe: add flow director filter init and uninit") Fixes: c13f84a71b2d ("net/txgbe: add L2 tunnel filter init and uninit") Fixes: 3a123ba60a71 ("net/txgbe: support VF start and stop") Fixes: 039b769f7c01 ("net/txgbe: support VF MAC address") Fixes: 226bf98eda87 ("net/txgbe: add Rx and Tx queues setup and release") Signed-off-by: Jiawen Wu --- drivers/net/txgbe/txgbe_ethdev.c | 4 ++++ drivers/net/txgbe/txgbe_ethdev_vf.c | 7 ++++++- drivers/net/txgbe/txgbe_rxtx.c | 5 +++++ drivers/net/txgbe/txgbe_rxtx.h | 2 ++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c index 5c6e07f200..84c1b7d637 100644 --- a/drivers/net/txgbe/txgbe_ethdev.c +++ b/drivers/net/txgbe/txgbe_ethdev.c @@ -719,4 +719,6 @@ eth_txgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) "Failed to allocate %d bytes needed to store MAC addresses", RTE_ETHER_ADDR_LEN * TXGBE_VMDQ_NUM_UC_MAC); + rte_free(eth_dev->data->mac_addrs); + eth_dev->data->mac_addrs = NULL; return -ENOMEM; } @@ -890,4 +892,5 @@ static int txgbe_fdir_filter_init(struct rte_eth_dev *eth_dev) PMD_INIT_LOG(ERR, "Failed to allocate memory for fdir hash map!"); + rte_hash_free(fdir_info->hash_handle); return -ENOMEM; } @@ -925,4 +928,5 @@ static int txgbe_l2_tn_filter_init(struct rte_eth_dev *eth_dev) PMD_INIT_LOG(ERR, "Failed to allocate memory for L2 TN hash map!"); + rte_hash_free(l2_tn_info->hash_handle); return -ENOMEM; } diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c b/drivers/net/txgbe/txgbe_ethdev_vf.c index 037b7db544..6ad3e5ee49 100644 --- a/drivers/net/txgbe/txgbe_ethdev_vf.c +++ b/drivers/net/txgbe/txgbe_ethdev_vf.c @@ -294,4 +294,6 @@ eth_txgbevf_dev_init(struct rte_eth_dev *eth_dev) if (err) { PMD_INIT_LOG(ERR, "VF Initialization Failure: %d", err); + rte_free(eth_dev->data->mac_addrs); + eth_dev->data->mac_addrs = NULL; return -EIO; } @@ -667,6 +669,8 @@ txgbevf_dev_start(struct rte_eth_dev *dev) */ intr_vector = 1; - if (rte_intr_efd_enable(intr_handle, intr_vector)) + if (rte_intr_efd_enable(intr_handle, intr_vector)) { + txgbe_dev_clear_queues(dev); return -1; + } } @@ -676,4 +680,5 @@ txgbevf_dev_start(struct rte_eth_dev *dev) PMD_INIT_LOG(ERR, "Failed to allocate %d rx_queues" " intr_vec", dev->data->nb_rx_queues); + txgbe_dev_clear_queues(dev); return -ENOMEM; } diff --git a/drivers/net/txgbe/txgbe_rxtx.c b/drivers/net/txgbe/txgbe_rxtx.c index e2a32b1322..6971c775ef 100644 --- a/drivers/net/txgbe/txgbe_rxtx.c +++ b/drivers/net/txgbe/txgbe_rxtx.c @@ -2141,4 +2141,5 @@ txgbe_tx_queue_release(struct txgbe_tx_queue *txq) txq->ops->release_mbufs(txq); txq->ops->free_swring(txq); + rte_memzone_free(txq->mz); rte_free(txq); } @@ -2352,4 +2353,5 @@ txgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, } + txq->mz = tz; txq->nb_tx_desc = nb_desc; txq->tx_free_thresh = tx_free_thresh; @@ -2469,4 +2471,5 @@ txgbe_rx_queue_release(struct txgbe_rx_queue *rxq) rte_free(rxq->sw_ring); rte_free(rxq->sw_sc_ring); + rte_memzone_free(rxq->mz); rte_free(rxq); } @@ -2562,4 +2565,5 @@ txgbe_reset_rx_queue(struct txgbe_adapter *adapter, struct txgbe_rx_queue *rxq) rxq->rx_tail = 0; rxq->nb_rx_hold = 0; + rte_pktmbuf_free(rxq->pkt_first_seg); rxq->pkt_first_seg = NULL; rxq->pkt_last_seg = NULL; @@ -2642,4 +2646,5 @@ txgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, } + rxq->mz = rz; /* * Zero init all the descriptors in the ring. diff --git a/drivers/net/txgbe/txgbe_rxtx.h b/drivers/net/txgbe/txgbe_rxtx.h index 27d4c842c0..c579e1a9f2 100644 --- a/drivers/net/txgbe/txgbe_rxtx.h +++ b/drivers/net/txgbe/txgbe_rxtx.h @@ -315,4 +315,5 @@ struct txgbe_rx_queue { /** hold packets to return to application */ struct rte_mbuf *rx_stage[RTE_PMD_TXGBE_RX_MAX_BURST * 2]; + const struct rte_memzone *mz; }; @@ -403,4 +404,5 @@ struct txgbe_tx_queue { /**< indicates that IPsec TX feature is in use */ #endif + const struct rte_memzone *mz; }; -- 2.46.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-08-23 17:18:12.800706746 +0100 +++ 0105-net-txgbe-fix-memory-leaks.patch 2024-08-23 17:18:09.840430525 +0100 @@ -1 +1 @@ -From 9a4abe8dfd85376b8ef35bf958332d837f4a3ee1 Mon Sep 17 00:00:00 2001 +From f557ab4dbe79cd36592c9b751ad84ca705c0926d Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 9a4abe8dfd85376b8ef35bf958332d837f4a3ee1 ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org @@ -25 +26 @@ -index c2df5a314b..26cf7632c3 100644 +index 5c6e07f200..84c1b7d637 100644 @@ -28 +29 @@ -@@ -736,4 +736,6 @@ eth_txgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) +@@ -719,4 +719,6 @@ eth_txgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) @@ -35 +36 @@ -@@ -903,4 +905,5 @@ static int txgbe_fdir_filter_init(struct rte_eth_dev *eth_dev) +@@ -890,4 +892,5 @@ static int txgbe_fdir_filter_init(struct rte_eth_dev *eth_dev) @@ -41 +42 @@ -@@ -938,4 +941,5 @@ static int txgbe_l2_tn_filter_init(struct rte_eth_dev *eth_dev) +@@ -925,4 +928,5 @@ static int txgbe_l2_tn_filter_init(struct rte_eth_dev *eth_dev) @@ -48 +49 @@ -index 6ac34058ab..87f76673d7 100644 +index 037b7db544..6ad3e5ee49 100644 @@ -51 +52 @@ -@@ -296,4 +296,6 @@ eth_txgbevf_dev_init(struct rte_eth_dev *eth_dev) +@@ -294,4 +294,6 @@ eth_txgbevf_dev_init(struct rte_eth_dev *eth_dev) @@ -58 +59 @@ -@@ -672,6 +674,8 @@ txgbevf_dev_start(struct rte_eth_dev *dev) +@@ -667,6 +669,8 @@ txgbevf_dev_start(struct rte_eth_dev *dev) @@ -68 +69 @@ -@@ -681,4 +685,5 @@ txgbevf_dev_start(struct rte_eth_dev *dev) +@@ -676,4 +680,5 @@ txgbevf_dev_start(struct rte_eth_dev *dev) @@ -75 +76 @@ -index 35f80d73ac..5bc0f8772f 100644 +index e2a32b1322..6971c775ef 100644 @@ -78 +79 @@ -@@ -2158,4 +2158,5 @@ txgbe_tx_queue_release(struct txgbe_tx_queue *txq) +@@ -2141,4 +2141,5 @@ txgbe_tx_queue_release(struct txgbe_tx_queue *txq) @@ -84 +85 @@ -@@ -2377,4 +2378,5 @@ txgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, +@@ -2352,4 +2353,5 @@ txgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, @@ -90 +91 @@ -@@ -2500,4 +2502,5 @@ txgbe_rx_queue_release(struct txgbe_rx_queue *rxq) +@@ -2469,4 +2471,5 @@ txgbe_rx_queue_release(struct txgbe_rx_queue *rxq) @@ -96 +97 @@ -@@ -2593,4 +2596,5 @@ txgbe_reset_rx_queue(struct txgbe_adapter *adapter, struct txgbe_rx_queue *rxq) +@@ -2562,4 +2565,5 @@ txgbe_reset_rx_queue(struct txgbe_adapter *adapter, struct txgbe_rx_queue *rxq) @@ -102 +103 @@ -@@ -2678,4 +2682,5 @@ txgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, +@@ -2642,4 +2646,5 @@ txgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, @@ -109 +110 @@ -index 336f060633..9155eb1f70 100644 +index 27d4c842c0..c579e1a9f2 100644 @@ -112 +113 @@ -@@ -323,4 +323,5 @@ struct txgbe_rx_queue { +@@ -315,4 +315,5 @@ struct txgbe_rx_queue { @@ -118 +119 @@ -@@ -411,4 +412,5 @@ struct txgbe_tx_queue { +@@ -403,4 +404,5 @@ struct txgbe_tx_queue {