From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C87BDA00BE; Wed, 29 Apr 2020 01:59:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3C3B61D67B; Wed, 29 Apr 2020 01:58:46 +0200 (CEST) Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by dpdk.org (Postfix) with ESMTP id 6B5CB1D668 for ; Wed, 29 Apr 2020 01:58:41 +0200 (CEST) Received: by mail-pj1-f68.google.com with SMTP id y6so9460pjc.4 for ; Tue, 28 Apr 2020 16:58:41 -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=QNVAZzCTafZKF3vqSmP69/mwraWuPAw1sEN26Z4Qr3E=; b=zAAjXMVCxWuD75es/v2wd1Z16cqPRId0TEXjE8jsN/VhPE5b0W52mYKM2KQzx8ZTa8 +5FvgDSWuWk8ETHpVlCdP1LJRg86p7RuIaluQaTJM7uxWY+tHk5TKDX2udx4/v7nehVK Ff9rFd3Su2I/MISWoytdHeHHgvk7CDsPUCz1znlJ9DAwBhGgN0DlHA+wn434+/P/TeMM dgxIGIsaUld+Bqn9JE/6jEQmNqjd6jhrtN24qsECLsYqCgR4kW0wnbe+WF8OQnQJvRYA W2QpZUkKHcEX/gHTve7bl3LrE/3Cdf73lIEyOAZSLh8MFot4aTeSjHiiaJ2A+vkjnQah eFgw== 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=QNVAZzCTafZKF3vqSmP69/mwraWuPAw1sEN26Z4Qr3E=; b=XWxeehP+XlVeVSvTQ+H1Eph0soiePRo4B0RmQiXuqFO6dJBhcV2Pin0K0fJfPpQ0wr eR5bBy0ebxDgVMJZsPbaHJpYP1M9jXmjw9PXnnlHN6suz2U56Y3ZhmN5GaR7kVxf7tcf 7dQtmPuGJdOoU+cAeS4cK5VjbYYmUutGDDZLO8m4a6e2C27nI4WfccehHYEFztRZsdwz yCU22cRjB91R3YeUEQdAVDPFsi0d6kDecfJxpm36POytAZKzBaK1K1fcxunBNsFrPP3u KH7gqNweJeLvjS/LpzcYOIGD89cIjhUkdmzibIRBOG/riQW5I+dE1HrhStG+aXiM7Rv3 toSw== X-Gm-Message-State: AGi0PubyJLcK0xbNVTyRIXR/0KIcuYgRujJdcHvaNEXuywZGV/rm29eE WhoymcE94pl5F8NNDawu6zDfluBiOjSmLQ== X-Google-Smtp-Source: APiQypK/BSFwbkvQEPNb0aF0oZYPuis4DNDXkGrk72XQA6LJD+wWadTGsP4AsuFOVXzZe0JdyC9eMw== X-Received: by 2002:a17:90a:9f92:: with SMTP id o18mr27850pjp.180.1588118320157; Tue, 28 Apr 2020 16:58:40 -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.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2020 16:58:39 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , olivier.matz@6wind.com, Bruce Richardson Date: Tue, 28 Apr 2020 16:58:22 -0700 Message-Id: <20200428235827.15383-4-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 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 3/8] eal: alarm: close file on cleanup 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, free all the memory associated with dynamic log levels and types. Fixes: c1b5fa94a46f ("eal: support dynamic log types") Cc: olivier.matz@6wind.com Signed-off-by: Stephen Hemminger --- lib/librte_eal/common/eal_private.h | 7 +++++++ lib/librte_eal/freebsd/eal.c | 1 + lib/librte_eal/freebsd/eal_alarm.c | 10 ++++++++++ lib/librte_eal/linux/eal.c | 1 + lib/librte_eal/linux/eal_alarm.c | 11 +++++++++++ 5 files changed, 30 insertions(+) diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index 24ddfc6c53f4..71539dae412f 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -201,6 +201,13 @@ int rte_eal_intr_init(void); */ int rte_eal_alarm_init(void); +/** + * Cleanup alarm resources. + * + * This function is private to EAL. + */ +void rte_eal_alarm_cleanup(void); + /** * Function is to check if the kernel module(like, vfio, vfio_iommu_type1, * etc.) loaded. diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c index 540b7d38c5b7..582ff0920af4 100644 --- a/lib/librte_eal/freebsd/eal.c +++ b/lib/librte_eal/freebsd/eal.c @@ -973,6 +973,7 @@ int rte_eal_cleanup(void) { rte_service_finalize(); + rte_eal_alarm_cleanup(); rte_mp_channel_cleanup(); rte_trace_save(); eal_trace_fini(); diff --git a/lib/librte_eal/freebsd/eal_alarm.c b/lib/librte_eal/freebsd/eal_alarm.c index c38b2e04f811..b2089d0b53df 100644 --- a/lib/librte_eal/freebsd/eal_alarm.c +++ b/lib/librte_eal/freebsd/eal_alarm.c @@ -61,6 +61,16 @@ rte_eal_alarm_init(void) return 0; } +void +rte_eal_alarm_cleanup(void) +{ + if (intr_handle.fd == -1) + return; + + close(intr_handle.fd); + intr_handle.fd = -1; +} + static inline int timespec_cmp(const struct timespec *now, const struct timespec *at) { diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c index 73d2c98b012b..7458592f4950 100644 --- a/lib/librte_eal/linux/eal.c +++ b/lib/librte_eal/linux/eal.c @@ -1333,6 +1333,7 @@ rte_eal_cleanup(void) if (rte_eal_process_type() == RTE_PROC_PRIMARY) rte_memseg_walk(mark_freeable, NULL); rte_service_finalize(); + rte_eal_alarm_cleanup(); rte_mp_channel_cleanup(); rte_trace_save(); eal_trace_fini(); diff --git a/lib/librte_eal/linux/eal_alarm.c b/lib/librte_eal/linux/eal_alarm.c index 3252c6fa5909..f839626dad7d 100644 --- a/lib/librte_eal/linux/eal_alarm.c +++ b/lib/librte_eal/linux/eal_alarm.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -74,6 +75,16 @@ rte_eal_alarm_init(void) return -1; } +void +rte_eal_alarm_cleanup(void) +{ + if (intr_handle.fd == -1) + return; + + close(intr_handle.fd); + intr_handle.fd = -1; +} + static void eal_alarm_callback(void *arg __rte_unused) { -- 2.20.1