Skip to content

Commit f4bcb3f

Browse files
author
CKI KWF Bot
committed
Merge: selftests/bpf: Fix arena_spin_lock selftest failure
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1666 JIRA: https://issues.redhat.com/browse/RHEL-113809 Backport a9d4e9f ("selftests/bpf: Fix arena_spin_lock selftest failure") Signed-off-by: iqian <iqian@redhat.com> Approved-by: Gregory Bell <grbell@redhat.com> Approved-by: Jerome Marchand <jmarchan@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 2c6ad34 + 4610a1b commit f4bcb3f

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,13 @@ static void *spin_lock_thread(void *arg)
4040

4141
err = bpf_prog_test_run_opts(prog_fd, &topts);
4242
ASSERT_OK(err, "test_run err");
43+
44+
if (topts.retval == -EOPNOTSUPP)
45+
goto end;
46+
4347
ASSERT_EQ((int)topts.retval, 0, "test_run retval");
4448

49+
end:
4550
pthread_exit(arg);
4651
}
4752

@@ -63,6 +68,7 @@ static void test_arena_spin_lock_size(int size)
6368
skel = arena_spin_lock__open_and_load();
6469
if (!ASSERT_OK_PTR(skel, "arena_spin_lock__open_and_load"))
6570
return;
71+
6672
if (skel->data->test_skip == 2) {
6773
test__skip();
6874
goto end;
@@ -86,6 +92,13 @@ static void test_arena_spin_lock_size(int size)
8692
goto end_barrier;
8793
}
8894

95+
if (skel->data->test_skip == 3) {
96+
printf("%s:SKIP: CONFIG_NR_CPUS exceed the maximum supported by arena spinlock\n",
97+
__func__);
98+
test__skip();
99+
goto end_barrier;
100+
}
101+
89102
ASSERT_EQ(skel->bss->counter, repeat * nthreads, "check counter value");
90103

91104
end_barrier:

tools/testing/selftests/bpf/progs/arena_spin_lock.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ int prog(void *ctx)
3737
#if defined(ENABLE_ATOMICS_TESTS) && defined(__BPF_FEATURE_ADDR_SPACE_CAST)
3838
unsigned long flags;
3939

40-
if ((ret = arena_spin_lock_irqsave(&lock, flags)))
40+
if ((ret = arena_spin_lock_irqsave(&lock, flags))) {
41+
if (ret == -EOPNOTSUPP)
42+
test_skip = 3;
4143
return ret;
44+
}
4245
if (counter != limit)
4346
counter++;
4447
bpf_repeat(cs_count);

0 commit comments

Comments
 (0)