[dpdk-stable] patch 'net/ice: fix leak on thread termination' has been queued to stable release 20.11.2

Xueming Li xuemingl at nvidia.com
Sat Jun 12 01:03:44 CEST 2021


Hi,

FYI, your patch has been queued to stable release 20.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/14/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/1cf7b4c7692ab2a8eaf455654a9bd46eab606b90

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 1cf7b4c7692ab2a8eaf455654a9bd46eab606b90 Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand at redhat.com>
Date: Tue, 11 May 2021 13:33:58 +0200
Subject: [PATCH] net/ice: fix leak on thread termination
Cc: Luca Boccassi <bluca at debian.org>

[ upstream commit 8eff201b0021a5821cd71149a43805501f9373c1 ]

A terminated pthread should be joined or detached so that its associated
resources are released.

The "ice-reset-<vf_id>" threads are used to service some reset task in
the background, but they are never joined by the thread that created
them.
The easiest solution is to detach new threads.

The Windows EAL did not provide a pthread_detach wrapper but there is no
resource to release for Windows threads, so add an empty wrapper.

Fixes: 3b3757bda3c3 ("net/ice: get VF hardware index in DCF")

Signed-off-by: David Marchand <david.marchand at redhat.com>
Acked-by: Haiyue Wang <haiyue.wang at intel.com>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk at gmail.com>
---
 drivers/net/ice/ice_dcf_parent.c         | 2 ++
 lib/librte_eal/windows/include/pthread.h | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/ice/ice_dcf_parent.c b/drivers/net/ice/ice_dcf_parent.c
index 30ead4c9fd..b109e360f9 100644
--- a/drivers/net/ice/ice_dcf_parent.c
+++ b/drivers/net/ice/ice_dcf_parent.c
@@ -112,8 +112,10 @@ ice_dcf_vsi_update_service_handler(void *param)
 {
 	struct ice_dcf_hw *hw = param;
 
+	pthread_detach(pthread_self());
 	usleep(ICE_DCF_VSI_UPDATE_SERVICE_INTERVAL);
 
+
 	rte_spinlock_lock(&vsi_update_lock);
 
 	if (!ice_dcf_handle_vsi_update_event(hw)) {
diff --git a/lib/librte_eal/windows/include/pthread.h b/lib/librte_eal/windows/include/pthread.h
index 1939b0121c..27fd2cca52 100644
--- a/lib/librte_eal/windows/include/pthread.h
+++ b/lib/librte_eal/windows/include/pthread.h
@@ -143,6 +143,12 @@ pthread_create(void *threadid, const void *threadattr, void *threadfunc,
 	return ((hThread != NULL) ? 0 : E_FAIL);
 }
 
+static inline int
+pthread_detach(__rte_unused pthread_t thread)
+{
+	return 0;
+}
+
 static inline int
 pthread_join(__rte_unused pthread_t thread,
 	__rte_unused void **value_ptr)
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-06-12 06:53:59.907392900 +0800
+++ 0130-net-ice-fix-leak-on-thread-termination.patch	2021-06-12 06:53:56.540000000 +0800
@@ -1 +1 @@
-From 8eff201b0021a5821cd71149a43805501f9373c1 Mon Sep 17 00:00:00 2001
+From 1cf7b4c7692ab2a8eaf455654a9bd46eab606b90 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Luca Boccassi <bluca at debian.org>
+
+[ upstream commit 8eff201b0021a5821cd71149a43805501f9373c1 ]
@@ -18 +20,0 @@
-Cc: stable at dpdk.org
@@ -24,2 +26,2 @@
- drivers/net/ice/ice_dcf_parent.c  | 2 ++
- lib/eal/windows/include/pthread.h | 6 ++++++
+ drivers/net/ice/ice_dcf_parent.c         | 2 ++
+ lib/librte_eal/windows/include/pthread.h | 6 ++++++
@@ -29 +31 @@
-index c8e433239b..1d7aa8bc87 100644
+index 30ead4c9fd..b109e360f9 100644
@@ -32,3 +34,3 @@
-@@ -121,6 +121,8 @@ ice_dcf_vsi_update_service_handler(void *param)
- 	struct ice_dcf_hw *hw = reset_param->dcf_hw;
- 	struct ice_dcf_adapter *adapter;
+@@ -112,8 +112,10 @@ ice_dcf_vsi_update_service_handler(void *param)
+ {
+ 	struct ice_dcf_hw *hw = param;
@@ -37,2 +39 @@
-+
- 	rte_delay_us(ICE_DCF_VSI_UPDATE_SERVICE_INTERVAL);
+ 	usleep(ICE_DCF_VSI_UPDATE_SERVICE_INTERVAL);
@@ -39,0 +41 @@
++
@@ -41 +43,3 @@
-diff --git a/lib/eal/windows/include/pthread.h b/lib/eal/windows/include/pthread.h
+ 
+ 	if (!ice_dcf_handle_vsi_update_event(hw)) {
+diff --git a/lib/librte_eal/windows/include/pthread.h b/lib/librte_eal/windows/include/pthread.h
@@ -43,2 +47,2 @@
---- a/lib/eal/windows/include/pthread.h
-+++ b/lib/eal/windows/include/pthread.h
+--- a/lib/librte_eal/windows/include/pthread.h
++++ b/lib/librte_eal/windows/include/pthread.h


More information about the stable mailing list