patch 'eal/windows: fix data race when creating threads' has been queued to stable release 20.11.6

Xueming Li xuemingl at nvidia.com
Tue Jun 21 10:01:09 CEST 2022


Hi,

FYI, your patch has been queued to stable release 20.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/23/22. 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/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/5888f84ccdd65e87ec47082aac86a5a699efe9eb

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 5888f84ccdd65e87ec47082aac86a5a699efe9eb Mon Sep 17 00:00:00 2001
From: Tyler Retzlaff <roretzla at linux.microsoft.com>
Date: Wed, 9 Mar 2022 23:35:08 -0800
Subject: [PATCH] eal/windows: fix data race when creating threads
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit e4e983b975df700474309605b6adb5f2c6d83e2f ]

eal_thread_loop() uses lcore_config[i].thread_id,
which is stored upon the return from CreateThread().
Per documentation, eal_thread_loop() can start
before CreateThread() returns and the ID is stored.

Create lcore worker threads suspended and then subsequently resume to
allow &lcore_config[i].thread_id be stored before eal_thread_loop
execution.

Fixes: 53ffd9f080fc ("eal/windows: add minimum viable code")

Signed-off-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk at gmail.com>
---
 lib/librte_eal/windows/eal_thread.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/windows/eal_thread.c b/lib/librte_eal/windows/eal_thread.c
index df1df5d02c..b40498c0d6 100644
--- a/lib/librte_eal/windows/eal_thread.c
+++ b/lib/librte_eal/windows/eal_thread.c
@@ -132,13 +132,18 @@ eal_thread_create(pthread_t *thread)
 
 	th = CreateThread(NULL, 0,
 		(LPTHREAD_START_ROUTINE)(ULONG_PTR)eal_thread_loop,
-						NULL, 0, (LPDWORD)thread);
+						NULL, CREATE_SUSPENDED, (LPDWORD)thread);
 	if (!th)
 		return -1;
 
 	SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
 	SetThreadPriority(th, THREAD_PRIORITY_NORMAL);
 
+	if (ResumeThread(th) == (DWORD)-1) {
+		(void)CloseHandle(th);
+		return -1;
+	}
+
 	return 0;
 }
 
-- 
2.35.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-06-21 15:37:49.448484905 +0800
+++ 0003-eal-windows-fix-data-race-when-creating-threads.patch	2022-06-21 15:37:48.954450956 +0800
@@ -1 +1 @@
-From e4e983b975df700474309605b6adb5f2c6d83e2f Mon Sep 17 00:00:00 2001
+From 5888f84ccdd65e87ec47082aac86a5a699efe9eb Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit e4e983b975df700474309605b6adb5f2c6d83e2f ]
@@ -16 +18,0 @@
-Cc: stable at dpdk.org
@@ -21 +23 @@
- lib/eal/windows/eal_thread.c | 7 ++++++-
+ lib/librte_eal/windows/eal_thread.c | 7 ++++++-
@@ -24,5 +26,5 @@
-diff --git a/lib/eal/windows/eal_thread.c b/lib/eal/windows/eal_thread.c
-index 54fa93fa62..ff84cb42af 100644
---- a/lib/eal/windows/eal_thread.c
-+++ b/lib/eal/windows/eal_thread.c
-@@ -150,13 +150,18 @@ eal_thread_create(pthread_t *thread)
+diff --git a/lib/librte_eal/windows/eal_thread.c b/lib/librte_eal/windows/eal_thread.c
+index df1df5d02c..b40498c0d6 100644
+--- a/lib/librte_eal/windows/eal_thread.c
++++ b/lib/librte_eal/windows/eal_thread.c
+@@ -132,13 +132,18 @@ eal_thread_create(pthread_t *thread)


More information about the stable mailing list