[dpdk-dev] [PATCH 03/14] eal: alarm: close timerfd on eal cleanup

David Marchand david.marchand at redhat.com
Sat Apr 25 18:32:39 CEST 2020


On Sat, Jan 4, 2020 at 2:34 AM Stephen Hemminger
<stephen at networkplumber.org> wrote:
>
> Calling rte_eal_cleanup() should cause DPDK to cleanup all
> outstanding resources including file descriptors.
>
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> ---
>  lib/librte_eal/common/eal_private.h  |  7 +++++++
>  lib/librte_eal/linux/eal/eal.c       |  1 +
>  lib/librte_eal/linux/eal/eal_alarm.c | 11 +++++++++++
>  3 files changed, 19 insertions(+)

I won't merge this as my FreeBSD vm is broken but I suppose the bits
for FreeBSD would be:

diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c
index 540b7d38c5..582ff0920a 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 c38b2e04f8..b2089d0b53 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)
 {


-- 
David Marchand



More information about the dev mailing list