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 3730443073; Tue, 15 Aug 2023 16:50:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C8AC643251; Tue, 15 Aug 2023 16:50:34 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mails.dpdk.org (Postfix) with ESMTP id BBED641611 for ; Tue, 15 Aug 2023 16:50:32 +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 3B69561CC0; Tue, 15 Aug 2023 14:50:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1FE5C433C8; Tue, 15 Aug 2023 14:50:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692111031; bh=n8tuOsyAXkyfrtIi2nseJZqsKbt9XPCd1HswxhX/EvY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=knMiFk1XXNu/fPY+FAqgz8x1duG95Csyv3vqMO8kfRgSbvzRMM+kXfX4qhG00l9iY iChO8Ql5F61WXsiq8O5/HFIjdhb2xnKKOlpcdCa70FVYkz0G6hfxPgNh12he2rEzbm 6FLQoUTd7+STrzd8+VLWLIH3TeZe/9mvziS+F+7kPj8zXmXrl/pA5BhWFz+MNUGQ8C bZpF9LPvsF0Mgdx+eE/WQqxR61Xrpsn1dUYTUGaJZ44SYBPErQhdotaIfM9X4oeCXl M5Un6p/9CYn/Iv5V53Jf+IEM30lCdhZGxkNGZO4G4Tz4Pqx3K2rn0ujt8QgtEgnaJ2 egjF6cnzL1kDg== From: okaya@kernel.org To: Cc: dev@dpdk.org, Stephen Hemminger , Sinan Kaya Subject: [PATCH v4 1/8] eal: cleanup plugins data Date: Tue, 15 Aug 2023 10:50:16 -0400 Message-Id: <20230815145023.1386003-2-okaya@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230815145023.1386003-1-okaya@kernel.org> References: <20230815145023.1386003-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 | 12 ++++++++++++ lib/eal/common/eal_options.h | 1 + lib/eal/linux/eal.c | 2 ++ 3 files changed, 15 insertions(+) diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c index 062f1d8d9c..209b6edd76 100644 --- a/lib/eal/common/eal_common_options.c +++ b/lib/eal/common/eal_common_options.c @@ -244,6 +244,18 @@ eal_save_args(int argc, char **argv) } #endif +void +eal_plugins_cleanup(void) +{ + struct shared_driver *solib, *tmp; + + RTE_TAILQ_FOREACH_SAFE(solib, &solib_list, next, tmp) { + if (solib->lib_handle) + dlclose(solib->lib_handle); + free(solib); + } +} + 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