patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 1/2] net/ark: fix leak on thread termination
       [not found] <20210506094452.1689-1-david.marchand@redhat.com>
@ 2021-05-06  9:44 ` David Marchand
  2021-05-11 17:55   ` Ed Czeck
  2021-05-06  9:44 ` [dpdk-stable] [PATCH 2/2] net/ice: " David Marchand
       [not found] ` <20210511113358.2485-1-david.marchand@redhat.com>
  2 siblings, 1 reply; 9+ messages in thread
From: David Marchand @ 2021-05-06  9:44 UTC (permalink / raw)
  To: dev; +Cc: stable, Shepard Siegel, Ed Czeck, John Miller

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

The "ark-delay-pg" thread is just used to delay some task but it is never
joined by the thread that created it.
The easiest solution is to detach the new thread.

Fixes: 727b3fe292bc ("net/ark: integrate PMD")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/ark/ark_pktgen.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c
index 28a44f7546..515bfe461c 100644
--- a/drivers/net/ark/ark_pktgen.c
+++ b/drivers/net/ark/ark_pktgen.c
@@ -3,6 +3,7 @@
  */
 
 #include <unistd.h>
+#include <pthread.h>
 
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
@@ -474,6 +475,7 @@ ark_pktgen_delay_start(void *arg)
 	 * perform a blind sleep here to ensure that the external test
 	 * application has time to setup the test before we generate packets
 	 */
+	pthread_detach(pthread_self());
 	usleep(100000);
 	ark_pktgen_run(inst);
 	return NULL;
-- 
2.23.0


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

* [dpdk-stable] [PATCH 2/2] net/ice: fix leak on thread termination
       [not found] <20210506094452.1689-1-david.marchand@redhat.com>
  2021-05-06  9:44 ` [dpdk-stable] [PATCH 1/2] net/ark: fix leak on thread termination David Marchand
@ 2021-05-06  9:44 ` David Marchand
  2021-05-06 10:31   ` Wang, Haiyue
  2021-05-07  8:13   ` David Marchand
       [not found] ` <20210511113358.2485-1-david.marchand@redhat.com>
  2 siblings, 2 replies; 9+ messages in thread
From: David Marchand @ 2021-05-06  9:44 UTC (permalink / raw)
  To: dev; +Cc: stable, Qiming Yang, Qi Zhang, Haiyue Wang

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.

Fixes: 3b3757bda3c3 ("net/ice: get VF hardware index in DCF")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/ice/ice_dcf_parent.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ice/ice_dcf_parent.c b/drivers/net/ice/ice_dcf_parent.c
index c8e433239b..1d7aa8bc87 100644
--- a/drivers/net/ice/ice_dcf_parent.c
+++ b/drivers/net/ice/ice_dcf_parent.c
@@ -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;
 
+	pthread_detach(pthread_self());
+
 	rte_delay_us(ICE_DCF_VSI_UPDATE_SERVICE_INTERVAL);
 
 	rte_spinlock_lock(&vsi_update_lock);
-- 
2.23.0


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

* Re: [dpdk-stable] [PATCH 2/2] net/ice: fix leak on thread termination
  2021-05-06  9:44 ` [dpdk-stable] [PATCH 2/2] net/ice: " David Marchand
@ 2021-05-06 10:31   ` Wang, Haiyue
  2021-05-07  8:13   ` David Marchand
  1 sibling, 0 replies; 9+ messages in thread
From: Wang, Haiyue @ 2021-05-06 10:31 UTC (permalink / raw)
  To: David Marchand, dev; +Cc: stable, Yang, Qiming, Zhang, Qi Z

> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Thursday, May 6, 2021 17:45
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Wang,
> Haiyue <haiyue.wang@intel.com>
> Subject: [PATCH 2/2] net/ice: fix leak on thread termination
> 
> 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.
> 
> Fixes: 3b3757bda3c3 ("net/ice: get VF hardware index in DCF")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  drivers/net/ice/ice_dcf_parent.c | 2 ++
>  1 file changed, 2 insertions(+)
> 

Got it, thanks!

Acked-by: Haiyue Wang <haiyue.wang@intel.com>

> --
> 2.23.0


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

* Re: [dpdk-stable] [PATCH 2/2] net/ice: fix leak on thread termination
  2021-05-06  9:44 ` [dpdk-stable] [PATCH 2/2] net/ice: " David Marchand
  2021-05-06 10:31   ` Wang, Haiyue
@ 2021-05-07  8:13   ` David Marchand
  2021-05-07 17:14     ` Dmitry Kozlyuk
  1 sibling, 1 reply; 9+ messages in thread
From: David Marchand @ 2021-05-07  8:13 UTC (permalink / raw)
  To: Dmitry Kozlyuk, Dmitry Malloy (MESHCHANINOV),
	Narcisa Ana Maria Vasile, Pallavi Kadam
  Cc: dev, dpdk stable, Qiming Yang, Qi Zhang, Haiyue Wang, Thomas Monjalon

On Thu, May 6, 2021 at 11:45 AM David Marchand
<david.marchand@redhat.com> wrote:
>
> 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.

Not so "easy" for Windows.

I think I'll simply #ifndef WINDOWS my addition.
Maybe the leak does not exist on Windows? but if it does, the
situation won't change by doing nothing on Windows.

If there is strong objection, I'll need some help to add a
pthread_detach() wrapper in windows EAL.
From my quick read at the API, I'd say I need to find the current
thread handle (via OpenThread) then CloseHandle it.
But does it work from "pthread_self()" ?


Since a new API thread is in preparation, the "thread detaching" from
the pthread API is something to consider.
I could not find it in Narcissa series.


-- 
David Marchand


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

* Re: [dpdk-stable] [PATCH 2/2] net/ice: fix leak on thread termination
  2021-05-07  8:13   ` David Marchand
@ 2021-05-07 17:14     ` Dmitry Kozlyuk
  0 siblings, 0 replies; 9+ messages in thread
From: Dmitry Kozlyuk @ 2021-05-07 17:14 UTC (permalink / raw)
  To: David Marchand
  Cc: Dmitry Malloy (MESHCHANINOV),
	Narcisa Ana Maria Vasile, Pallavi Kadam, dev, dpdk stable,
	Qiming Yang, Qi Zhang, Haiyue Wang, Thomas Monjalon

2021-05-07 10:13 (UTC+0200), David Marchand:
> On Thu, May 6, 2021 at 11:45 AM David Marchand
> <david.marchand@redhat.com> wrote:
> >
> > 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.  
> 
> Not so "easy" for Windows.
> 
> I think I'll simply #ifndef WINDOWS my addition.
> Maybe the leak does not exist on Windows? but if it does, the
> situation won't change by doing nothing on Windows.
>
> If there is strong objection, I'll need some help to add a
> pthread_detach() wrapper in windows EAL.
> From my quick read at the API, I'd say I need to find the current
> thread handle (via OpenThread) then CloseHandle it.
> But does it work from "pthread_self()" ?
> 
> 
> Since a new API thread is in preparation, the "thread detaching" from
> the pthread API is something to consider.
> I could not find it in Narcissa series.

There is no leak.
On Windows, pthread_t is just a number, not a handle.
pthread_detach can be implemented as a no-op and added to new API.
See also: https://devblogs.microsoft.com/oldnewthing/20100827-00/?p=13023

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

* [dpdk-stable] [PATCH v2 1/2] net/ark: fix leak on thread termination
       [not found] ` <20210511113358.2485-1-david.marchand@redhat.com>
@ 2021-05-11 11:33   ` David Marchand
  2021-05-11 11:33   ` [dpdk-stable] [PATCH v2 2/2] net/ice: " David Marchand
  1 sibling, 0 replies; 9+ messages in thread
From: David Marchand @ 2021-05-11 11:33 UTC (permalink / raw)
  To: dev
  Cc: timothy.mcdaniel, maxime.coquelin, chenbo.xia, stable,
	Shepard Siegel, Ed Czeck, John Miller

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

The "ark-delay-pg" thread is just used to delay some task but it is never
joined by the thread that created it.
The easiest solution is to detach the new thread.

Fixes: 727b3fe292bc ("net/ark: integrate PMD")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/ark/ark_pktgen.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c
index 28a44f7546..515bfe461c 100644
--- a/drivers/net/ark/ark_pktgen.c
+++ b/drivers/net/ark/ark_pktgen.c
@@ -3,6 +3,7 @@
  */
 
 #include <unistd.h>
+#include <pthread.h>
 
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
@@ -474,6 +475,7 @@ ark_pktgen_delay_start(void *arg)
 	 * perform a blind sleep here to ensure that the external test
 	 * application has time to setup the test before we generate packets
 	 */
+	pthread_detach(pthread_self());
 	usleep(100000);
 	ark_pktgen_run(inst);
 	return NULL;
-- 
2.23.0


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

* [dpdk-stable] [PATCH v2 2/2] net/ice: fix leak on thread termination
       [not found] ` <20210511113358.2485-1-david.marchand@redhat.com>
  2021-05-11 11:33   ` [dpdk-stable] [PATCH v2 1/2] net/ark: " David Marchand
@ 2021-05-11 11:33   ` David Marchand
  2021-05-11 17:34     ` Dmitry Kozlyuk
  1 sibling, 1 reply; 9+ messages in thread
From: David Marchand @ 2021-05-11 11:33 UTC (permalink / raw)
  To: dev
  Cc: timothy.mcdaniel, maxime.coquelin, chenbo.xia, stable,
	Haiyue Wang, Qiming Yang, Qi Zhang, Dmitry Kozlyuk,
	Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam

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")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
---
Changes since v1:
- fixed build for net/ice on Windows

---
 drivers/net/ice/ice_dcf_parent.c  | 2 ++
 lib/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 c8e433239b..1d7aa8bc87 100644
--- a/drivers/net/ice/ice_dcf_parent.c
+++ b/drivers/net/ice/ice_dcf_parent.c
@@ -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;
 
+	pthread_detach(pthread_self());
+
 	rte_delay_us(ICE_DCF_VSI_UPDATE_SERVICE_INTERVAL);
 
 	rte_spinlock_lock(&vsi_update_lock);
diff --git a/lib/eal/windows/include/pthread.h b/lib/eal/windows/include/pthread.h
index 1939b0121c..27fd2cca52 100644
--- a/lib/eal/windows/include/pthread.h
+++ b/lib/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.23.0


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

* Re: [dpdk-stable] [PATCH v2 2/2] net/ice: fix leak on thread termination
  2021-05-11 11:33   ` [dpdk-stable] [PATCH v2 2/2] net/ice: " David Marchand
@ 2021-05-11 17:34     ` Dmitry Kozlyuk
  0 siblings, 0 replies; 9+ messages in thread
From: Dmitry Kozlyuk @ 2021-05-11 17:34 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, timothy.mcdaniel, maxime.coquelin, chenbo.xia, stable,
	Haiyue Wang, Qiming Yang, Qi Zhang, Narcisa Ana Maria Vasile,
	Dmitry Malloy, Pallavi Kadam

2021-05-11 13:33 (UTC+0200), David Marchand:
> 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")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Haiyue Wang <haiyue.wang@intel.com>
> ---
> Changes since v1:
> - fixed build for net/ice on Windows
> 
> ---
>  drivers/net/ice/ice_dcf_parent.c  | 2 ++
>  lib/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 c8e433239b..1d7aa8bc87 100644
> --- a/drivers/net/ice/ice_dcf_parent.c
> +++ b/drivers/net/ice/ice_dcf_parent.c
> @@ -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;
>  
> +	pthread_detach(pthread_self());
> +
>  	rte_delay_us(ICE_DCF_VSI_UPDATE_SERVICE_INTERVAL);
>  
>  	rte_spinlock_lock(&vsi_update_lock);
> diff --git a/lib/eal/windows/include/pthread.h b/lib/eal/windows/include/pthread.h
> index 1939b0121c..27fd2cca52 100644
> --- a/lib/eal/windows/include/pthread.h
> +++ b/lib/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)

For Windows part,
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>

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

* Re: [dpdk-stable] [PATCH 1/2] net/ark: fix leak on thread termination
  2021-05-06  9:44 ` [dpdk-stable] [PATCH 1/2] net/ark: fix leak on thread termination David Marchand
@ 2021-05-11 17:55   ` Ed Czeck
  0 siblings, 0 replies; 9+ messages in thread
From: Ed Czeck @ 2021-05-11 17:55 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, stable, Shepard Siegel, John Miller

Thank you.

Acked-by: Ed Czeck <ed.czeck@atomicrules.com>


On Thu, May 6, 2021 at 5:45 AM David Marchand <david.marchand@redhat.com>
wrote:

> A terminated pthread should be joined or detached so that its associated
> resources are released.
>
> The "ark-delay-pg" thread is just used to delay some task but it is never
> joined by the thread that created it.
> The easiest solution is to detach the new thread.
>
> Fixes: 727b3fe292bc ("net/ark: integrate PMD")
> Cc: stable@dpdk.org
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  drivers/net/ark/ark_pktgen.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c
> index 28a44f7546..515bfe461c 100644
> --- a/drivers/net/ark/ark_pktgen.c
> +++ b/drivers/net/ark/ark_pktgen.c
> @@ -3,6 +3,7 @@
>   */
>
>  #include <unistd.h>
> +#include <pthread.h>
>
>  #include <rte_string_fns.h>
>  #include <rte_malloc.h>
> @@ -474,6 +475,7 @@ ark_pktgen_delay_start(void *arg)
>          * perform a blind sleep here to ensure that the external test
>          * application has time to setup the test before we generate
> packets
>          */
> +       pthread_detach(pthread_self());
>         usleep(100000);
>         ark_pktgen_run(inst);
>         return NULL;
> --
> 2.23.0
>
>

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

end of thread, other threads:[~2021-05-11 17:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210506094452.1689-1-david.marchand@redhat.com>
2021-05-06  9:44 ` [dpdk-stable] [PATCH 1/2] net/ark: fix leak on thread termination David Marchand
2021-05-11 17:55   ` Ed Czeck
2021-05-06  9:44 ` [dpdk-stable] [PATCH 2/2] net/ice: " David Marchand
2021-05-06 10:31   ` Wang, Haiyue
2021-05-07  8:13   ` David Marchand
2021-05-07 17:14     ` Dmitry Kozlyuk
     [not found] ` <20210511113358.2485-1-david.marchand@redhat.com>
2021-05-11 11:33   ` [dpdk-stable] [PATCH v2 1/2] net/ark: " David Marchand
2021-05-11 11:33   ` [dpdk-stable] [PATCH v2 2/2] net/ice: " David Marchand
2021-05-11 17:34     ` Dmitry Kozlyuk

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git