patch 'ipc: notify secondary on primary process exit' has been queued to stable release 24.11.9

luca.boccassi at gmail.com luca.boccassi at gmail.com
Tue Oct 27 12:50:09 CET 2026


Hi,

FYI, your patch has been queued to stable release 24.11.9

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 10/29/26. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/a5e99b388133cf636934af36aeaba43308e7be1c

Thanks.

Luca Boccassi

---
>From a5e99b388133cf636934af36aeaba43308e7be1c Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Thu, 7 May 2026 13:58:37 -0700
Subject: [PATCH] ipc: notify secondary on primary process exit

[ upstream commit 3c09706d51ad64d1011244991a86cc7982612159 ]

When primary process exits, it should notify the secondary
processes. This allows for clean shutdown and eliminates need
for MP handling in applications (such as test-pmd).

Bugzilla ID: 1942
Fixes: 85d6815fa6d0 ("eal: close multi-process socket during cleanup")

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
 lib/eal/common/eal_common_proc.c | 51 ++++++++++++++++++++++++++++++--
 1 file changed, 49 insertions(+), 2 deletions(-)

diff --git a/lib/eal/common/eal_common_proc.c b/lib/eal/common/eal_common_proc.c
index d3494b7c1c7..816d66397e8 100644
--- a/lib/eal/common/eal_common_proc.c
+++ b/lib/eal/common/eal_common_proc.c
@@ -59,6 +59,15 @@ enum mp_type {
 	MP_IGN, /* Response telling requester to ignore this response */
 };
 
+/* Message sent from primary EAL to secondary EAL */
+#define EAL_MP "mp_eal"
+struct eal_mp_req {
+	enum {
+		MP_REQ_NOP = 0,
+		MP_REQ_QUIT,
+	} type;
+};
+
 struct mp_msg_internal {
 	int type;
 	struct rte_mp_msg msg;
@@ -611,6 +620,25 @@ close_socket_fd(int fd)
 	unlink(path);
 }
 
+/* callback in secondary when primary has exited */
+static int
+mp_primary_exited(const struct rte_mp_msg *msg, const void *peer __rte_unused)
+{
+	const struct eal_mp_req *req;
+
+	if (msg->len_param != sizeof(*req)) {
+		EAL_LOG(ERR, "invalid request from primary");
+		return -EINVAL;
+	}
+
+	req = (const struct eal_mp_req *)msg->param;
+	if (req->type == MP_REQ_QUIT)
+		rte_mp_channel_cleanup();
+
+	/* no reply needed */
+	return 0;
+}
+
 int
 rte_mp_channel_init(void)
 {
@@ -656,6 +684,10 @@ rte_mp_channel_init(void)
 		return -1;
 	}
 
+	/* listen for quit message from primary */
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+		rte_mp_action_register(EAL_MP, mp_primary_exited);
+
 	if (rte_thread_create_internal_control(&mp_handle_tid, "mp-msg",
 			mp_handle, NULL) < 0) {
 		EAL_LOG(ERR, "failed to create mp thread: %s",
@@ -677,12 +709,27 @@ rte_mp_channel_cleanup(void)
 {
 	int fd;
 
+	/* Primary exiting, tell all secondary processes */
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+		struct rte_mp_msg msg = { .name = EAL_MP };
+		struct eal_mp_req req = { .type = MP_REQ_QUIT };
+
+		memcpy(&msg.param, &req, sizeof(req));
+		msg.len_param = sizeof(req);
+
+		rte_mp_sendmsg(&msg);
+	} else {
+		rte_mp_action_unregister(EAL_MP);
+	}
+
 	fd = rte_atomic_exchange_explicit(&mp_fd, -1, rte_memory_order_relaxed);
 	if (fd < 0)
 		return;
 
-	pthread_cancel((pthread_t)mp_handle_tid.opaque_id);
-	rte_thread_join(mp_handle_tid, NULL);
+	if (pthread_self() != (pthread_t)mp_handle_tid.opaque_id) {
+		pthread_cancel((pthread_t)mp_handle_tid.opaque_id);
+		rte_thread_join(mp_handle_tid, NULL);
+	}
 	close_socket_fd(fd);
 }
 
-- 
2.47.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-10-27 11:43:58.178040197 +0000
+++ 0115-ipc-notify-secondary-on-primary-process-exit.patch	2026-10-27 11:43:53.646063535 +0000
@@ -1 +1 @@
-From 3c09706d51ad64d1011244991a86cc7982612159 Mon Sep 17 00:00:00 2001
+From a5e99b388133cf636934af36aeaba43308e7be1c Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 3c09706d51ad64d1011244991a86cc7982612159 ]
+
@@ -12 +13,0 @@
-Cc: stable at dpdk.org
@@ -21 +22 @@
-index 5133eaaa47..73c6a53013 100644
+index d3494b7c1c7..816d66397e8 100644
@@ -24 +25 @@
-@@ -60,6 +60,15 @@ enum mp_type {
+@@ -59,6 +59,15 @@ enum mp_type {
@@ -40,2 +41,2 @@
-@@ -623,6 +632,25 @@ close_socket_fd(int fd)
- 		unlink(path);
+@@ -611,6 +620,25 @@ close_socket_fd(int fd)
+ 	unlink(path);
@@ -66 +67 @@
-@@ -670,6 +698,10 @@ rte_mp_channel_init(void)
+@@ -656,6 +684,10 @@ rte_mp_channel_init(void)
@@ -77 +78 @@
-@@ -691,12 +723,27 @@ rte_mp_channel_cleanup(void)
+@@ -677,12 +709,27 @@ rte_mp_channel_cleanup(void)


More information about the stable mailing list