Skip to content

Commit 5d1c638

Browse files
viktormalikgregkh
authored andcommitted
selftests/bpf: skip the timer_lockup test for single-CPU nodes
[ Upstream commit 937a1c2 ] 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 Rust-for-Linux#406 timer_lockup:FAIL Skip the test if only 1 CPU is available. Signed-off-by: Viktor Malik <[email protected]> Fixes: 50bd5a0 ("selftests/bpf: Add timer lockup selftest") Tested-by: Philo Lu <[email protected]> Acked-by: Kumar Kartikeya Dwivedi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 9ff1b95 commit 5d1c638

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tools/testing/selftests/bpf/prog_tests/timer_lockup.c

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <test_progs.h>
66
#include <pthread.h>
77
#include <network_helpers.h>
8+
#include <sys/sysinfo.h>
89

910
#include "timer_lockup.skel.h"
1011

@@ -52,6 +53,11 @@ void test_timer_lockup(void)
5253
pthread_t thrds[2];
5354
void *ret;
5455

56+
if (get_nprocs() < 2) {
57+
test__skip();
58+
return;
59+
}
60+
5561
skel = timer_lockup__open_and_load();
5662
if (!ASSERT_OK_PTR(skel, "timer_lockup__open_and_load"))
5763
return;

0 commit comments

Comments
 (0)