From patchwork Tue Apr 28 23:58:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 69491 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C2020A00BE; Wed, 29 Apr 2020 01:59:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AF5EA1D681; Wed, 29 Apr 2020 01:58:47 +0200 (CEST) Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by dpdk.org (Postfix) with ESMTP id 4438A1D676 for ; Wed, 29 Apr 2020 01:58:43 +0200 (CEST) Received: by mail-pj1-f65.google.com with SMTP id y6so9489pjc.4 for ; Tue, 28 Apr 2020 16:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=p+GwdMm2UwxS1a1z5F+0+KYPi/v4lFrzxgvROMBkFKE=; b=oz1g4rRgKGYqMbPhzFPxZEmN4N+q/oENCJsmGdkjLZMpBN+QREKW2gFbJbm5qV1/nr JiY1jc/HTNxhsUkF/t2iwfW/s/5nQTFQ/jEB4cBXeeCHQUHewJBWaF6j0CilFqSuRQga PZNXrc3WCIybm3l8JyJba93wJb7IRlPTdOKEcjvCqkixPwt3G1tEHdEr7VLXCoODatfp LyLfByv3v8dvS/U/ajpxINJRwIVjb7XOQOoXOmxdzioXpfGWgNFkGhNatM5yzOEa3uPn 7GmWMHkCnq5thItcwNXsUbdoZ0y6pZMUPbmVl2wuO4CPocr/s+Z8fWgEk+b+/MhscVqa fiog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p+GwdMm2UwxS1a1z5F+0+KYPi/v4lFrzxgvROMBkFKE=; b=HVvckt1rZi/Yr4xxivc6t2txsXvxHPVbYNpbRdqeBDhZ8Ehg+l4aeMBFpvI8G4O+Ex frCk5w8caBQdL9PBuczUNme4jgzor5vGPI3juOJJ0n/xuqwFwTCnQOAy0sYKlAlgXrs0 Kov7vDWinWlbRE1kH516L48Uzks57i157hifTkg1OgICykyo2GqR7krRXd6g4f4Az6+2 8b8mNtXAoT43SARmLdevY5TAukvQz8rukoLXC+tBKQLAuC/y/y+df6sCrg9KvrYUUZVG hwzCubguyu7HTOvuq7PBOIaC5oBL3LuXvrHpvy66qe/J6BunZHWNFj/SxBM6yTobsGzc HCAg== X-Gm-Message-State: AGi0PuY0n816RB6vCH7TozuHbJNGq4CbTbkbHX228Wl8iJge0zPNa7nI /qTKw34+mFT+i9jhN0Ut4dD2kTQ08NP3dQ== X-Google-Smtp-Source: APiQypJPLvbxdc9HyXZIuMS0NwpQUotlg6y4GyuTE3vQ5Afb5KIUtstEzGfGTauMcqGVpTSre3z6Gg== X-Received: by 2002:a17:90a:bc4a:: with SMTP id t10mr45269pjv.104.1588118321928; Tue, 28 Apr 2020 16:58:41 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id h193sm16209471pfe.30.2020.04.28.16.58.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2020 16:58:41 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Aaron Conole Date: Tue, 28 Apr 2020 16:58:23 -0700 Message-Id: <20200428235827.15383-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428235827.15383-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> <20200428235827.15383-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 4/8] eal: cleanup threads X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" When rte_eal_cleanup is called it should stop all the child threads and close the pipes between threads. Signed-off-by: Stephen Hemminger Acked-by: Aaron Conole --- lib/librte_eal/linux/eal.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c index 7458592f4950..27b768b15c4a 100644 --- a/lib/librte_eal/linux/eal.c +++ b/lib/librte_eal/linux/eal.c @@ -1327,11 +1327,24 @@ mark_freeable(const struct rte_memseg_list *msl, const struct rte_memseg *ms, int rte_eal_cleanup(void) { + int i; + /* if we're in a primary process, we need to mark hugepages as freeable * so that finalization can release them back to the system. */ if (rte_eal_process_type() == RTE_PROC_PRIMARY) rte_memseg_walk(mark_freeable, NULL); + + RTE_LCORE_FOREACH_SLAVE(i) { + pthread_cancel(lcore_config[i].thread_id); + pthread_join(lcore_config[i].thread_id, NULL); + + close(lcore_config[i].pipe_master2slave[0]); + close(lcore_config[i].pipe_master2slave[1]); + close(lcore_config[i].pipe_slave2master[0]); + close(lcore_config[i].pipe_slave2master[1]); + } + rte_service_finalize(); rte_eal_alarm_cleanup(); rte_mp_channel_cleanup();