From patchwork Tue May 11 11:33:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 93155 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8EF03A0A0E; Tue, 11 May 2021 13:34:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7193140697; Tue, 11 May 2021 13:34:46 +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 5F385406A3 for ; Tue, 11 May 2021 13:34:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620732884; 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=dLtYXJQYPyZc7qYZs82SMZQ6n30l+HxPUIvIRoX8e8eVkAeqVUZckxn0/OaGQYChX+zAO6 ADHdyjZLJhjaMFL+MfMkaR7HxTwRRx8KZOznL3jVLwqke0DK42raEphMoekXW07Olvx3lf 6GMAmzSc9D3r6AzO4t7Hxe/MY3CKrsw= 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 Subject: [dpdk-dev] [PATCH v2 2/2] net/ice: fix leak on thread termination X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Acked-by: Dmitry Kozlyuk --- 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)