selftests/bpf: skip the timer_lockup test for single-CPU nodes
Subsystems (3)
PATCH 1/1 selftests/bpf: skip the timer_lockup test for single-CPU nodes
The timer_lockup test needs 2 CPUs to work, on single-CPU nodes it fails to set thread affinity to CPU 1 since it doesn't exist:
# ./test_progs -t test_lockup
test_timer_lockup:PASS:timer_lockup__open_and_load 0 nsec
test_timer_lockup:PASS:pthread_create thread1 0 nsec
test_timer_lockup:PASS:pthread_create thread2 0 nsec
timer_lockup_thread:PASS:cpu affinity 0 nsec
timer_lockup_thread:FAIL:cpu affinity unexpected error: 22 (errno 0)
test_timer_lockup:PASS: 0 nsec
#406 timer_lockup:FAILSkip the test if only 1 CPU is available.
--- tools/testing/selftests/bpf/prog_tests/timer_lockup.c | 6 ++++++ 1 file changed, 6 insertions(+)
tools/testing/selftests/bpf/prog_tests/timer_lockup.c +6 -0
@@ -5,6 +5,7 @@#include <test_progs.h> #include <pthread.h> #include <network_helpers.h> +#include <sys/sysinfo.h> #include "timer_lockup.skel.h"
@@ -52,6 +53,11 @@ void test_timer_lockup(void)pthread_t thrds[2 ];void *ret; +if (get_nprocs () <2 ) { +test__skip (); +return ; + } + skel =timer_lockup__open_and_load ();if (!ASSERT_OK_PTR (skel,"timer_lockup__open_and_load" ))return ;
Signature · 1 line
2.47.0
Quoted 4 lines · Viktor Malik
The
timer_lockuptest needs 2 CPUs to work, on single-CPU nodes it fails to set thread affinity to CPU 1 since it doesn't exist:# ./test_progs -t test_lockup
nit: s/test_lockup/timer_lockup
Quoted 8 lines
test_timer_lockup:PASS:timer_lockup__open_and_load 0 nsec test_timer_lockup:PASS:pthread_create thread1 0 nsec test_timer_lockup:PASS:pthread_create thread2 0 nsec timer_lockup_thread:PASS:cpu affinity 0 nsec timer_lockup_thread:FAIL:cpu affinity unexpected error: 22 (errno 0) test_timer_lockup:PASS: 0 nsec
#406 timer_lockup:FAIL
Quoted 5 lines
Skip the test if only 1 CPU is available.
Signed-off-by Viktor Malik <[email protected]>Fixes 50bd5a0c658d1 ("selftests/bpf: Add timer lockup selftest")---
Can reproduce this issue and this patch solves it.
Cheers.
Signature · 1 line
Philo
Quoted 25 lines · Philo Lu
Quoted 4 lines · Viktor Malik
The
timer_lockuptest needs 2 CPUs to work, on single-CPU nodes it fails to set thread affinity to CPU 1 since it doesn't exist:# ./test_progs -t test_lockupnit: s/test_lockup/timer_lockup
Quoted 13 lines
test_timer_lockup:PASS:timer_lockup__open_and_load 0 nsec test_timer_lockup:PASS:pthread_create thread1 0 nsec test_timer_lockup:PASS:pthread_create thread2 0 nsec timer_lockup_thread:PASS:cpu affinity 0 nsec timer_lockup_thread:FAIL:cpu affinity unexpected error: 22 (errno 0) test_timer_lockup:PASS: 0 nsec
#406 timer_lockup:FAILSkip the test if only 1 CPU is available.
Signed-off-by Viktor Malik <[email protected]>Fixes 50bd5a0c658d1 ("selftests/bpf: Add timer lockup selftest")---
Quoted 2 lines
[...]
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Quoted 12 lines · On Thu, 7 Nov 2024 12:52:31 +0100 you wrote:
The
timer_lockuptest needs 2 CPUs to work, on single-CPU nodes it fails to set thread affinity to CPU 1 since it doesn't exist:# ./test_progs -t test_lockup test_timer_lockup:PASS:timer_lockup__open_and_load 0 nsec test_timer_lockup:PASS:pthread_create thread1 0 nsec test_timer_lockup:PASS:pthread_create thread2 0 nsec timer_lockup_thread:PASS:cpu affinity 0 nsec timer_lockup_thread:FAIL:cpu affinity unexpected error: 22 (errno 0) test_timer_lockup:PASS: 0 nsec #406 timer_lockup:FAIL
Quoted 1 line
[...]
Here is the summary with links:
- [bpf-next] selftests/bpf: skip the timer_lockup test for single-CPU nodes
https://git.kernel.org/bpf/bpf-next/c/5bfc4f22e0d7
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html