diff mbox series

eal/windows: fix default thread priority

Message ID 20210218114058.13248-1-talshn@nvidia.com (mailing list archive)
State Accepted
Delegated to: Thomas Monjalon
Headers show
Series eal/windows: fix default thread priority | expand

Checks

Context Check Description
ci/iol-abi-testing success Testing PASS
ci/iol-testing fail Testing issues
ci/github-robot success github build: passed
ci/travis-robot fail travis build: failed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Tal Shnaiderman Feb. 18, 2021, 11:40 a.m. UTC
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 <odia@nvidia.com>
Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
---
 lib/librte_eal/windows/eal_thread.c      | 4 ++--
 lib/librte_eal/windows/include/pthread.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Tal Shnaiderman March 9, 2021, 8:30 a.m. UTC | #1
> Subject: [dpdk-dev] [PATCH] eal/windows: fix default thread priority
> 
> 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 <odia@nvidia.com>
> Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
> ---
>  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);  }
> --
> 2.16.1.windows.4

Hi,

Any comments on the patch or can it be Acked as was discussed in the community call?
Dmitry Kozlyuk March 9, 2021, 9:44 p.m. UTC | #2
2021-02-18 13:40 (UTC+0200), Tal Shnaiderman:
> 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 <odia@nvidia.com>
> Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
> ---
>  lib/librte_eal/windows/eal_thread.c      | 4 ++--
>  lib/librte_eal/windows/include/pthread.h | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)

Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Thomas Monjalon March 16, 2021, 11:41 a.m. UTC | #3
09/03/2021 22:44, Dmitry Kozlyuk:
> 2021-02-18 13:40 (UTC+0200), Tal Shnaiderman:
> > 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 <odia@nvidia.com>
> > Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
> 
> Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>

Applied, thanks
diff mbox series

Patch

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);
 }