From: sashiko-bot@kernel.org
To: "George Guo" <dongtai.guo@linux.dev>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v1 4/5] selftests/bpf: Enable arena LDSX tests for LoongArch
Date: Thu, 26 Nov 2026 06:03:58 +0000 [thread overview]
Message-ID: <sashiko-outbox-234818@kernel.org> (raw)
In-Reply-To: <20261126055355.9967-5-dongtai.guo@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] selftests/bpf: arena LDSX tests enabled on LoongArch without
JIT support
--
commit b68bf732b641a949e70ea34125906397162f4821
Author: George Guo <guodongtai@kylinos.cn>
selftests/bpf: Enable arena LDSX tests for LoongArch
This commit enables the arena signed-load tests in verifier_ldsx on
LoongArch and adds the expected LoongArch JIT disassembly for
arena_ldsx_disasm.
> diff --git a/tools/testing/selftests/bpf/progs/verifier_ldsx.c b/tools/testing/selftests/bpf/progs/verifier_ldsx.c
> index 232082428cb96..ad7ae015b39d9 100644
> --- a/tools/testing/selftests/bpf/progs/verifier_ldsx.c
> +++ b/tools/testing/selftests/bpf/progs/verifier_ldsx.c
> @@ -299,6 +299,19 @@ __jited("add t2, a0, s7")
> __jited("lh s4, 0x18(t2)")
> __jited("add t2, a0, s7")
> __jited("lb s4, 0x20(t2)")
> +__arch_loongarch
> +__jited("add.d $t2, $a5, $s6")
> +__jited("ld.w $s2, $t2, 16")
> +__jited("add.d $t2, $a5, $s6")
> +__jited("ld.h $s2, $t2, 24")
> +__jited("add.d $t2, $a5, $s6")
> +__jited("ld.b $s2, $t2, 32")
> +__jited("add.d $t2, $a0, $s6")
> +__jited("ld.w $s3, $t2, 16")
> +__jited("add.d $t2, $a0, $s6")
> +__jited("ld.h $s3, $t2, 24")
> +__jited("add.d $t2, $a0, $s6")
> +__jited("ld.b $s3, $t2, 32")
> __naked void arena_ldsx_disasm(void *ctx)
> {
> asm volatile (
> @@ -331,6 +344,7 @@ __success __retval(0)
> __arch_x86_64
> __arch_arm64
> __arch_riscv64
> +__arch_loongarch
> __naked void arena_ldsx_exception(void *ctx)
> {
> asm volatile (
> @@ -353,6 +367,7 @@ __success __retval(-1)
> __arch_x86_64
> __arch_arm64
> __arch_riscv64
> +__arch_loongarch
> __naked void arena_ldsx_s8(void *ctx)
> {
> asm volatile (
> @@ -385,6 +400,7 @@ __success __retval(-1)
> __arch_x86_64
> __arch_arm64
> __arch_riscv64
> +__arch_loongarch
> __naked void arena_ldsx_s16(void *ctx)
> {
> asm volatile (
> @@ -417,6 +433,7 @@ __success __retval(-1)
> __arch_x86_64
> __arch_arm64
> __arch_riscv64
> +__arch_loongarch
> __naked void arena_ldsx_s32(void *ctx)
> {
> asm volatile (
[Severity: Medium]
Does enabling these five arena signed-load tests depend on a missing
LoongArch JIT patch?
In convert_ctx_accesses(), BPF_MEMSX loads on PTR_TO_ARENA require
bpf_jit_supports_insn(insn, true) to return true before rewriting the
instruction to BPF_PROBE_MEM32SX:
kernel/bpf/fixups.c:convert_ctx_accesses() {
...
case PTR_TO_ARENA:
if (BPF_MODE(insn->code) == BPF_MEMSX) {
if (!bpf_jit_supports_insn(insn, true)) {
verbose(env, "sign extending loads from arena are not supported yet\n");
return -EOPNOTSUPP;
}
insn->code = BPF_CLASS(insn->code) | BPF_PROBE_MEM32SX | BPF_SIZE(insn->code);
...
}
arch/loongarch/net/bpf_jit.c does not implement bpf_jit_supports_insn()
or handle BPF_PROBE_MEM32SX in build_insn() and add_exception_handler(),
so LoongArch falls back to the weak default bpf_jit_supports_insn() in
kernel/bpf/core.c that returns false. As a result, the verifier rejects
all five programs with -EOPNOTSUPP and verifier_ldsx fails on LoongArch
instead of skipping them.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261126055355.9967-1-dongtai.guo@linux.dev?part=4
next prev parent reply other threads:[~2026-11-26 6:03 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 [this message]
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
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-234818@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.