[PATCH v2] ipc: fix multi-process disabling

Thomas Monjalon thomas at monjalon.net
Wed Nov 4 18:07:57 CET 2026


IPC and hotplug operations checked --no-shconf incompatible option
but ignored the multi-process status changed by rte_mp_disable().
As a result, IPC was still attempted
and hotplug devargs remained subject to the IPC message size limit
even when secondary processes could no longer attach.

Change the multi-process status when --no-shconf is used,
also covering --in-memory,
so it becomes enough to check this status only.

Allow previously registered IPC actions to be unregistered
after multi-process has been disabled.

Fixes: 5c307ba2a5b1 ("eal: register non-EAL threads as lcores")
Fixes: d2fd16c8b003 ("eal: add multiprocess disable API")
Cc: stable at dpdk.org

Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
---
v2: reverse the logic eal_mp_is_enabled -> eal_mp_is_disabled
    to map the meaning of the values in enum mp_status
    (enabled is not unknown)
---
 lib/eal/common/eal_common_dev.c  |  8 ++---
 lib/eal/common/eal_common_mcfg.c |  3 ++
 lib/eal/common/eal_common_proc.c | 56 ++++++++++++--------------------
 lib/eal/common/eal_private.h     |  5 +++
 lib/eal/windows/eal.c            |  6 ++++
 5 files changed, 37 insertions(+), 41 deletions(-)

diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index b43b0a4bb3..39d5745142 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -267,9 +267,7 @@ RTE_EXPORT_SYMBOL(rte_dev_probe)
 int
 rte_dev_probe(const char *devargs)
 {
-	const struct internal_config *internal_conf =
-		eal_get_internal_configuration();
-	bool do_mp = internal_conf->no_shconf == 0;
+	bool do_mp = !eal_mp_is_disabled();
 	struct eal_dev_mp_req req;
 	struct rte_device *dev;
 	int ret;
@@ -426,9 +424,7 @@ RTE_EXPORT_SYMBOL(rte_dev_remove)
 int
 rte_dev_remove(struct rte_device *dev)
 {
-	const struct internal_config *internal_conf =
-		eal_get_internal_configuration();
-	bool do_mp = internal_conf->no_shconf == 0;
+	bool do_mp = !eal_mp_is_disabled();
 	struct eal_dev_mp_req req;
 	char *devargs;
 	int ret;
diff --git a/lib/eal/common/eal_common_mcfg.c b/lib/eal/common/eal_common_mcfg.c
index 84ee3f3959..32f5f50015 100644
--- a/lib/eal/common/eal_common_mcfg.c
+++ b/lib/eal/common/eal_common_mcfg.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
+#include <rte_eal.h>
 #include <rte_eal_memconfig.h>
 #include <rte_version.h>
 
@@ -66,6 +67,8 @@ eal_mcfg_update_from_internal(void)
 
 	mcfg->legacy_mem = internal_conf->legacy_mem;
 	mcfg->single_file_segments = internal_conf->single_file_segments;
+	if (internal_conf->no_shconf)
+		rte_mp_disable(); /* multi-process requires shared config */
 	/* record current DPDK version */
 	mcfg->version = RTE_VERSION;
 }
diff --git a/lib/eal/common/eal_common_proc.c b/lib/eal/common/eal_common_proc.c
index 73c6a53013..b70e9189a4 100644
--- a/lib/eal/common/eal_common_proc.c
+++ b/lib/eal/common/eal_common_proc.c
@@ -233,14 +233,12 @@ int
 rte_mp_action_register(const char *name, rte_mp_t action)
 {
 	struct action_entry *entry;
-	const struct internal_config *internal_conf =
-		eal_get_internal_configuration();
 
 	if (validate_action_name(name) != 0)
 		return -1;
 
-	if (internal_conf->no_shconf) {
-		EAL_LOG(DEBUG, "No shared files mode enabled, IPC is disabled");
+	if (eal_mp_is_disabled()) {
+		EAL_LOG(DEBUG, "Multi-process support is disabled");
 		rte_errno = ENOTSUP;
 		return -1;
 	}
@@ -270,17 +268,10 @@ void
 rte_mp_action_unregister(const char *name)
 {
 	struct action_entry *entry;
-	const struct internal_config *internal_conf =
-		eal_get_internal_configuration();
 
 	if (validate_action_name(name) != 0)
 		return;
 
-	if (internal_conf->no_shconf) {
-		EAL_LOG(DEBUG, "No shared files mode enabled, IPC is disabled");
-		return;
-	}
-
 	pthread_mutex_lock(&mp_mutex_action);
 	entry = find_action_entry_by_name(name);
 	if (entry == NULL) {
@@ -656,14 +647,9 @@ rte_mp_channel_init(void)
 {
 	char path[UNIX_PATH_MAX];
 	int dir_fd;
-	const struct internal_config *internal_conf =
-		eal_get_internal_configuration();
 
-	/* in no shared files mode, we do not have secondary processes support,
-	 * so no need to initialize IPC.
-	 */
-	if (internal_conf->no_shconf) {
-		EAL_LOG(DEBUG, "No shared files mode enabled, IPC will be disabled");
+	if (eal_mp_is_disabled()) {
+		EAL_LOG(DEBUG, "Multi-process support is disabled");
 		rte_errno = ENOTSUP;
 		return -1;
 	}
@@ -912,14 +898,11 @@ RTE_EXPORT_SYMBOL(rte_mp_sendmsg)
 int
 rte_mp_sendmsg(struct rte_mp_msg *msg)
 {
-	const struct internal_config *internal_conf =
-		eal_get_internal_configuration();
-
 	if (check_input(msg) != 0)
 		return -1;
 
-	if (internal_conf->no_shconf) {
-		EAL_LOG(DEBUG, "No shared files mode enabled, IPC is disabled");
+	if (eal_mp_is_disabled()) {
+		EAL_LOG(DEBUG, "Multi-process support is disabled");
 		rte_errno = ENOTSUP;
 		return -1;
 	}
@@ -1073,8 +1056,6 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply,
 	DIR *mp_dir;
 	struct dirent *ent;
 	struct timespec now, end;
-	const struct internal_config *internal_conf =
-		eal_get_internal_configuration();
 
 	EAL_LOG(DEBUG, "request: %s", req->name);
 
@@ -1085,8 +1066,8 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply,
 	if (check_input(req) != 0)
 		goto end;
 
-	if (internal_conf->no_shconf) {
-		EAL_LOG(DEBUG, "No shared files mode enabled, IPC is disabled");
+	if (eal_mp_is_disabled()) {
+		EAL_LOG(DEBUG, "Multi-process support is disabled");
 		rte_errno = ENOTSUP;
 		return -1;
 	}
@@ -1182,16 +1163,14 @@ rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts,
 	struct timespec now;
 	struct timespec *end;
 	bool dummy_used = false;
-	const struct internal_config *internal_conf =
-		eal_get_internal_configuration();
 
 	EAL_LOG(DEBUG, "request: %s", req->name);
 
 	if (check_input(req) != 0)
 		return -1;
 
-	if (internal_conf->no_shconf) {
-		EAL_LOG(DEBUG, "No shared files mode enabled, IPC is disabled");
+	if (eal_mp_is_disabled()) {
+		EAL_LOG(DEBUG, "Multi-process support is disabled");
 		rte_errno = ENOTSUP;
 		return -1;
 	}
@@ -1378,8 +1357,6 @@ int
 rte_mp_reply(struct rte_mp_msg *msg, const char *peer)
 {
 	EAL_LOG(DEBUG, "reply: %s", msg->name);
-	const struct internal_config *internal_conf =
-		eal_get_internal_configuration();
 
 	if (check_input(msg) != 0)
 		return -1;
@@ -1390,8 +1367,8 @@ rte_mp_reply(struct rte_mp_msg *msg, const char *peer)
 		return -1;
 	}
 
-	if (internal_conf->no_shconf) {
-		EAL_LOG(DEBUG, "No shared files mode enabled, IPC is disabled");
+	if (eal_mp_is_disabled()) {
+		EAL_LOG(DEBUG, "Multi-process support is disabled");
 		return 0;
 	}
 
@@ -1438,3 +1415,12 @@ __rte_mp_enable(void)
 {
 	return set_mp_status(MP_STATUS_ENABLED);
 }
+
+bool
+eal_mp_is_disabled(void)
+{
+	struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
+
+	return rte_atomic_load_explicit(&mcfg->mp_status,
+			rte_memory_order_relaxed) == MP_STATUS_DISABLED;
+}
diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 8905464f64..60441ac0f2 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -741,6 +741,11 @@ eal_rand_init(void);
  */
 bool __rte_mp_enable(void);
 
+/**
+ * Check whether multi-process is disabled.
+ */
+bool eal_mp_is_disabled(void);
+
 /**
  * Init per-lcore info in current thread.
  *
diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
index cac8faa53d..7309986910 100644
--- a/lib/eal/windows/eal.c
+++ b/lib/eal/windows/eal.c
@@ -81,6 +81,12 @@ rte_mp_disable(void)
 	return true;
 }
 
+bool
+eal_mp_is_disabled(void)
+{
+	return true;
+}
+
 static int
 sync_func(void *arg __rte_unused)
 {
-- 
2.55.0



More information about the stable mailing list