From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: timothy.mcdaniel@intel.com, maxime.coquelin@redhat.com,
chenbo.xia@intel.com, stable@dpdk.org,
Haiyue Wang <haiyue.wang@intel.com>,
Qiming Yang <qiming.yang@intel.com>,
Qi Zhang <qi.z.zhang@intel.com>,
Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,
Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>,
Dmitry Malloy <dmitrym@microsoft.com>,
Pallavi Kadam <pallavi.kadam@intel.com>
Subject: [dpdk-dev] [PATCH v2 2/2] net/ice: fix leak on thread termination
Date: Tue, 11 May 2021 13:33:58 +0200 [thread overview]
Message-ID: <20210511113358.2485-3-david.marchand@redhat.com> (raw)
In-Reply-To: <20210511113358.2485-1-david.marchand@redhat.com>
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
next prev parent reply other threads:[~2021-05-11 11:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-06 9:44 [dpdk-dev] [PATCH 0/2] Thread termination leak fixes David Marchand
2021-05-06 9:44 ` [dpdk-dev] [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-dev] [PATCH 2/2] net/ice: " David Marchand
2021-05-06 10:31 ` Wang, Haiyue
2021-05-07 8:13 ` [dpdk-dev] [dpdk-stable] " David Marchand
2021-05-07 17:14 ` Dmitry Kozlyuk
2021-05-11 11:33 ` [dpdk-dev] [PATCH v2 0/2] Thread termination leak fixes David Marchand
2021-05-11 11:33 ` [dpdk-dev] [PATCH v2 1/2] net/ark: fix leak on thread termination David Marchand
2021-05-11 11:33 ` David Marchand [this message]
2021-05-11 17:34 ` [dpdk-dev] [PATCH v2 2/2] net/ice: " Dmitry Kozlyuk
2021-05-11 21:41 ` [dpdk-dev] [PATCH v2 0/2] Thread termination leak fixes 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=20210511113358.2485-3-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=chenbo.xia@intel.com \
--cc=dev@dpdk.org \
--cc=dmitry.kozliuk@gmail.com \
--cc=dmitrym@microsoft.com \
--cc=haiyue.wang@intel.com \
--cc=maxime.coquelin@redhat.com \
--cc=navasile@linux.microsoft.com \
--cc=pallavi.kadam@intel.com \
--cc=qi.z.zhang@intel.com \
--cc=qiming.yang@intel.com \
--cc=stable@dpdk.org \
--cc=timothy.mcdaniel@intel.com \
/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).