Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 timer_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

Skip the test if only 1 CPU is available.

Signed-off-by: Viktor Malik <vmalik@redhat.com>
Fixes: 50bd5a0c658d1 ("selftests/bpf: Add timer lockup selftest")
Tested-by: Philo Lu <lulie@linux.alibaba.com>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20241107115231.75200-1-vmalik@redhat.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>

authored by

Viktor Malik and committed by
Andrii Nakryiko
937a1c29 266a5579

+6
+6
tools/testing/selftests/bpf/prog_tests/timer_lockup.c
··· 5 5 #include <test_progs.h> 6 6 #include <pthread.h> 7 7 #include <network_helpers.h> 8 + #include <sys/sysinfo.h> 8 9 9 10 #include "timer_lockup.skel.h" 10 11 ··· 52 51 struct timer_lockup *skel; 53 52 pthread_t thrds[2]; 54 53 void *ret; 54 + 55 + if (get_nprocs() < 2) { 56 + test__skip(); 57 + return; 58 + } 55 59 56 60 skel = timer_lockup__open_and_load(); 57 61 if (!ASSERT_OK_PTR(skel, "timer_lockup__open_and_load"))