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 C5F5FA0540 for ; Thu, 7 Jul 2022 09:55:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BF702406B4; Thu, 7 Jul 2022 09:55:32 +0200 (CEST) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by mails.dpdk.org (Postfix) with ESMTP id 84113406B4 for ; Thu, 7 Jul 2022 09:55:31 +0200 (CEST) Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 1F7B23F04C for ; Thu, 7 Jul 2022 07:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1657180531; bh=WfHCqlaHOTjEOVvKi3wACMyGkfKdo6CbqANaUH91J24=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ZTzBJ7IRoUMq1ufX/2HSvbzfXBPCWKFBZc50YsqYi737kA6wpbkxcU/WNvLN8dJyR iCPQSWqtBYLbOlrJfv0QuPKrzMpfLLhLQRIZU4Glm6ZRLUu5KBprTb753ATcx1UVDn 3MBAeEg2p3/4XdfM7qHEfKDh2PuTCCoGwVmWSdeWzlSnRofs3ze3vNkiSrzh9SVgFV 9ibxxWOHBjPG9yF3I/GDaG8agjrk7E9HDCfcmITAwydxY1TjfoRq/wHZNpBoMXV6zV LrTCBNEizfZ3kGy8y53yarrxy7DCyqw2NN5d4GrRytFt41bS90IWov4EbqbbnQbkd3 LOMGlIGCgVIdQ== Received: by mail-ed1-f72.google.com with SMTP id y18-20020a056402441200b0043564cdf765so13422450eda.11 for ; Thu, 07 Jul 2022 00:55:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WfHCqlaHOTjEOVvKi3wACMyGkfKdo6CbqANaUH91J24=; b=j9tkNIzbtueqJVA23pnNAfrvFEEb6jrjFscVjSgr3rqKAv/oHiOB7wYLhL55xFl0ha yohBog1dAx1gKik8NbNVZVCCB4mqyxuPCZMrpCwC+PLO+GLS600t43gzAkR4fqZ78Zkj Oh1Bf5O6DHZtna/dSSNt7Kg6tzJkMLfQF57zGdJ0YZTvM6RKKRp8J+cPK6BHv34dpoEG imLAAzCVCz8d0xs9a4mlu22QGnHOOxVIdtFIVIZSYv3INXy0qYN7y8uI5g23gwbiyIUD Rlua0zBdFXc1l+ZflqmXW0xzmpkDe1V3HHHNzxANTgdpbjcY/BFistuU7jouSpuoluhb WUEA== X-Gm-Message-State: AJIora8H9ZY1WZB/R9ZiX5AqVqwKcAT2yqKJ46aRmGPn8d/0ek/UhsPq RU8SFH+OdDCaoBcu7QGzg1mQYIb8et2MimCyaTuJpbZsJ9IRflu2ZLiXWhWEDqpKwzWTHzUFWVY FT7XtOU4jUgK3um+ee7BvAyim X-Received: by 2002:a17:907:7603:b0:72a:4271:5cef with SMTP id jx3-20020a170907760300b0072a42715cefmr41015775ejc.454.1657180530833; Thu, 07 Jul 2022 00:55:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u6tYJ66LDTv9z9FP/WtRTZ0ieIWOQlEjDR7ev2FxCp1AXjGDKmbnCKqU/+cJkWuykPlfhDBg== X-Received: by 2002:a17:907:7603:b0:72a:4271:5cef with SMTP id jx3-20020a170907760300b0072a42715cefmr41015762ejc.454.1657180530588; Thu, 07 Jul 2022 00:55:30 -0700 (PDT) Received: from Keschdeichel.fritz.box ([2a02:6d40:3a4f:7b00:c19b:938e:7c97:afe2]) by smtp.gmail.com with ESMTPSA id cq9-20020a056402220900b0043a6df72c11sm7857527edb.63.2022.07.07.00.55.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 00:55:30 -0700 (PDT) From: christian.ehrhardt@canonical.com To: Tyler Retzlaff Cc: Dmitry Kozlyuk , dpdk stable Subject: patch 'eal/windows: fix data race when creating threads' has been queued to stable release 19.11.13 Date: Thu, 7 Jul 2022 09:53:56 +0200 Message-Id: <20220707075522.194223-1-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.37.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Hi, FYI, your patch has been queued to stable release 19.11.13 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/09/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/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/2a645b955cb1f0bac0d61e1755a24bb78e78737f Thanks. Christian Ehrhardt --- >From 2a645b955cb1f0bac0d61e1755a24bb78e78737f Mon Sep 17 00:00:00 2001 From: Tyler Retzlaff Date: Wed, 9 Mar 2022 23:35:08 -0800 Subject: [PATCH] eal/windows: fix data race when creating threads [ 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 Acked-by: Dmitry Kozlyuk --- lib/librte_eal/windows/eal/eal_thread.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c index 90797edb6d..563988fe40 100644 --- a/lib/librte_eal/windows/eal/eal_thread.c +++ b/lib/librte_eal/windows/eal/eal_thread.c @@ -145,12 +145,17 @@ eal_thread_create(pthread_t *thread) HANDLE th; th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)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.37.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-07-07 09:54:11.112776857 +0200 +++ 0001-eal-windows-fix-data-race-when-creating-threads.patch 2022-07-07 09:54:10.765823382 +0200 @@ -1 +1 @@ -From e4e983b975df700474309605b6adb5f2c6d83e2f Mon Sep 17 00:00:00 2001 +From 2a645b955cb1f0bac0d61e1755a24bb78e78737f Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit e4e983b975df700474309605b6adb5f2c6d83e2f ] + @@ -16 +17,0 @@ -Cc: stable@dpdk.org @@ -21 +22 @@ - lib/eal/windows/eal_thread.c | 7 ++++++- + lib/librte_eal/windows/eal/eal_thread.c | 7 ++++++- @@ -24,5 +25,6 @@ -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/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c +index 90797edb6d..563988fe40 100644 +--- a/lib/librte_eal/windows/eal/eal_thread.c ++++ b/lib/librte_eal/windows/eal/eal_thread.c +@@ -145,12 +145,17 @@ eal_thread_create(pthread_t *thread) + HANDLE th; @@ -30,2 +32 @@ - th = CreateThread(NULL, 0, - (LPTHREAD_START_ROUTINE)(ULONG_PTR)eal_thread_loop, + th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop, @@ -47 +47,0 @@ -