From: sashiko-bot@kernel.org
To: "George Guo" <dongtai.guo@linux.dev>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v1 5/5] selftests/bpf: Enable arena atomics tests for LoongArch
Date: Thu, 26 Nov 2026 06:06:01 +0000 [thread overview]
Message-ID: <sashiko-outbox-234823@kernel.org> (raw)
In-Reply-To: <20261126055355.9967-6-dongtai.guo@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] selftests/bpf: arena atomics enabled on LoongArch without JIT
support
--
commit 981cacb8f524da5a2f9e574371d2773a0e55c40e
Author: George Guo <guodongtai@kylinos.cn>
selftests/bpf: Enable arena atomics tests for LoongArch
This commit enables the load-acquire and store-release arena atomics
selftests, as well as the libarena parallel bitmap and spmc selftests, on
LoongArch.
> diff --git a/tools/testing/selftests/bpf/libarena/selftests/test_parallel_bitmap.bpf.c b/tools/testing/selftests/bpf/libarena/selftests/test_parallel_bitmap.bpf.c
> index 017add229befe..722971b1eba8f 100644
> --- a/tools/testing/selftests/bpf/libarena/selftests/test_parallel_bitmap.bpf.c
> +++ b/tools/testing/selftests/bpf/libarena/selftests/test_parallel_bitmap.bpf.c
> @@ -24,6 +24,7 @@ static volatile bool test_abort;
> (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \
> defined(__TARGET_ARCH_s390) || \
> defined(__TARGET_ARCH_powerpc) || \
> + defined(__TARGET_ARCH_loongarch) || \
> (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64))
> static bool bitmap_tests_enabled(void)
> {
> diff --git a/tools/testing/selftests/bpf/libarena/selftests/test_parallel_spmc.bpf.c b/tools/testing/selftests/bpf/libarena/selftests/test_parallel_spmc.bpf.c
> index 5fa96eb740951..af577e1e50508 100644
> --- a/tools/testing/selftests/bpf/libarena/selftests/test_parallel_spmc.bpf.c
> +++ b/tools/testing/selftests/bpf/libarena/selftests/test_parallel_spmc.bpf.c
> @@ -70,6 +70,7 @@ static volatile u64 round_steals;
> */
> #if defined(ENABLE_ATOMICS_TESTS) && \
> (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \
> + defined(__TARGET_ARCH_loongarch) || \
> (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64))
> static bool spmc_tests_enabled(void)
> {
> diff --git a/tools/testing/selftests/bpf/progs/arena_atomics.c b/tools/testing/selftests/bpf/progs/arena_atomics.c
> index 2a9664f543993..fcb70b9844346 100644
> --- a/tools/testing/selftests/bpf/progs/arena_atomics.c
> +++ b/tools/testing/selftests/bpf/progs/arena_atomics.c
> @@ -30,6 +30,7 @@ bool skip_all_tests = true;
> defined(__BPF_FEATURE_ADDR_SPACE_CAST) && \
> (defined(__TARGET_ARCH_arm64) || \
> defined(__TARGET_ARCH_x86) || \
> + defined(__TARGET_ARCH_loongarch) || \
> (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \
> defined(__TARGET_ARCH_s390))
> bool skip_lacq_srel_tests __attribute((__section__(".data"))) = false;
> @@ -454,6 +455,7 @@ int load_acquire(const void *ctx)
> defined(__BPF_FEATURE_ADDR_SPACE_CAST) && \
> (defined(__TARGET_ARCH_arm64) || \
> defined(__TARGET_ARCH_x86) || \
> + defined(__TARGET_ARCH_loongarch) || \
> (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \
> defined(__TARGET_ARCH_s390))
>
> @@ -508,6 +510,7 @@ int store_release(const void *ctx)
> defined(__BPF_FEATURE_ADDR_SPACE_CAST) && \
> (defined(__TARGET_ARCH_arm64) || \
> defined(__TARGET_ARCH_x86) || \
> + defined(__TARGET_ARCH_loongarch) || \
> (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \
> defined(__TARGET_ARCH_s390))
[Severity: Medium]
Does enabling these arena atomics tests on LoongArch fail verification and
program loading because the LoongArch BPF JIT does not yet support arena
atomics?
For atomic instructions targeting PTR_TO_ARENA, atomic_ptr_type_ok() in
kernel/bpf/verifier.c checks bpf_jit_supports_insn(insn, true):
kernel/bpf/verifier.c:atomic_ptr_type_ok() {
...
if (is_arena_reg(env, regno))
return bpf_jit_supports_insn(insn, true);
...
}
arch/loongarch/net/bpf_jit.c does not implement bpf_jit_supports_insn(), so
LoongArch falls back to the weak default in kernel/bpf/core.c that returns
false, causing the verifier to reject any BPF_ATOMIC instruction on an
arena pointer with -EACCES.
In addition, do_misc_fixups() in kernel/bpf/fixups.c rewrites atomic
instructions on PTR_TO_ARENA to BPF_STX | BPF_PROBE_ATOMIC |
BPF_SIZE(insn->code), which build_insn() in arch/loongarch/net/bpf_jit.c
does not handle.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261126055355.9967-1-dongtai.guo@linux.dev?part=5
next prev parent reply other threads:[~2026-11-26 6:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 5:53 [PATCH bpf-next v1 0/5] selftests/bpf: Enable private stack, large stack and arena tests for LoongArch George Guo
2026-11-26 5:53 ` [PATCH bpf-next v1 1/5] selftests/bpf: Use unsigned loop counter in test_buddy_alloc_free George Guo
2026-11-26 5:53 ` [PATCH bpf-next v1 2/5] selftests/bpf: Enable 2 KiB private stack test for LoongArch George Guo
2026-11-26 6:04 ` sashiko-bot
2026-11-26 5:53 ` [PATCH bpf-next v1 3/5] selftests/bpf: Enable struct_ops private stack tests " George Guo
2026-11-26 6:05 ` sashiko-bot
2026-11-26 5:53 ` [PATCH bpf-next v1 4/5] selftests/bpf: Enable arena LDSX " George Guo
2026-11-26 6:03 ` sashiko-bot
2026-11-26 5:53 ` [PATCH bpf-next v1 5/5] selftests/bpf: Enable arena atomics " George Guo
2026-11-26 6:06 ` sashiko-bot [this message]
2026-11-26 6:06 ` [PATCH bpf-next v1 0/5] selftests/bpf: Enable private stack, large stack and arena " Alexei Starovoitov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-234823@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dongtai.guo@linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox