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 B6D34455AD for ; Mon, 15 Jul 2024 17:31:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B2C4E40E15; Mon, 15 Jul 2024 17:31:00 +0200 (CEST) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mails.dpdk.org (Postfix) with ESMTP id 70E5F40A71 for ; Mon, 15 Jul 2024 17:30:59 +0200 (CEST) Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-3679df4cb4cso2831104f8f.0 for ; Mon, 15 Jul 2024 08:30:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721057459; x=1721662259; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CYk+xOpw+09IvCo31wEIUpgI5K2iJMh9oUiVf1cbEXo=; b=gDpcHEN8ktykXUwHMitHdL3xh5WvjSkJoUchjte1hBN1LeU2eGcz65a7J2VTMdiK7F +e8S5esBxuTwMi1tVZiyfWHe4r11IWHFhNpOXk0au7ogtkZLiwP8DrEVu8/Q2NteO6oF SqLBxTVZf1Axgo/hBgKp5uJxjwF18+ExLpdUHi5GYyaOy65izfesG0+CGYGMjijsTXxo oLFX3PhNaVMgzxV08x7DmAPSs+SEel5VWUQB9mePQToCRQ+aFOKa1584ZvU4VbrbBTK5 9tb9xk0deW/tOv+d6umrlaClx8g463oiRZJfbaHNfCiBXtUo/WJTgXPb55FE8VKJ92em 2dfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721057459; x=1721662259; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CYk+xOpw+09IvCo31wEIUpgI5K2iJMh9oUiVf1cbEXo=; b=R60eGsuRd6HGnSRhxBKx681LNmB/F/jl2QEUpHFJas3yZLzQzPA6Q2mCHwFUkDvXZS oFYIqaWnbKgtRrgwsENjNNDMDhmv6FdBvu6+kuiWY7daY3Zm/BwIlwL7F6m7TgMH4CRJ e4jHWsUaPzR2ZTFxxFzpQOBhp9iRv1rPdXOS402G/jDtAU0wTz9UycmcNOHWfnFDWz96 /Traw4SsFAfE5XsN95CB/A09ACNF2gjR6JPXLAV0huYykzQOaryTS3s8WRtWVVnQZa1/ XVs09RbujigsQRHBjsnoWt4hmK8iU/aDfYJ32sJ/25LYVKc/vjqiHYV3L9GqpCXQ7JCj 9bbQ== X-Gm-Message-State: AOJu0Yzf7RAEF7apu6KW2ksUAARPfG/GM9BWqOZuoCr6SLPBb+KAUnRr ETAJpWQ4AlQJVXIgBxO2Ik3VA0LW4UbwH1cV2SY4xz1cpJP5gBgfj+OtVLXahl0= X-Google-Smtp-Source: AGHT+IFHme5VXNd2RTuIXeo6AzuDtuCXYIkO1l7GfXkx4L9VlW5wZJlBvc76wWvpcakoPE21Sqwseg== X-Received: by 2002:a05:6000:ac5:b0:367:8fb4:ddc4 with SMTP id ffacd0b85a97d-367ff70cd10mr7810032f8f.33.1721057458978; Mon, 15 Jul 2024 08:30:58 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:7aef:1aaa:3dff:d546]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427a5ef460csm92240675e9.44.2024.07.15.08.30.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jul 2024 08:30:58 -0700 (PDT) From: luca.boccassi@gmail.com To: Jiawen Wu Cc: dpdk stable Subject: patch 'net/txgbe: fix memory leaks' has been queued to stable release 22.11.6 Date: Mon, 15 Jul 2024 16:26:50 +0100 Message-Id: <20240715152704.2229503-72-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240715152704.2229503-1-luca.boccassi@gmail.com> References: <20240624235907.885628-81-luca.boccassi@gmail.com> <20240715152704.2229503-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/17/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/c14e0d31df0b0503fa7ccaf3642c7a92a093b8d1 Thanks. Luca Boccassi --- >From c14e0d31df0b0503fa7ccaf3642c7a92a093b8d1 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 d116bbd978..a99178ff45 100644 --- a/drivers/net/txgbe/txgbe_ethdev.c +++ b/drivers/net/txgbe/txgbe_ethdev.c @@ -734,6 +734,8 @@ eth_txgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) PMD_INIT_LOG(ERR, "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; } @@ -901,6 +903,7 @@ static int txgbe_fdir_filter_init(struct rte_eth_dev *eth_dev) if (!fdir_info->hash_map) { PMD_INIT_LOG(ERR, "Failed to allocate memory for fdir hash map!"); + rte_hash_free(fdir_info->hash_handle); return -ENOMEM; } fdir_info->mask_added = FALSE; @@ -936,6 +939,7 @@ static int txgbe_l2_tn_filter_init(struct rte_eth_dev *eth_dev) if (!l2_tn_info->hash_map) { PMD_INIT_LOG(ERR, "Failed to allocate memory for L2 TN hash map!"); + rte_hash_free(l2_tn_info->hash_handle); return -ENOMEM; } l2_tn_info->e_tag_en = FALSE; diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c b/drivers/net/txgbe/txgbe_ethdev_vf.c index 1d7f1dcd15..b42c94adc1 100644 --- a/drivers/net/txgbe/txgbe_ethdev_vf.c +++ b/drivers/net/txgbe/txgbe_ethdev_vf.c @@ -295,6 +295,8 @@ eth_txgbevf_dev_init(struct rte_eth_dev *eth_dev) err = hw->mac.start_hw(hw); 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; } @@ -670,8 +672,10 @@ txgbevf_dev_start(struct rte_eth_dev *dev) * now only one vector is used for Rx queue */ 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; + } } if (rte_intr_dp_is_en(intr_handle)) { @@ -679,6 +683,7 @@ txgbevf_dev_start(struct rte_eth_dev *dev) dev->data->nb_rx_queues)) { 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 910d232ab0..b0ec1c96d7 100644 --- a/drivers/net/txgbe/txgbe_rxtx.c +++ b/drivers/net/txgbe/txgbe_rxtx.c @@ -2135,6 +2135,7 @@ txgbe_tx_queue_release(struct txgbe_tx_queue *txq) if (txq != NULL && txq->ops != NULL) { txq->ops->release_mbufs(txq); txq->ops->free_swring(txq); + rte_memzone_free(txq->mz); rte_free(txq); } } @@ -2346,6 +2347,7 @@ txgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, return -ENOMEM; } + txq->mz = tz; txq->nb_tx_desc = nb_desc; txq->tx_free_thresh = tx_free_thresh; txq->pthresh = tx_conf->tx_thresh.pthresh; @@ -2463,6 +2465,7 @@ txgbe_rx_queue_release(struct txgbe_rx_queue *rxq) txgbe_rx_queue_release_mbufs(rxq); rte_free(rxq->sw_ring); rte_free(rxq->sw_sc_ring); + rte_memzone_free(rxq->mz); rte_free(rxq); } } @@ -2556,6 +2559,7 @@ txgbe_reset_rx_queue(struct txgbe_adapter *adapter, struct txgbe_rx_queue *rxq) rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_thresh - 1); 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; } @@ -2636,6 +2640,7 @@ txgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, return -ENOMEM; } + 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 @@ -314,6 +314,7 @@ struct txgbe_rx_queue { struct rte_mbuf fake_mbuf; /** hold packets to return to application */ struct rte_mbuf *rx_stage[RTE_PMD_TXGBE_RX_MAX_BURST * 2]; + const struct rte_memzone *mz; }; /** @@ -402,6 +403,7 @@ struct txgbe_tx_queue { uint8_t using_ipsec; /**< indicates that IPsec TX feature is in use */ #endif + const struct rte_memzone *mz; }; struct txgbe_txq_ops { -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-07-15 16:19:38.191775608 +0100 +++ 0072-net-txgbe-fix-memory-leaks.patch 2024-07-15 16:19:34.704209367 +0100 @@ -1 +1 @@ -From 9a4abe8dfd85376b8ef35bf958332d837f4a3ee1 Mon Sep 17 00:00:00 2001 +From c14e0d31df0b0503fa7ccaf3642c7a92a093b8d1 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 d116bbd978..a99178ff45 100644 @@ -28 +29 @@ -@@ -735,6 +735,8 @@ eth_txgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) +@@ -734,6 +734,8 @@ eth_txgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) @@ -37 +38 @@ -@@ -902,6 +904,7 @@ static int txgbe_fdir_filter_init(struct rte_eth_dev *eth_dev) +@@ -901,6 +903,7 @@ static int txgbe_fdir_filter_init(struct rte_eth_dev *eth_dev) @@ -45 +46 @@ -@@ -937,6 +940,7 @@ static int txgbe_l2_tn_filter_init(struct rte_eth_dev *eth_dev) +@@ -936,6 +939,7 @@ static int txgbe_l2_tn_filter_init(struct rte_eth_dev *eth_dev) @@ -54 +55 @@ -index 6ac34058ab..87f76673d7 100644 +index 1d7f1dcd15..b42c94adc1 100644 @@ -66 +67 @@ -@@ -671,8 +673,10 @@ txgbevf_dev_start(struct rte_eth_dev *dev) +@@ -670,8 +672,10 @@ txgbevf_dev_start(struct rte_eth_dev *dev) @@ -78 +79 @@ -@@ -680,6 +684,7 @@ txgbevf_dev_start(struct rte_eth_dev *dev) +@@ -679,6 +683,7 @@ txgbevf_dev_start(struct rte_eth_dev *dev) @@ -87 +88 @@ -index 35f80d73ac..5bc0f8772f 100644 +index 910d232ab0..b0ec1c96d7 100644 @@ -90 +91 @@ -@@ -2157,6 +2157,7 @@ txgbe_tx_queue_release(struct txgbe_tx_queue *txq) +@@ -2135,6 +2135,7 @@ txgbe_tx_queue_release(struct txgbe_tx_queue *txq) @@ -98 +99 @@ -@@ -2376,6 +2377,7 @@ txgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, +@@ -2346,6 +2347,7 @@ txgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, @@ -106 +107 @@ -@@ -2499,6 +2501,7 @@ txgbe_rx_queue_release(struct txgbe_rx_queue *rxq) +@@ -2463,6 +2465,7 @@ txgbe_rx_queue_release(struct txgbe_rx_queue *rxq) @@ -114 +115 @@ -@@ -2592,6 +2595,7 @@ txgbe_reset_rx_queue(struct txgbe_adapter *adapter, struct txgbe_rx_queue *rxq) +@@ -2556,6 +2559,7 @@ txgbe_reset_rx_queue(struct txgbe_adapter *adapter, struct txgbe_rx_queue *rxq) @@ -121,2 +122,2 @@ - -@@ -2677,6 +2681,7 @@ txgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, + } +@@ -2636,6 +2640,7 @@ txgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, @@ -131 +132 @@ -index 336f060633..9155eb1f70 100644 +index 27d4c842c0..c579e1a9f2 100644 @@ -134 +135 @@ -@@ -322,6 +322,7 @@ struct txgbe_rx_queue { +@@ -314,6 +314,7 @@ struct txgbe_rx_queue { @@ -142 +143 @@ -@@ -410,6 +411,7 @@ struct txgbe_tx_queue { +@@ -402,6 +403,7 @@ struct txgbe_tx_queue {