patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 20.11] net/ark: fix leak on thread termination
@ 2021-06-15 12:22 David Marchand
  2021-06-16  1:07 ` Ed Czeck
  0 siblings, 1 reply; 3+ messages in thread
From: David Marchand @ 2021-06-15 12:22 UTC (permalink / raw)
  To: stable; +Cc: xuemingl, Shepard Siegel, Ed Czeck, John Miller

[ upstream commit b8b5dc6b9596a07cbeed03192b41a4befb75acc6 ]

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

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

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 0156eeb66e..c307880ec1 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2015-2018 Atomic Rules LLC
  */
 
+#include <pthread.h>
 #include <unistd.h>
 #include <sys/stat.h>
 #include <dlfcn.h>
@@ -585,6 +586,7 @@ delay_pg_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(ark->pg);
 	return NULL;
-- 
2.23.0


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

* Re: [dpdk-stable] [PATCH 20.11] net/ark: fix leak on thread termination
  2021-06-15 12:22 [dpdk-stable] [PATCH 20.11] net/ark: fix leak on thread termination David Marchand
@ 2021-06-16  1:07 ` Ed Czeck
  2021-06-16  2:57   ` Xueming(Steven) Li
  0 siblings, 1 reply; 3+ messages in thread
From: Ed Czeck @ 2021-06-16  1:07 UTC (permalink / raw)
  To: David Marchand; +Cc: stable, xuemingl, Shepard Siegel, John Miller

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

On Tue, Jun 15, 2021 at 8:22 AM David Marchand <david.marchand@redhat.com>
wrote:

> [ upstream commit b8b5dc6b9596a07cbeed03192b41a4befb75acc6 ]
>
> 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")
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  drivers/net/ark/ark_ethdev.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
> index 0156eeb66e..c307880ec1 100644
> --- a/drivers/net/ark/ark_ethdev.c
> +++ b/drivers/net/ark/ark_ethdev.c
> @@ -2,6 +2,7 @@
>   * Copyright (c) 2015-2018 Atomic Rules LLC
>   */
>
> +#include <pthread.h>
>  #include <unistd.h>
>  #include <sys/stat.h>
>  #include <dlfcn.h>
> @@ -585,6 +586,7 @@ delay_pg_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(ark->pg);
>         return NULL;
> --
> 2.23.0
>
>

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

* Re: [dpdk-stable] [PATCH 20.11] net/ark: fix leak on thread termination
  2021-06-16  1:07 ` Ed Czeck
@ 2021-06-16  2:57   ` Xueming(Steven) Li
  0 siblings, 0 replies; 3+ messages in thread
From: Xueming(Steven) Li @ 2021-06-16  2:57 UTC (permalink / raw)
  To: Ed Czeck, David Marchand; +Cc: stable, Shepard Siegel, John Miller

Thanks, merged.

From: Ed Czeck <ed.czeck@atomicrules.com>
Sent: Wednesday, June 16, 2021 9:08 AM
To: David Marchand <david.marchand@redhat.com>
Cc: stable@dpdk.org; Xueming(Steven) Li <xuemingl@nvidia.com>; Shepard Siegel <shepard.siegel@atomicrules.com>; John Miller <john.miller@atomicrules.com>
Subject: Re: [PATCH 20.11] net/ark: fix leak on thread termination

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

On Tue, Jun 15, 2021 at 8:22 AM David Marchand <david.marchand@redhat.com<mailto:david.marchand@redhat.com>> wrote:
[ upstream commit b8b5dc6b9596a07cbeed03192b41a4befb75acc6 ]

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

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

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 0156eeb66e..c307880ec1 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2015-2018 Atomic Rules LLC
  */

+#include <pthread.h>
 #include <unistd.h>
 #include <sys/stat.h>
 #include <dlfcn.h>
@@ -585,6 +586,7 @@ delay_pg_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(ark->pg);
        return NULL;
--
2.23.0

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

end of thread, other threads:[~2021-06-16  2:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15 12:22 [dpdk-stable] [PATCH 20.11] net/ark: fix leak on thread termination David Marchand
2021-06-16  1:07 ` Ed Czeck
2021-06-16  2:57   ` Xueming(Steven) Li

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