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 E96A3A00BE; Wed, 29 Apr 2020 01:14:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 88AD01D64C; Wed, 29 Apr 2020 01:14:34 +0200 (CEST) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id 6E2E11D642 for ; Wed, 29 Apr 2020 01:14:30 +0200 (CEST) Received: by mail-pf1-f196.google.com with SMTP id v63so120671pfb.10 for ; Tue, 28 Apr 2020 16:14:30 -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=y+iD3491/av99ODcmeHrbgBQhy/hOi7pHlUfCzJKOI4=; b=XKzeYsxGcZCq+aBn6Uxck7wzLSEwBCbXyCbBA8zQR4nuo9k0S32zkjbIo+M7cKZftK Dk3S7iV97+ZwzbXSk6hiil2RU8nTGrxPmJXKCgF4exGoleKlP1d/3sk5y7CF/DtKLGiC z/A67MdroTkjWmIrXA2vCTEA868NkFrN+E2lDqOSNYf6nZSU6y00hpkWbgHk7Ow+Y2jW KwUToUtq1Ad2eL2HCraIBDa2Z9e+TS8WAVcW6whOnDBwOFcqw1Q7w5nLdgYcJN/Ya7DA +N8nF/v93dTa3Xnzazzqdi4DeZYCiyM9CmjcHK/hquNa/6OLb3Z/IK8x8q3x3hMcgEcY p9SA== 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=y+iD3491/av99ODcmeHrbgBQhy/hOi7pHlUfCzJKOI4=; b=CqhERNENMNXorzZxl3CMJ/QwRtGkziAp5puAbVm7MZhU5RWKz9v2MVM540BmV4y2Wl a6uluHMJ9lpyPys/fBHhcfGs0XS5JkmayRAxOx0o78goDSFBfbMvtt2vbtmaaHnrSkcg cUwtPrGZMyQxodoIgO+SAhTciApWhs+/4KYLuRl+3osHiG/fP4AYcYOmHAkbGAOT2GvU NR1LJVVtAlWK+IHGlK0xKYfORTAl/KdqF9Gsr3j+PEVJa/p3mYdJAGzsWteTtG7CmEbr XQIhx3FCTRQaYgvJOzUy57VBGKfCNNl4UFfh5ZehnctRFqUAEI4BRrBaUvUR0SsjjOet wGkg== X-Gm-Message-State: AGi0PuY0fX2+J5UfeXIqqbtXN4gtEjNTyUcBRxMRu5iX8zff2gE7tjo1 D2MD8L2kPxS//268H0W3XcL7CEQf5sVeAw== X-Google-Smtp-Source: APiQypKiHSEhym8L0QKfvgtUWERSpEBi2JJ4TtEDH3XnVnqXZwXrJzLQUXKbvZuvHQFVPW2CtgLzBw== X-Received: by 2002:aa7:9ab3:: with SMTP id x19mr31354648pfi.141.1588115668944; Tue, 28 Apr 2020 16:14:28 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id l64sm3230454pjb.44.2020.04.28.16.14.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2020 16:14:28 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , olivier.matz@6wind.com, Bruce Richardson Date: Tue, 28 Apr 2020 16:14:10 -0700 Message-Id: <20200428231415.17985-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428231415.17985-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> <20200428231415.17985-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 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..1602f5c65293 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