From patchwork Thu Feb 18 11:40:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tal Shnaiderman X-Patchwork-Id: 87973 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 575DDA054D; Thu, 18 Feb 2021 12:41:39 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CADA716071C; Thu, 18 Feb 2021 12:41:38 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by mails.dpdk.org (Postfix) with ESMTP id DC373160712 for ; Thu, 18 Feb 2021 12:41:37 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from talshn@nvidia.com) with SMTP; 18 Feb 2021 13:41:35 +0200 Received: from nvidia.com (l-wincomp04-vm.mtl.labs.mlnx [10.237.1.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 11IBfZRT013564; Thu, 18 Feb 2021 13:41:35 +0200 From: Tal Shnaiderman To: dev@dpdk.org Cc: thomas@monjalon.net, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com, navasile@linux.microsoft.com, dmitrym@microsoft.com, david.marchand@redhat.com, stable@dpdk.org Date: Thu, 18 Feb 2021 13:40:58 +0200 Message-Id: <20210218114058.13248-1-talshn@nvidia.com> X-Mailer: git-send-email 2.16.1.windows.4 Subject: [dpdk-dev] [PATCH] eal/windows: fix default thread priority X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The hard-coded thread priority for Windows threads in eal is REALTIME_PRIORITY_CLASS/THREAD_PRIORITY_TIME_CRITICAL. This results in issues with DPDK threads causing OS thread starvation and eventually a bugcheck. The fix reduce the thread priority to NORMAL_PRIORITY_CLASS/THREAD_PRIORITY_NORMAL. Bugzilla ID: 600 Fixes: 53ffd9f080f ("eal/windows: add minimum viable code") Cc: stable@dpdk.org Reported-by: Odi Assli Signed-off-by: Tal Shnaiderman Acked-by: Dmitry Kozlyuk --- lib/librte_eal/windows/eal_thread.c | 4 ++-- lib/librte_eal/windows/include/pthread.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/windows/eal_thread.c b/lib/librte_eal/windows/eal_thread.c index 908e726d16..9c3f6d69fd 100644 --- a/lib/librte_eal/windows/eal_thread.c +++ b/lib/librte_eal/windows/eal_thread.c @@ -134,8 +134,8 @@ eal_thread_create(pthread_t *thread) if (!th) return -1; - SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS); - SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL); + SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); + SetThreadPriority(th, THREAD_PRIORITY_NORMAL); return 0; } diff --git a/lib/librte_eal/windows/include/pthread.h b/lib/librte_eal/windows/include/pthread.h index fb11a07ce6..9aeab1fa70 100644 --- a/lib/librte_eal/windows/include/pthread.h +++ b/lib/librte_eal/windows/include/pthread.h @@ -137,8 +137,8 @@ pthread_create(void *threadid, const void *threadattr, void *threadfunc, hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)threadfunc, args, 0, (LPDWORD)threadid); if (hThread) { - SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS); - SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL); + SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); + SetThreadPriority(hThread, THREAD_PRIORITY_NORMAL); } return ((hThread != NULL) ? 0 : E_FAIL); }