From patchwork Tue May 11 11:33:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 93154 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 EE9E1A0A0E; Tue, 11 May 2021 13:34:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D23CC410ED; Tue, 11 May 2021 13:34:29 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 6C9954003E for ; Tue, 11 May 2021 13:34:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620732867; 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=9d1v5jY+OAab8uvYoT5RTBR28NWuxq2kq6P6VuiP5/A=; b=g2SwuFekmHlKJHM9h8cgUJp+q2UEs3x9Ft3ukENPx1DqMK/AzhmmT0qbthIy5y72U9UeML OdgnOTXCtC0oBHUebI3rffFyYYJPgEZeVWhJRpHPV+K74VqcbS1g1tP6aNU8HzU2WcKC3I TwDBNXqk0POP4qsr0/DZeE10yMsEgK0= 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-395-6E-9OyC8NuuNkhW1stmqvA-1; Tue, 11 May 2021 07:34:24 -0400 X-MC-Unique: 6E-9OyC8NuuNkhW1stmqvA-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 24C7BDF8A4; Tue, 11 May 2021 11:34:23 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 488751725E; Tue, 11 May 2021 11:34:19 +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, Shepard Siegel , Ed Czeck , John Miller Date: Tue, 11 May 2021 13:33:57 +0200 Message-Id: <20210511113358.2485-2-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 1/2] net/ark: 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 "ark-delay-pg" thread is just used to delay some task but it is never joined by the thread that created it. The easiest solution is to detach the new thread. Fixes: 727b3fe292bc ("net/ark: integrate PMD") Cc: stable@dpdk.org Signed-off-by: David Marchand --- drivers/net/ark/ark_pktgen.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c index 28a44f7546..515bfe461c 100644 --- a/drivers/net/ark/ark_pktgen.c +++ b/drivers/net/ark/ark_pktgen.c @@ -3,6 +3,7 @@ */ #include +#include #include #include @@ -474,6 +475,7 @@ ark_pktgen_delay_start(void *arg) * perform a blind sleep here to ensure that the external test * application has time to setup the test before we generate packets */ + pthread_detach(pthread_self()); usleep(100000); ark_pktgen_run(inst); return NULL; 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)