[dpdk-stable] patch 'net/ixgbe: fix memzone leak on queue re-configure' has been queued to stable release 20.11.4

Xueming Li xuemingl at nvidia.com
Wed Nov 10 07:29:54 CET 2021


Hi,

FYI, your patch has been queued to stable release 20.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 11/12/21. 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/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/2adcdc8cc791f517ada0cf99f9f7138d4cd4bbe5

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 2adcdc8cc791f517ada0cf99f9f7138d4cd4bbe5 Mon Sep 17 00:00:00 2001
From: Yunjian Wang <wangyunjian at huawei.com>
Date: Wed, 22 Sep 2021 21:30:04 +0800
Subject: [PATCH] net/ixgbe: fix memzone leak on queue re-configure
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit a4ae7f51d21af6f59d6ce1e1117de227b352a4cc ]

Normally when closing the device the queue memzone should be
freed. But the memzone will be not freed, when device setup
ops like:

rte_eth_bond_slave_remove
-->__eth_bond_slave_remove_lock_free
---->slave_remove
------>rte_eth_dev_internal_reset
-------->rte_eth_dev_rx_queue_config
---------->eth_dev_rx_queue_config
------------>ixgbe_dev_rx_queue_release
rte_eth_dev_close
-->ixgbe_dev_close
---->ixgbe_dev_free_queues
------>ixgbe_dev_rx_queue_release
      (not been called due to nb_rx_queues and nb_tx_queues are 0)

And when queue number is changed to small size, the BIG memzone
queue index will be lost. This will lead to a memory leak. So we
should release the memzone when releasing queues.

Fixes: 460d1679586e ("drivers/net: delete HW rings while freeing queues")

Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
Acked-by: Haiyue Wang <haiyue.wang at intel.com>
---
 drivers/net/ixgbe/ixgbe_rxtx.c | 6 ++++--
 drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 3d983d4db7..c0ab36ad86 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -2449,6 +2449,7 @@ ixgbe_tx_queue_release(struct ixgbe_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);
 	}
 }
@@ -2730,6 +2731,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
 		return -ENOMEM;
 	}
 
+	txq->mz = tz;
 	txq->nb_tx_desc = nb_desc;
 	txq->tx_rs_thresh = tx_rs_thresh;
 	txq->tx_free_thresh = tx_free_thresh;
@@ -2854,6 +2856,7 @@ ixgbe_rx_queue_release(struct ixgbe_rx_queue *rxq)
 		ixgbe_rx_queue_release_mbufs(rxq);
 		rte_free(rxq->sw_ring);
 		rte_free(rxq->sw_sc_ring);
+		rte_memzone_free(rxq->mz);
 		rte_free(rxq);
 	}
 }
@@ -3129,6 +3132,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
 		return -ENOMEM;
 	}
 
+	rxq->mz = rz;
 	/*
 	 * Zero init all the descriptors in the ring.
 	 */
@@ -3400,14 +3404,12 @@ ixgbe_dev_free_queues(struct rte_eth_dev *dev)
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
 		ixgbe_dev_rx_queue_release(dev->data->rx_queues[i]);
 		dev->data->rx_queues[i] = NULL;
-		rte_eth_dma_zone_free(dev, "rx_ring", i);
 	}
 	dev->data->nb_rx_queues = 0;
 
 	for (i = 0; i < dev->data->nb_tx_queues; i++) {
 		ixgbe_dev_tx_queue_release(dev->data->tx_queues[i]);
 		dev->data->tx_queues[i] = NULL;
-		rte_eth_dma_zone_free(dev, "tx_ring", i);
 	}
 	dev->data->nb_tx_queues = 0;
 }
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h
index bcadaf79ce..d18cac29bf 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.h
+++ b/drivers/net/ixgbe/ixgbe_rxtx.h
@@ -138,6 +138,7 @@ struct ixgbe_rx_queue {
 	struct rte_mbuf fake_mbuf;
 	/** hold packets to return to application */
 	struct rte_mbuf *rx_stage[RTE_PMD_IXGBE_RX_MAX_BURST*2];
+	const struct rte_memzone *mz;
 };
 
 /**
@@ -236,6 +237,7 @@ struct ixgbe_tx_queue {
 	uint8_t		    using_ipsec;
 	/**< indicates that IPsec TX feature is in use */
 #endif
+	const struct rte_memzone *mz;
 };
 
 struct ixgbe_txq_ops {
-- 
2.33.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-11-10 14:17:06.879051789 +0800
+++ 0110-net-ixgbe-fix-memzone-leak-on-queue-re-configure.patch	2021-11-10 14:17:01.877412703 +0800
@@ -1 +1 @@
-From a4ae7f51d21af6f59d6ce1e1117de227b352a4cc Mon Sep 17 00:00:00 2001
+From 2adcdc8cc791f517ada0cf99f9f7138d4cd4bbe5 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit a4ae7f51d21af6f59d6ce1e1117de227b352a4cc ]
@@ -28 +30,0 @@
-Cc: stable at dpdk.org
@@ -38 +40 @@
-index 176daaff9d..349180e7c1 100644
+index 3d983d4db7..c0ab36ad86 100644
@@ -41 +43 @@
-@@ -2482,6 +2482,7 @@ ixgbe_tx_queue_release(struct ixgbe_tx_queue *txq)
+@@ -2449,6 +2449,7 @@ ixgbe_tx_queue_release(struct ixgbe_tx_queue *txq)
@@ -49 +51 @@
-@@ -2763,6 +2764,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
+@@ -2730,6 +2731,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
@@ -57 +59 @@
-@@ -2887,6 +2889,7 @@ ixgbe_rx_queue_release(struct ixgbe_rx_queue *rxq)
+@@ -2854,6 +2856,7 @@ ixgbe_rx_queue_release(struct ixgbe_rx_queue *rxq)
@@ -65 +67 @@
-@@ -3162,6 +3165,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
+@@ -3129,6 +3132,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
@@ -73 +75 @@
-@@ -3433,14 +3437,12 @@ ixgbe_dev_free_queues(struct rte_eth_dev *dev)
+@@ -3400,14 +3404,12 @@ ixgbe_dev_free_queues(struct rte_eth_dev *dev)
@@ -75 +77 @@
- 		ixgbe_dev_rx_queue_release(dev, i);
+ 		ixgbe_dev_rx_queue_release(dev->data->rx_queues[i]);
@@ -82 +84 @@
- 		ixgbe_dev_tx_queue_release(dev, i);
+ 		ixgbe_dev_tx_queue_release(dev->data->tx_queues[i]);
@@ -89 +91 @@
-index 476ef62cfd..a1764f2b08 100644
+index bcadaf79ce..d18cac29bf 100644


More information about the stable mailing list