* [PATCH bpf-next] selftests/bpf: skip the timer_lockup test for single-CPU nodes
@ 2024-11-07 11:52 Viktor Malik
2024-11-08 4:41 ` Philo Lu
2024-11-09 20:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 4+ messages in thread
From: Viktor Malik @ 2024-11-07 11:52 UTC (permalink / raw)
To: bpf
Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Eduard Zingerman, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
Mykola Lysenko, Shuah Khan, Kumar Kartikeya Dwivedi, Viktor Malik
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: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")
---
tools/testing/selftests/bpf/prog_tests/timer_lockup.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/testing/selftests/bpf/prog_tests/timer_lockup.c b/tools/testing/selftests/bpf/prog_tests/timer_lockup.c
index 871d16cb95cf..1a2f99596916 100644
--- a/tools/testing/selftests/bpf/prog_tests/timer_lockup.c
+++ b/tools/testing/selftests/bpf/prog_tests/timer_lockup.c
@@ -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;
--
2.47.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH bpf-next] selftests/bpf: skip the timer_lockup test for single-CPU nodes
2024-11-07 11:52 [PATCH bpf-next] selftests/bpf: skip the timer_lockup test for single-CPU nodes Viktor Malik
@ 2024-11-08 4:41 ` Philo Lu
2024-11-09 20:06 ` Kumar Kartikeya Dwivedi
2024-11-09 20:20 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 4+ messages in thread
From: Philo Lu @ 2024-11-08 4:41 UTC (permalink / raw)
To: Viktor Malik, bpf
Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Eduard Zingerman, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
Mykola Lysenko, Shuah Khan, Kumar Kartikeya Dwivedi
On 2024/11/7 19:52, Viktor Malik wrote:
> 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
nit: s/test_lockup/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")
> ---
Can reproduce this issue and this patch solves it.
Tested-by: Philo Lu <lulie@linux.alibaba.com>
Cheers.
--
Philo
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH bpf-next] selftests/bpf: skip the timer_lockup test for single-CPU nodes
2024-11-08 4:41 ` Philo Lu
@ 2024-11-09 20:06 ` Kumar Kartikeya Dwivedi
0 siblings, 0 replies; 4+ messages in thread
From: Kumar Kartikeya Dwivedi @ 2024-11-09 20:06 UTC (permalink / raw)
To: Philo Lu
Cc: Viktor Malik, bpf, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Mykola Lysenko, Shuah Khan
On Fri, 8 Nov 2024 at 05:41, Philo Lu <lulie@linux.alibaba.com> wrote:
>
>
>
> On 2024/11/7 19:52, Viktor Malik wrote:
> > 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
>
> nit: s/test_lockup/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")
> > ---
>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
> [...]
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] selftests/bpf: skip the timer_lockup test for single-CPU nodes
2024-11-07 11:52 [PATCH bpf-next] selftests/bpf: skip the timer_lockup test for single-CPU nodes Viktor Malik
2024-11-08 4:41 ` Philo Lu
@ 2024-11-09 20:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-11-09 20:20 UTC (permalink / raw)
To: Viktor Malik
Cc: bpf, ast, daniel, andrii, martin.lau, eddyz87, song,
yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa,
mykolal, shuah, memxor
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Thu, 7 Nov 2024 12:52:31 +0100 you wrote:
> 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:FAIL
>
> [...]
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-11-09 20:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-07 11:52 [PATCH bpf-next] selftests/bpf: skip the timer_lockup test for single-CPU nodes Viktor Malik
2024-11-08 4:41 ` Philo Lu
2024-11-09 20:06 ` Kumar Kartikeya Dwivedi
2024-11-09 20:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox