From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id A2C0F43073;
	Tue, 15 Aug 2023 16:50:45 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id E04EE4325E;
	Tue, 15 Aug 2023 16:50:35 +0200 (CEST)
Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217])
 by mails.dpdk.org (Postfix) with ESMTP id 5565E43000
 for <dev@dpdk.org>; Tue, 15 Aug 2023 16:50:33 +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 D8CFB61693;
 Tue, 15 Aug 2023 14:50:32 +0000 (UTC)
Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6948C433CA;
 Tue, 15 Aug 2023 14:50:31 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
 s=k20201202; t=1692111032;
 bh=1NMAd+IiYHZ0dTvhI2PO7nYtF02pb5JQJk+0oBeNspY=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=Yz8xBVU83o39MGF/iqvPwCzZKszwe1g0Lsu8xGO91O8svV+05nglAe+1qvhtc1K39
 Q8YkT2cVsc8B29Rj1NWHTXPLp0HUBMBRoxuaDXa58EyZDUsW8GUYUDcUOpo/u4kMsA
 o2Fjowrwykr/7dkMp9ddxfyBWueCfRfbV5dD+MtkfY+iJ5UoMHAE6QVku4vJbuR0TQ
 shSBasUes27K017KbqHSU8+/1FO6e/j+WBJzhj2ECUTaq3K57NpsLKL8DTA96vWyxr
 /OJ4jcgj1IHYQAMz9nOZbLgwDmB+nMqO+P+IiGf3KUbPRKAhBkcUC4S54IL5aU2RYK
 in4wIbrdh5jiA==
From: okaya@kernel.org
To: 
Cc: dev@dpdk.org, Graham Whyte <grwhyte@microsoft.com>,
 Sinan Kaya <okaya@kernel.org>
Subject: [PATCH v4 2/8] eal: fixes for re-initialization issues
Date: Tue, 15 Aug 2023 10:50:17 -0400
Message-Id: <20230815145023.1386003-3-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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

From: Graham Whyte <grwhyte@microsoft.com>

reinitialize the solib link list and clean the globals holding
state for parsing.

Signed-off-by: Sinan Kaya <okaya@kernel.org>
Signed-off-by: Graham Whyte <grwhyte@microsoft.com>
---
 lib/eal/common/eal_common_options.c | 8 ++++++++
 lib/eal/linux/eal.c                 | 4 +++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c
index 209b6edd76..6042de009d 100644
--- a/lib/eal/common/eal_common_options.c
+++ b/lib/eal/common/eal_common_options.c
@@ -127,6 +127,7 @@ TAILQ_HEAD_INITIALIZER(solib_list);
 static const char *default_solib_dir = RTE_EAL_PMD_PATH;
 #endif
 
+
 /*
  * Stringified version of solib path used by dpdk-pmdinfo.py
  * Note: PLEASE DO NOT ALTER THIS without making a corresponding
@@ -254,6 +255,13 @@ eal_plugins_cleanup(void)
 			dlclose(solib->lib_handle);
 		free(solib);
 	}
+
+	/* Reinitialize solib_list */
+	TAILQ_INIT(&solib_list);
+
+	main_lcore_parsed = 0;
+	mem_parsed = 0;
+	core_parsed = 0;
 }
 
 static int
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index dee649bab3..584c78e640 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -79,6 +79,8 @@ struct lcore_config lcore_config[RTE_MAX_LCORE];
 int rte_cycles_vmware_tsc_map;
 
 
+static uint32_t run_once;
+
 int
 eal_clean_runtime_dir(void)
 {
@@ -505,6 +507,7 @@ eal_parse_socket_arg(char *strval, volatile uint64_t *socket_arg)
 		socket_arg[i] = val;
 	}
 
+	__atomic_store_n(&run_once, 0, __ATOMIC_RELAXED);
 	return 0;
 }
 
@@ -967,7 +970,6 @@ int
 rte_eal_init(int argc, char **argv)
 {
 	int i, fctret, ret;
-	static uint32_t run_once;
 	uint32_t has_run = 0;
 	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
 	char thread_name[RTE_MAX_THREAD_NAME_LEN];
-- 
2.25.1