From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4ECCBA0A0E for ; Tue, 11 May 2021 13:34:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4872F4003E; Tue, 11 May 2021 13:34:44 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 91C5B4003E for ; Tue, 11 May 2021 13:34:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620732883; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BXg0CvfZCdOSIYtk3enskdO9dVmz3hs9bRglQwtMemo=; b=OITqF1zbF2a+Vz3yoGQQkAQsZ9atHMoRX1DvPM64XqsdrFdicUlP7mtKbHZj/JOBl3ZIBC LcAz62Fxro1r8fixeV1S4Y17+5KKPp6djyEXnZp62ANpLTiNMDC8npVPj7p9V1QNGxaTsQ +/uUpFj3vJEIf07groEQj6Ix54fjui4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-470-sITd-pv9PxKhg8p5zNBONA-1; Tue, 11 May 2021 07:34:41 -0400 X-MC-Unique: sITd-pv9PxKhg8p5zNBONA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EAA06107ACC7; Tue, 11 May 2021 11:34:39 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8F1F1725E; Tue, 11 May 2021 11:34:31 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: timothy.mcdaniel@intel.com, maxime.coquelin@redhat.com, chenbo.xia@intel.com, stable@dpdk.org, Haiyue Wang , Qiming Yang , Qi Zhang , Dmitry Kozlyuk , Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam Date: Tue, 11 May 2021 13:33:58 +0200 Message-Id: <20210511113358.2485-3-david.marchand@redhat.com> In-Reply-To: <20210511113358.2485-1-david.marchand@redhat.com> References: <20210506094452.1689-1-david.marchand@redhat.com> <20210511113358.2485-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" A terminated pthread should be joined or detached so that its associated resources are released. The "ice-reset-" 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 Acked-by: Haiyue Wang --- 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