From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A2A014308A; Thu, 17 Aug 2023 06:28:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E4AA742D12; Thu, 17 Aug 2023 06:28:26 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mails.dpdk.org (Postfix) with ESMTP id 6002E40685 for ; Thu, 17 Aug 2023 06:28:25 +0200 (CEST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D8A0E62E32; Thu, 17 Aug 2023 04:28:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED767C433CA; Thu, 17 Aug 2023 04:28:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692246504; bh=MeqaHLsgyOCmbkOFKp4YG/K/QFKBLqNQoH675GL+3s0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jVC/pe1InXeQlL5/Ik6yQdbBdqB5rH6OlGgJmTUrMwYCea2hDilNsJNzUNmbQH26L Nl1E+PTn3txATQ4EJMEGIM7s9d7lYokRC/xr5Od77R/VFwUHMRBFW4ooDVBo020Rd+ dgxhnX8cKa3mwZx2rispVWUVdJl/MWIQiySXtOaiZepapY+k6EmVNa5c/L+K1Se1CS DVsMNAtCQ0FvsHxHuv1mqI3I2zzNYM6zCukhMSlB0pERfMl8EzFSC760fo7NCaL2qO ox4XKA5comZMh6FlJfgbLSu/KOjePu/u8YWSLSMWD+j7HS3x5RoQTXRVu6CIESR8aT Ni4KnQLgoHFIQ== From: okaya@kernel.org To: Cc: dev@dpdk.org, Stephen Hemminger , Sinan Kaya Subject: [PATCH v5 01/10] eal: cleanup plugins data Date: Thu, 17 Aug 2023 00:28:12 -0400 Message-Id: <20230817042820.137957-2-okaya@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230817042820.137957-1-okaya@kernel.org> References: <20230817042820.137957-1-okaya@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Stephen Hemminger When rte_eal_cleanup is called walk through the list of shared objects loaded, and close them and free the data structure. Signed-off-by: Stephen Hemminger Signed-off-by: Sinan Kaya --- lib/eal/common/eal_common_options.c | 14 ++++++++++++++ lib/eal/common/eal_options.h | 1 + lib/eal/linux/eal.c | 2 ++ 3 files changed, 17 insertions(+) diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c index 062f1d8d9c..a509adc78b 100644 --- a/lib/eal/common/eal_common_options.c +++ b/lib/eal/common/eal_common_options.c @@ -244,6 +244,20 @@ eal_save_args(int argc, char **argv) } #endif +void +eal_plugins_cleanup(void) +{ +#ifndef RTE_EXEC_ENV_WINDOWS + struct shared_driver *solib, *tmp; + + RTE_TAILQ_FOREACH_SAFE(solib, &solib_list, next, tmp) { + if (solib->lib_handle) + dlclose(solib->lib_handle); + free(solib); + } +#endif +} + static int eal_option_device_add(enum rte_devtype type, const char *optarg) { diff --git a/lib/eal/common/eal_options.h b/lib/eal/common/eal_options.h index 3cc9cb6412..ddbaafc4f1 100644 --- a/lib/eal/common/eal_options.h +++ b/lib/eal/common/eal_options.h @@ -105,6 +105,7 @@ int eal_check_common_options(struct internal_config *internal_cfg); void eal_common_usage(void); enum rte_proc_type_t eal_proc_type_detect(void); int eal_plugins_init(void); +void eal_plugins_cleanup(void); int eal_save_args(int argc, char **argv); int handle_eal_info_request(const char *cmd, const char *params __rte_unused, struct rte_tel_data *d); diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index c6efd92014..dee649bab3 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -1398,6 +1398,8 @@ rte_eal_cleanup(void) eal_trace_fini(); eal_mp_dev_hotplug_cleanup(); rte_eal_alarm_cleanup(); + eal_plugins_cleanup(); + /* after this point, any DPDK pointers will become dangling */ rte_eal_memory_detach(); rte_eal_malloc_heap_cleanup(); -- 2.25.1