From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6E7E9A00BE for ; Thu, 10 Mar 2022 08:35:43 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 616A541148; Thu, 10 Mar 2022 08:35:43 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id EC540410DD; Thu, 10 Mar 2022 08:35:40 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id D8E3520B7178; Wed, 9 Mar 2022 23:35:39 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D8E3520B7178 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1646897739; bh=GLtbfv62jQFEKJPwMTCqUF8VIhmE5+su+YaZQLNHGHc=; h=From:To:Cc:Subject:Date:From; b=XvTcF78swJ1s/R0iXDVWg0o3RIHpJ5JHIP7hratmuC/+axZPIUOZW6KXL6748vtQG 65YWugf+iPjgCXv4XeNidh/DtFCf3uAOodJ9Kyp8J78/XKPJUrp9hPeX9uVZ02jBwp flXjTTHkL4u6MRv3hLzOxatO8Fww2/Bn5Y8NM0wU= From: Tyler Retzlaff To: dev@dpdk.org Cc: dmitry.kozliuk@gmail.com, Tyler Retzlaff , anand.rawat@intel.com, stable@dpdk.org Subject: [PATCH] eal/windows: fix data race when creating threads Date: Wed, 9 Mar 2022 23:35:08 -0800 Message-Id: <1646897708-3462-1-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 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") Cc: anand.rawat@intel.com Cc: stable@dpdk.org Signed-off-by: Tyler Retzlaff --- lib/eal/windows/eal_thread.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/eal/windows/eal_thread.c b/lib/eal/windows/eal_thread.c index 54fa93f..ff84cb4 100644 --- a/lib/eal/windows/eal_thread.c +++ b/lib/eal/windows/eal_thread.c @@ -150,13 +150,18 @@ 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; } -- 1.8.3.1