patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/ixgbe: fix resource leak after thread exits normally
@ 2020-04-10  5:18 taox.zhu
  2020-04-10  6:22 ` [dpdk-stable] [PATCH v2] " taox.zhu
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: taox.zhu @ 2020-04-10  5:18 UTC (permalink / raw)
  To: konstantin.ananyev; +Cc: dev

From: "Zhu, Tao" <taox.zhu@intel.com>

When the thread exits normally, pthread_join() is not called, which can
result in a resource leak. Therefore, the thread is set to separation
mode using function pthread_detach(), so that no program call
pthread_join() is required to recycle, and when the thread exits,
the system automatically reclaims resources.

Fixes: 819d0d1d57f1 ("net/ixgbe: fix blocking system events")
Cc: stable@dpdk.org

Signed-off-by: Zhu Tao <taox.zhu@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 2c57976..f141ae4 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4165,11 +4165,9 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
 ixgbe_dev_cancel_link_thread(struct rte_eth_dev *dev)
 {
 	struct ixgbe_adapter *ad = dev->data->dev_private;
-	void *retval;
 
 	if (!ixgbe_dev_wait_setup_link_complete(dev)) {
 		pthread_cancel(ad->link_thread_tid);
-		pthread_join(ad->link_thread_tid, &retval);
 		rte_atomic32_clear(&ad->link_thread_running);
 		PMD_DRV_LOG(ERR, "Link thread not complete, cancel it!");
 	}
@@ -4186,6 +4184,7 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
 	u32 speed;
 	bool autoneg = false;
 
+	pthread_detach(pthread_self());
 	speed = hw->phy.autoneg_advertised;
 	if (!speed)
 		ixgbe_get_link_capabilities(hw, &speed, &autoneg);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-04-22  5:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-10  5:18 [dpdk-stable] [PATCH] net/ixgbe: fix resource leak after thread exits normally taox.zhu
2020-04-10  6:22 ` [dpdk-stable] [PATCH v2] " taox.zhu
2020-04-10 12:09   ` Ananyev, Konstantin
     [not found]     ` <60652C6914E08D41B9AA1580751B3CA9015ED8D2@SHSMSX103.ccr.corp.intel.com>
2020-04-14 10:25       ` Ananyev, Konstantin
2020-04-14 11:26         ` Ananyev, Konstantin
2020-04-15 12:27 ` [dpdk-stable] [PATCH v3] " taox.zhu
2020-04-15 14:18 ` [dpdk-stable] [PATCH v4] " taox.zhu
2020-04-20  8:49   ` Ye Xiaolong
2020-04-21 18:53 ` [dpdk-stable] [PATCH v5] " taox.zhu
2020-04-21 22:37   ` Ananyev, Konstantin
2020-04-22  2:33   ` Ye Xiaolong
2020-04-22 12:37 ` [dpdk-stable] [PATCH v6] " taox.zhu
2020-04-22  5:18   ` Ye Xiaolong

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).