DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	olivier.matz@6wind.com,
	Bruce Richardson <bruce.richardson@intel.com>
Subject: [dpdk-dev] [PATCH v2 3/8] eal: alarm: close file on cleanup
Date: Tue, 28 Apr 2020 16:14:10 -0700
Message-ID: <20200428231415.17985-4-stephen@networkplumber.org> (raw)
In-Reply-To: <20200428231415.17985-1-stephen@networkplumber.org>

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 <stephen@networkplumber.org>
---
 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 <signal.h>
 #include <errno.h>
 #include <string.h>
+#include <unistd.h>
 #include <sys/queue.h>
 #include <sys/time.h>
 #include <sys/timerfd.h>
@@ -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


  parent reply	other threads:[~2020-04-28 23:14 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-04  1:33 [dpdk-dev] [PATCH 00/14] cleanup resources on shutdown Stephen Hemminger
2020-01-04  1:33 ` [dpdk-dev] [PATCH 01/14] eal: log: close on cleanup Stephen Hemminger
2020-01-04  1:33 ` [dpdk-dev] [PATCH 02/14] eal: log: free dynamic state " Stephen Hemminger
2020-04-25 16:26   ` David Marchand
2020-01-04  1:33 ` [dpdk-dev] [PATCH 03/14] eal: alarm: close timerfd on eal cleanup Stephen Hemminger
2020-04-25 16:32   ` David Marchand
2020-01-04  1:33 ` [dpdk-dev] [PATCH 04/14] eal: cleanup threads Stephen Hemminger
2020-02-04 14:48   ` Aaron Conole
2020-01-04  1:33 ` [dpdk-dev] [PATCH 05/14] eal: intr: cleanup resources Stephen Hemminger
2020-04-25 16:49   ` David Marchand
2020-04-26 16:24     ` Stephen Hemminger
2020-01-04  1:33 ` [dpdk-dev] [PATCH 06/14] eal: mp: end the multiprocess thread during cleanup Stephen Hemminger
2020-04-27 15:37   ` Burakov, Anatoly
2020-01-04  1:33 ` [dpdk-dev] [PATCH 07/14] eal: interrupts close epoll fd on shutdown Stephen Hemminger
2020-01-04  1:33 ` [dpdk-dev] [PATCH 08/14] eal: vfio: cleanup the mp sync handle Stephen Hemminger
2020-04-27 12:12   ` Burakov, Anatoly
2020-01-04  1:33 ` [dpdk-dev] [PATCH 09/14] eal: close mem config on cleanup Stephen Hemminger
2020-04-27 12:12   ` Burakov, Anatoly
2020-04-27 17:00     ` Stephen Hemminger
2020-04-28  9:20       ` Burakov, Anatoly
2020-01-04  1:33 ` [dpdk-dev] [PATCH 10/14] tap: close netlink socket on device close Stephen Hemminger
2020-04-25 15:52   ` David Marchand
2020-01-04  1:33 ` [dpdk-dev] [PATCH 11/14] eal: cleanup plugins data Stephen Hemminger
2020-01-04  1:33 ` [dpdk-dev] [PATCH 12/14] ethdev: raise priority of old driver warning Stephen Hemminger
2020-04-25 15:53   ` Thomas Monjalon
2020-01-04  1:33 ` [dpdk-dev] [PATCH 13/14] eal: hotplug: cleanup multiprocess resources Stephen Hemminger
2020-01-04  1:33 ` [dpdk-dev] [PATCH 14/14] eal: malloc: cleanup mp resources Stephen Hemminger
2020-04-27 12:10   ` Burakov, Anatoly
2020-02-05  9:32 ` [dpdk-dev] [PATCH 00/14] cleanup resources on shutdown David Marchand
2020-02-05 12:07   ` Stephen Hemminger
2020-02-05 12:32     ` David Marchand
2020-02-06 14:06 ` David Marchand
2020-02-07 18:24   ` Stephen Hemminger
2020-04-25 19:34 ` David Marchand
2020-04-28 23:14 ` [dpdk-dev] [PATCH v2 0/9] eal: " Stephen Hemminger
2020-04-28 23:14   ` [dpdk-dev] [PATCH v2 1/8] eal: log: close on cleanup Stephen Hemminger
2020-04-28 23:14   ` [dpdk-dev] [PATCH v2 2/8] eal: log: free dynamic state " Stephen Hemminger
2020-04-28 23:14   ` Stephen Hemminger [this message]
2020-04-28 23:14   ` [dpdk-dev] [PATCH v2 4/8] eal: cleanup threads Stephen Hemminger
2020-04-28 23:14   ` [dpdk-dev] [PATCH v2 5/8] eal: mp: end the multiprocess thread during cleanup Stephen Hemminger
2020-04-28 23:14   ` [dpdk-dev] [PATCH v2 6/8] eal: vfio: cleanup the mp sync handle Stephen Hemminger
2020-04-28 23:14   ` [dpdk-dev] [PATCH v2 7/8] eal: hotplug: cleanup multiprocess resources Stephen Hemminger
2020-04-28 23:14   ` [dpdk-dev] [PATCH v2 8/8] eal: malloc: cleanup mp resources Stephen Hemminger
2020-04-28 23:58 ` [dpdk-dev] [PATCH v3 0/8] eal: cleanup resources on shutdown Stephen Hemminger
2020-04-28 23:58   ` [dpdk-dev] [PATCH v3 1/8] eal: log: close on cleanup Stephen Hemminger
2020-04-28 23:58   ` [dpdk-dev] [PATCH v3 2/8] eal: log: free dynamic state " Stephen Hemminger
2020-04-28 23:58   ` [dpdk-dev] [PATCH v3 3/8] eal: alarm: close file " Stephen Hemminger
2020-04-28 23:58   ` [dpdk-dev] [PATCH v3 4/8] eal: cleanup threads Stephen Hemminger
2020-04-28 23:58   ` [dpdk-dev] [PATCH v3 5/8] eal: mp: end the multiprocess thread during cleanup Stephen Hemminger
2020-04-28 23:58   ` [dpdk-dev] [PATCH v3 6/8] eal: vfio: cleanup the mp sync handle Stephen Hemminger
2020-04-28 23:58   ` [dpdk-dev] [PATCH v3 7/8] eal: hotplug: cleanup multiprocess resources Stephen Hemminger
2020-04-28 23:58   ` [dpdk-dev] [PATCH v3 8/8] eal: malloc: cleanup mp resources Stephen Hemminger
2020-05-03 17:21   ` [dpdk-dev] [PATCH v3 0/8] eal: cleanup resources on shutdown David Marchand
2020-10-19 22:24     ` Thomas Monjalon
2021-03-24 21:30       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200428231415.17985-4-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git