From: Yunjian Wang <wangyunjian@huawei.com>
To: <dev@dpdk.org>
Cc: <haiyue.wang@intel.com>, <beilei.xing@intel.com>,
<qiming.yang@intel.com>, <qi.z.zhang@intel.com>,
<dingxiaoxiong@huawei.com>, Yunjian Wang <wangyunjian@huawei.com>,
<stable@dpdk.org>
Subject: [dpdk-dev] [PATCH v3 4/4] net/ixgbe: fix memzone leak when re-configure the RX/TX queues
Date: Wed, 22 Sep 2021 21:30:04 +0800 [thread overview]
Message-ID: <5903785d9846efe76eedab5480dd2858f0361da5.1632315160.git.wangyunjian@huawei.com> (raw)
In-Reply-To: <cover.1632315160.git.wangyunjian@huawei.com>
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")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.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 bfdfd5e755..1b6e0489f4 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -2482,6 +2482,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);
}
}
@@ -2763,6 +2764,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;
@@ -2887,6 +2889,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);
}
}
@@ -3162,6 +3165,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
return -ENOMEM;
}
+ rxq->mz = rz;
/*
* Zero init all the descriptors in the ring.
*/
@@ -3433,14 +3437,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 476ef62cfd..a1764f2b08 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.23.0
next prev parent reply other threads:[~2021-09-22 13:30 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-17 11:24 [dpdk-dev] [PATCH 0/4] delete HW rings when releasing queues Yunjian Wang
2021-09-17 11:24 ` [dpdk-dev] [PATCH 1/4] net/e1000: " Yunjian Wang
2021-09-17 11:24 ` [dpdk-dev] [PATCH 2/4] net/ice: " Yunjian Wang
2021-09-17 11:24 ` [dpdk-dev] [PATCH 3/4] net/i40e: " Yunjian Wang
2021-09-17 11:25 ` [dpdk-dev] [PATCH 4/4] net/ixgbe: " Yunjian Wang
2021-09-17 15:46 ` Wang, Haiyue
2021-09-18 3:10 ` wangyunjian
2021-09-18 3:19 ` Wang, Haiyue
2021-09-18 8:33 ` [dpdk-dev] [PATCH v2 0/4] delete HW rings when releasing queues for some drivers Yunjian Wang
2021-09-18 8:33 ` [dpdk-dev] [PATCH v2 1/4] net/e1000: delete HW rings when releasing queues Yunjian Wang
2021-09-18 8:41 ` [dpdk-dev] [PATCH v2 2/4] net/ice: " Yunjian Wang
2021-09-18 8:41 ` [dpdk-dev] [PATCH v2 3/4] net/i40e: " Yunjian Wang
2021-09-18 8:41 ` [dpdk-dev] [PATCH v2 4/4] net/ixgbe: " Yunjian Wang
2021-09-22 6:22 ` Wang, Haiyue
2021-09-22 6:58 ` wangyunjian
2021-09-22 7:04 ` Wang, Haiyue
2021-09-22 11:13 ` wangyunjian
2021-09-22 11:43 ` Wang, Haiyue
2021-09-20 7:25 ` [dpdk-dev] [PATCH v2 0/4] delete HW rings when releasing queues for some drivers David Marchand
2021-09-21 9:21 ` Wang, Haiyue
2021-09-22 13:27 ` [dpdk-dev] [PATCH v3 0/4] fixes for intel drivers Yunjian Wang
2021-09-22 13:28 ` [dpdk-dev] [PATCH v3 1/4] net/e1000: fix memzone leak when re-configure the RX/TX queues Yunjian Wang
2021-09-22 13:51 ` Wang, Haiyue
2021-09-22 13:28 ` [dpdk-dev] [PATCH v3 2/4] net/ice: " Yunjian Wang
2021-09-22 13:51 ` Wang, Haiyue
2021-09-22 13:29 ` [dpdk-dev] [PATCH v3 3/4] net/i40e: " Yunjian Wang
2021-09-22 13:51 ` Wang, Haiyue
2021-09-22 13:30 ` Yunjian Wang [this message]
2021-09-22 13:51 ` [dpdk-dev] [PATCH v3 4/4] net/ixgbe: " Wang, Haiyue
2021-10-07 11:39 ` [dpdk-dev] [PATCH v3 0/4] fixes for intel drivers Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5903785d9846efe76eedab5480dd2858f0361da5.1632315160.git.wangyunjian@huawei.com \
--to=wangyunjian@huawei.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=dingxiaoxiong@huawei.com \
--cc=haiyue.wang@intel.com \
--cc=qi.z.zhang@intel.com \
--cc=qiming.yang@intel.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).