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 BB8BAA04DD; Sat, 4 Jan 2020 02:34:20 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7A01E1D52A; Sat, 4 Jan 2020 02:33:57 +0100 (CET) Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by dpdk.org (Postfix) with ESMTP id 05C171D517 for ; Sat, 4 Jan 2020 02:33:54 +0100 (CET) Received: by mail-pj1-f68.google.com with SMTP id a6so5214834pjh.2 for ; Fri, 03 Jan 2020 17:33:53 -0800 (PST) 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=EP80VzQGIYIUwGQ04eiy90tGLwHtyt0B/Qq0yuZ5rd8=; b=P913u1JLQZgE5IJJJGBF4E5+JiMKTeCcWjQrOLw1zFvk+5Nt25laESt1r/8nAwp8/N k+YazdWfokzxdj8KHiQq5riDiurVxPtRR+ImwdPmTUv4WATdBHHa2EaPMxNYUMROLtLx ohxLx0igMAT5WQ/cB2I5DCYeHgshBxr0HwwaDL4uXecXL6kFVx9lM05+lFwZ+bcYxS7F dQsf/ZN5QyvfOt7PWVC7KPMB9+/ymVlkn96fTmnq8FFKsy4Y2faFGFHOQYPVIN2Xu6UZ aY/oaX475KTCW3Bpp3U842hrJrSw9yXGAWxxDKy6ZcDEISt3SLrWsHkncDoNdQC6M+os NwIg== 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=EP80VzQGIYIUwGQ04eiy90tGLwHtyt0B/Qq0yuZ5rd8=; b=Hv8yb30kUfSRo9oVnu+nThPUemlS094iCVD2RkZepL7WjqFhBfrtgEIHUfVjbiMdr9 dRSBC/8TyaK0msgOZJkBgb+QxKuuM1f/LY6jGBrC5WmM/Lj24VuehiVsv8IIkx7d6mr2 dG8UUbIaZEyjboh0L8reDST9DneYONZlInt5cVn7BOWxXrYQVTH3sUpH0e6bqgCeJUNa 9S5UUObyP1Hm/MHz2V86OwEZeqzsQV8pM89jm6nMrXxf+PlP3Yl5/Q0CZao2HcIo6Yax gCvi/6TX9A5FE+GMHlChWfU2v57K4rflPaQjv75GcwEh/+xQPn2qKj+CQb9qsYvF8Kk+ AvRg== X-Gm-Message-State: APjAAAVdx9YzYvq7LgsDqMdrtEaanCpztrrmhKiPOwl2uSJg/KdFGA2O dh2xKYuUwIywyd8SlrEdBIgv45aoaRw= X-Google-Smtp-Source: APXvYqxNIBLRXyQXlVi5AxrMbai+uWmRAeVhhrEF/w8d4AA7CuEwZSurJnoLr8qNvroo1d6xfGcw5g== X-Received: by 2002:a17:90a:3a86:: with SMTP id b6mr30012224pjc.96.1578101632859; Fri, 03 Jan 2020 17:33:52 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j6sm16212934pjv.10.2020.01.03.17.33.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 17:33:52 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Fri, 3 Jan 2020 17:33:30 -0800 Message-Id: <20200104013341.19809-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200104013341.19809-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 03/14] eal: alarm: close timerfd on eal 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" Calling rte_eal_cleanup() should cause DPDK to cleanup all outstanding resources including file descriptors. Signed-off-by: Stephen Hemminger --- 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(+) diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index fdd942d71a36..38682e79827c 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -202,6 +202,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/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c index a3381fd01a23..a1b928820b11 100644 --- a/lib/librte_eal/linux/eal/eal.c +++ b/lib/librte_eal/linux/eal/eal.c @@ -1325,6 +1325,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(); eal_cleanup_config(&internal_config); rte_eal_log_cleanup(); diff --git a/lib/librte_eal/linux/eal/eal_alarm.c b/lib/librte_eal/linux/eal/eal_alarm.c index 0924c9205c84..e6aeee933ece 100644 --- a/lib/librte_eal/linux/eal/eal_alarm.c +++ b/lib/librte_eal/linux/eal/eal_alarm.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -72,6 +73,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