patch 'eal: add helper to initialize process-shared mutex' has been queued to stable release 25.11.3
Kevin Traynor
ktraynor at redhat.com
Thu Jul 23 19:14:43 CEST 2026
Hi,
FYI, your patch has been queued to stable release 25.11.3
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/27/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/kevintraynor/dpdk-stable
This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/fa55276d1021e974fddedc566538bddbc49041e8
Thanks.
Kevin
---
>From fa55276d1021e974fddedc566538bddbc49041e8 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Wed, 29 Apr 2026 11:46:38 -0700
Subject: [PATCH] eal: add helper to initialize process-shared mutex
[ upstream commit c718d23bb15d02db5baa620edd8fbdc2faee51a1 ]
Drivers and libraries that place a pthread_mutex_t in shared memory
to coordinate primary and secondary DPDK processes must initialize
the mutex with PTHREAD_PROCESS_SHARED, otherwise behaviour is
undefined. Add an internal helper so this is done in one place rather
than copied into every driver.
Errors from the attribute calls are ignored: on platforms that do not
support cross-process mutex sharing the mutex still works within a
single process.
Bugzilla ID: 662
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
lib/eal/include/rte_thread.h | 15 +++++++++++++++
lib/eal/unix/rte_thread.c | 12 ++++++++++++
lib/eal/windows/rte_thread.c | 10 ++++++++++
3 files changed, 37 insertions(+)
diff --git a/lib/eal/include/rte_thread.h b/lib/eal/include/rte_thread.h
index 8da9d4d3fb..27d5b9c594 100644
--- a/lib/eal/include/rte_thread.h
+++ b/lib/eal/include/rte_thread.h
@@ -4,4 +4,5 @@
*/
+#include <pthread.h>
#include <stdint.h>
@@ -464,4 +465,18 @@ int rte_thread_value_set(rte_thread_key key, const void *value);
void *rte_thread_value_get(rte_thread_key key);
+/**
+ * Initialize a pthread mutex for use in shared memory accessible by
+ * multiple DPDK processes.
+ *
+ * Sets PTHREAD_PROCESS_SHARED so the mutex can synchronize threads
+ * across DPDK primary and secondary processes when the mutex resides
+ * in shared memory (e.g. hugepage memory).
+ *
+ * @param mutex
+ * The mutex to initialize.
+ */
+__rte_internal
+void rte_thread_mutex_init_shared(pthread_mutex_t *mutex);
+
#ifdef __cplusplus
}
diff --git a/lib/eal/unix/rte_thread.c b/lib/eal/unix/rte_thread.c
index 950c0848ba..f3a6bd2ad3 100644
--- a/lib/eal/unix/rte_thread.c
+++ b/lib/eal/unix/rte_thread.c
@@ -420,2 +420,14 @@ rte_thread_get_affinity_by_id(rte_thread_t thread_id,
sizeof(*cpuset), cpuset);
}
+
+RTE_EXPORT_INTERNAL_SYMBOL(rte_thread_mutex_init_shared)
+void
+rte_thread_mutex_init_shared(pthread_mutex_t *mutex)
+{
+ pthread_mutexattr_t attr;
+
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
+ pthread_mutex_init(mutex, &attr);
+ pthread_mutexattr_destroy(&attr);
+}
diff --git a/lib/eal/windows/rte_thread.c b/lib/eal/windows/rte_thread.c
index 85e5a57346..19bb9ed61d 100644
--- a/lib/eal/windows/rte_thread.c
+++ b/lib/eal/windows/rte_thread.c
@@ -622,2 +622,12 @@ cleanup:
return ret;
}
+
+/* Note: Windows does not have PTHREAD_PROCESS_SHARED
+ * and DPDK on Windows only supports single process model.
+ */
+RTE_EXPORT_INTERNAL_SYMBOL(rte_thread_mutex_init_shared)
+void
+rte_thread_mutex_init_shared(pthread_mutex_t *mutex)
+{
+ pthread_mutex_init(mutex, NULL);
+}
--
2.55.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-07-23 17:57:59.275044433 +0100
+++ 0020-eal-add-helper-to-initialize-process-shared-mutex.patch 2026-07-23 17:57:58.635918634 +0100
@@ -1 +1 @@
-From c718d23bb15d02db5baa620edd8fbdc2faee51a1 Mon Sep 17 00:00:00 2001
+From fa55276d1021e974fddedc566538bddbc49041e8 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit c718d23bb15d02db5baa620edd8fbdc2faee51a1 ]
+
@@ -17 +18,0 @@
-Cc: stable at dpdk.org
More information about the stable
mailing list