From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 3367FA0C41
	for <public@inbox.dpdk.org>; Tue, 11 May 2021 19:34:18 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 2162A410F4;
	Tue, 11 May 2021 19:34:18 +0200 (CEST)
Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com
 [209.85.208.178])
 by mails.dpdk.org (Postfix) with ESMTP id 76A0C4003E;
 Tue, 11 May 2021 19:34:16 +0200 (CEST)
Received: by mail-lj1-f178.google.com with SMTP id 131so729343ljj.3;
 Tue, 11 May 2021 10:34:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=date:from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=UIBETTE26IUnLL0N2AR9OfH5sCvzxDvHWmrG+UgJ62w=;
 b=ChfzuHSXqaIBJVgNstdvYYWjwIJ6mhBUXsnT7sgafyrxKtzCH56LDQrkssiTK6TYPO
 3g6vSpvosHRkiTFZGi+2p/kk9q8nUCQ9ILyI4g1LT5Vb1eJLJMU40b3lXx4uGramiFhv
 YK/F0BsrOQ7MDmNf4dTDwghG6PEj8Vo9egR1KX3T6jD/VgUvMhIX7HGgUUSaRKyW+YqH
 wgl4dle+z7DIzwT5RO78CO9mJkQGehRFuU0eKZHMOkZ0bxHmCinsXAaCK8AY7jso9JTN
 V+U5z/50vbMnxA3qtltmmeHxiyF83fPRuJQUzrhmcrSCt91i1QkWG5O5/ALZfyZMGVCI
 lysA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=UIBETTE26IUnLL0N2AR9OfH5sCvzxDvHWmrG+UgJ62w=;
 b=SW4LISo82tMZWRF+HUYuIrw2DfxO+LfSzWMlcJvi3gTCYB5SErdYZwsLpFqHW07yRL
 VodP0/C8yEbyrmqZyDVeEPpmYIVfj/ONKqC79uIr6RLsE5UAxJcn34/2Kc2k7DlwJs4W
 4ntB7tLNw9vzFhuCwk5PHkgx5CofvtqkBtCQX+gETG8RQGarq14fJ1XW/8hkqvvfGDa7
 3cLck2OeBhKh0KvH74XjWXYTELgtJc0z29cD8hZsGjhCiD6AlypFyBL5eMwAZDbiSJVg
 000pi777HCO6v5rPh9HX2anBZfFjQz5zjEwV+bsf8W/3IZxyzg5rOJAfnjVhxAx41Gcg
 WhhQ==
X-Gm-Message-State: AOAM5332v+36JBDqVDQ3ctC1+PV1LLCjYVNZYUnnIMzHMH//PxnPLvHa
 lgIdoX+HKN9cArtC58p1H8o=
X-Google-Smtp-Source: ABdhPJw/nCXluJcG/Dk61xAweiuVRHJqIbglysfY0sAWXyQ0GrPhbtY6lXXu3VBFI0rpB1C5EqlZHw==
X-Received: by 2002:a2e:9e4b:: with SMTP id g11mr25486559ljk.1.1620754456040; 
 Tue, 11 May 2021 10:34:16 -0700 (PDT)
Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru.
 [37.110.65.23])
 by smtp.gmail.com with ESMTPSA id t30sm3776566ljd.98.2021.05.11.10.34.15
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 11 May 2021 10:34:15 -0700 (PDT)
Date: Tue, 11 May 2021 20:34:14 +0300
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: David Marchand <david.marchand@redhat.com>
Cc: dev@dpdk.org, 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>,
 Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>, Dmitry Malloy
 <dmitrym@microsoft.com>, Pallavi Kadam <pallavi.kadam@intel.com>
Message-ID: <20210511203414.5eec3223@sovereign>
In-Reply-To: <20210511113358.2485-3-david.marchand@redhat.com>
References: <20210506094452.1689-1-david.marchand@redhat.com>
 <20210511113358.2485-1-david.marchand@redhat.com>
 <20210511113358.2485-3-david.marchand@redhat.com>
X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-stable] [PATCH v2 2/2] net/ice: fix leak on thread
 termination
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

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>