patch 'app/testpmd: monitor state of primary process' has been queued to stable release 24.11.4
Kevin Traynor
ktraynor at redhat.com
Fri Oct 31 15:32:27 CET 2025
Hi,
FYI, your patch has been queued to stable release 24.11.4
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/05/25. 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/kevintraynor/dpdk-stable
This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/1abb5e1c5de1b16d4d08fc98715e66eab2767944
Thanks.
Kevin
---
>From 1abb5e1c5de1b16d4d08fc98715e66eab2767944 Mon Sep 17 00:00:00 2001
From: Khadem Ullah <14pwcse1224 at uetpeshawar.edu.pk>
Date: Mon, 4 Aug 2025 07:33:22 -0400
Subject: [PATCH] app/testpmd: monitor state of primary process
[ upstream commit 7628f5bbb7e882e57c956d98731cac12a436c9a7 ]
In secondary processes, accessing device after primary has exited
will cause crash.
This patch adds a mechanism in testpmd to monitor the primary process
from the secondary process.
When primary process exits it forces secondary to exit avoiding
issues from cleanup logic.
Fixes: a550baf24af9 ("app/testpmd: support multi-process")
Signed-off-by: Khadem Ullah <14pwcse1224 at uetpeshawar.edu.pk>
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
app/test-pmd/testpmd.c | 47 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index ac654048df..5aaf6534e3 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -102,4 +102,7 @@ uint16_t verbose_level = 0; /**< Silent by default. */
int testpmd_logtype; /**< Log type for testpmd logs */
+/* Maximum delay for exiting after primary process. */
+#define MONITOR_INTERVAL (500 * 1000)
+
/* use main core for command line ? */
uint8_t interactive = 0;
@@ -107,5 +110,4 @@ uint8_t auto_start = 0;
uint8_t tx_first;
char cmdline_filename[PATH_MAX] = {0};
-
/*
* NUMA support configuration.
@@ -4293,4 +4295,36 @@ signal_handler(int signum __rte_unused)
}
+#ifndef RTE_EXEC_ENV_WINDOWS
+/* Alarm signal handler, used to check that primary process */
+static void
+monitor_primary(void *arg __rte_unused)
+{
+ if (rte_eal_primary_proc_alive(NULL)) {
+ rte_eal_alarm_set(MONITOR_INTERVAL, monitor_primary, NULL);
+ } else {
+ /*
+ * If primary process exits, then all the device information
+ * is no longer valid. Calling any cleanup code is going to
+ * run into use after free.
+ */
+ fprintf(stderr, "\nPrimary process is no longer active, exiting...\n");
+ exit(EXIT_FAILURE);
+ }
+}
+
+/* Setup handler to check when primary exits. */
+static int
+enable_primary_monitor(void)
+{
+ return rte_eal_alarm_set(MONITOR_INTERVAL, monitor_primary, NULL);
+}
+
+static void
+disable_primary_monitor(void)
+{
+ rte_eal_alarm_cancel(monitor_primary, NULL);
+}
+#endif
+
int
main(int argc, char** argv)
@@ -4324,4 +4358,10 @@ main(int argc, char** argv)
rte_strerror(rte_errno));
+#ifndef RTE_EXEC_ENV_WINDOWS
+ if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
+ enable_primary_monitor() < 0)
+ rte_exit(EXIT_FAILURE, "Cannot setup primary monitor");
+#endif
+
/* allocate port structures, and init them */
init_port();
@@ -4517,4 +4557,9 @@ main(int argc, char** argv)
}
+#ifndef RTE_EXEC_ENV_WINDOWS
+ if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+ disable_primary_monitor();
+#endif
+
pmd_test_exit();
--
2.51.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2025-10-31 13:53:53.034360913 +0000
+++ 0025-app-testpmd-monitor-state-of-primary-process.patch 2025-10-31 13:53:52.051523415 +0000
@@ -1 +1 @@
-From 7628f5bbb7e882e57c956d98731cac12a436c9a7 Mon Sep 17 00:00:00 2001
+From 1abb5e1c5de1b16d4d08fc98715e66eab2767944 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 7628f5bbb7e882e57c956d98731cac12a436c9a7 ]
+
@@ -15 +16,0 @@
-Cc: stable at dpdk.org
@@ -24 +25 @@
-index db52ed22f1..0f58a31eb5 100644
+index ac654048df..5aaf6534e3 100644
@@ -27 +28 @@
-@@ -103,4 +103,7 @@ uint16_t verbose_level = 0; /**< Silent by default. */
+@@ -102,4 +102,7 @@ uint16_t verbose_level = 0; /**< Silent by default. */
@@ -35 +36,2 @@
-@@ -109,5 +112,4 @@ uint8_t tx_first;
+@@ -107,5 +110,4 @@ uint8_t auto_start = 0;
+ uint8_t tx_first;
@@ -37 +38,0 @@
- bool echo_cmdline_file;
@@ -41 +42 @@
-@@ -4364,4 +4366,36 @@ signal_handler(int signum __rte_unused)
+@@ -4293,4 +4295,36 @@ signal_handler(int signum __rte_unused)
@@ -78 +79 @@
-@@ -4395,4 +4429,10 @@ main(int argc, char** argv)
+@@ -4324,4 +4358,10 @@ main(int argc, char** argv)
@@ -89 +90 @@
-@@ -4588,4 +4628,9 @@ main(int argc, char** argv)
+@@ -4517,4 +4557,9 @@ main(int argc, char** argv)
More information about the stable
mailing list