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 2EB98A0A02
	for <public@inbox.dpdk.org>; Fri,  7 May 2021 19:14:51 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 1CFED410E0;
	Fri,  7 May 2021 19:14:51 +0200 (CEST)
Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com
 [209.85.167.46])
 by mails.dpdk.org (Postfix) with ESMTP id B802540040;
 Fri,  7 May 2021 19:14:48 +0200 (CEST)
Received: by mail-lf1-f46.google.com with SMTP id c11so13718055lfi.9;
 Fri, 07 May 2021 10:14:48 -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=qp3Qbed5902USWnv5ZKeFsiudTfs8KrY2Z8FGO+UmsA=;
 b=gownqLxSbjNdonKdx72vwFrWZ/jJs1AM47r8ddhwzTGLa1XTWR7+E7xssDYcrQLrnR
 Nz85dq2lTlXZU6KIHBfV6C9GQhVljPC8cYAQmoOxoC3rAeKIWo87st/UpYdIKWX2n3Er
 dr2OQxBnnUDhE+OUoys768xq3NWWLNK4vwnoKoRLZdqQuZcs1y/V3Zt5OSnm5dWB9iS5
 8NwTSIUcqhF8xwDMTq8Xm3gNUfAVNobY0l9MA1kujHK2/NpGJ6kkmW03FIcQfifax+Q3
 I+RkA6ZP6RoJQuF7QkD+8uLS77qVL4wJphH9/dJselz9oD+GdYqF/lqLNRIPO4yDrLee
 Rlvg==
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=qp3Qbed5902USWnv5ZKeFsiudTfs8KrY2Z8FGO+UmsA=;
 b=eMcCoAtlyYXb4HDQPEJ6a2lPUYwK9oXaDtc2xDoRbLBAeIcZe+IziZzPq3QP7fLi9h
 HtajiGLac+wpFWKqCBS8WU+la57WytNEMRZQkxzOhiZhHbRlLZ0mViQBhJa2Tw9DceWu
 JcdcRXFRdmixXdg+a8v5o+8Q5tPVK69RpChKhV8l9tLoq2kkHQ+VyLRA+FR6gTrOjRu+
 Z9dDRdiPs64KhEsI1e9Je9AJ93yZkHcCCQh3g/93DXw8NS1W+JVcEJk8Ypq/5tlY/XW8
 UkGbUNdZC0YhomasWJKmh86SG9tvr98Ofmfc3DOy0XBVRqj2ZgjgmuZfwEPCRf0S+Mf3
 FT6w==
X-Gm-Message-State: AOAM530uGywzUY0V1nQW6oKEWF39k8y58ROBkYcAJovWBuUB/Hj//ZVR
 zTMD07SUT73TJexYoLstSzc=
X-Google-Smtp-Source: ABdhPJzHWgLk36gRsnie/F4FLa64Sw5f3av9lTTYIYACuEj8ixxt3SwcNtLZtwhKRyuNhb3GgO7ydQ==
X-Received: by 2002:ac2:5f1b:: with SMTP id 27mr6964437lfq.425.1620407688313; 
 Fri, 07 May 2021 10:14:48 -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 s4sm1961171ljp.114.2021.05.07.10.14.47
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 07 May 2021 10:14:47 -0700 (PDT)
Date: Fri, 7 May 2021 20:14:46 +0300
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: David Marchand <david.marchand@redhat.com>
Cc: "Dmitry Malloy (MESHCHANINOV)" <dmitrym@microsoft.com>, Narcisa Ana
 Maria Vasile <navasile@linux.microsoft.com>, Pallavi Kadam
 <pallavi.kadam@intel.com>, dev <dev@dpdk.org>, dpdk stable
 <stable@dpdk.org>, Qiming Yang <qiming.yang@intel.com>, Qi Zhang
 <qi.z.zhang@intel.com>, Haiyue Wang <haiyue.wang@intel.com>, Thomas
 Monjalon <thomas@monjalon.net>
Message-ID: <20210507201446.2d61d59b@sovereign>
In-Reply-To: <CAJFAV8x9P5gN6rjDC8kgRW618qP2XKZhijn8oQZqvO_-=nFcVQ@mail.gmail.com>
References: <20210506094452.1689-1-david.marchand@redhat.com>
 <20210506094452.1689-3-david.marchand@redhat.com>
 <CAJFAV8x9P5gN6rjDC8kgRW618qP2XKZhijn8oQZqvO_-=nFcVQ@mail.gmail.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 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-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