From: George Guo <dongtai.guo@linux.dev>
To: chenhuacai@kernel.org, yangtiezhu@loongson.cn, hengqi.chen@gmail.com
Cc: kernel@xen0n.name, ast@kernel.org, daniel@iogearbox.net,
andrii@kernel.org, martin.lau@linux.dev, eddyz87@gmail.com,
memxor@gmail.com, song@kernel.org, yonghong.song@linux.dev,
jolsa@kernel.org, shuah@kernel.org, loongarch@lists.linux.dev,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
linux-kselftest@vger.kernel.org,
George Guo <guodongtai@kylinos.cn>
Subject: [PATCH 0/5] LoongArch: BPF: arena instruction gating, private stack and exceptions
Date: Thu, 18 Jun 2026 11:38:04 +0800 [thread overview]
Message-ID: <20260618033809.98253-1-dongtai.guo@linux.dev> (raw)
From: George Guo <guodongtai@kylinos.cn>
This series adds three LoongArch BPF JIT features, plus the accompanying
selftest changes:
1. Gate the arena instructions the JIT does not implement (atomics and
sign-extending loads on arena pointers) via bpf_jit_supports_insn(),
so the verifier rejects such programs early with a clear message
instead of letting them fail late in the JIT.
2. Per-program private stack (bpf_jit_supports_private_stack()): the BPF
stack of deep/recursive tracing programs is moved off the kernel
stack into a per-CPU allocation bracketed by overflow/underflow
guards that are checked on teardown.
3. Exceptions / bpf_throw (bpf_jit_supports_exceptions()): unwind to the
exception boundary program via arch_bpf_stack_walk() (built on the
ORC unwinder) and reuse its frame in the exception callback. Gated on
CONFIG_UNWINDER_ORC.
Patches 4-5 are the selftests side: a LoongArch deny list (arena_atomics,
which patch 1 deliberately rejects) and enabling the struct_ops private
stack test on LoongArch. They touch tools/testing/selftests/bpf, hence the
bpf@vger / linux-kselftest Cc.
The series is independent of the earlier "LoongArch: BPF: Support
internal-only MOV to resolve per-CPU addrs" / "Add timed may_goto support"
patches [1] (no functional or apply dependency) and targets the LoongArch
tree.
Testing on a LoongArch board (test_progs):
- exceptions: 117 subtests, 0 failed
- struct_ops_private_stack: private_stack / _fail / _recur, 0 failed
- arena list/htab/strsearch and verifier_arena*: pass
- arena_atomics: rejected by the verifier as expected
("BPF_ATOMIC stores into Rn arena is not allowed"), hence the
deny-list entry in patch 4
[1] <https://lore.kernel.org/all/20260609041407.122384-1-dongtai.guo@linux.dev/>
George Guo (5):
LoongArch: BPF: Gate unsupported arena instructions via
bpf_jit_supports_insn()
LoongArch: BPF: Add private stack support
LoongArch: BPF: Add exceptions (bpf_throw) support
selftests/bpf: Add LoongArch deny list
selftests/bpf: Enable struct_ops private stack test for LoongArch
arch/loongarch/kernel/stacktrace.c | 52 ++++++
arch/loongarch/net/bpf_jit.c | 172 +++++++++++++++++-
arch/loongarch/net/bpf_jit.h | 1 +
.../testing/selftests/bpf/DENYLIST.loongarch | 2 +
.../bpf/prog_tests/struct_ops_private_stack.c | 2 +-
5 files changed, 222 insertions(+), 7 deletions(-)
create mode 100644 tools/testing/selftests/bpf/DENYLIST.loongarch
base-commit: 186d3c4e92242351afc24d9784f31cb4cd08a4b7
--
2.25.1
next reply other threads:[~2026-06-18 3:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-18 3:38 George Guo [this message]
2026-06-18 3:38 ` [PATCH 1/5] LoongArch: BPF: Gate unsupported arena instructions via bpf_jit_supports_insn() George Guo
2026-06-18 3:53 ` sashiko-bot
2026-06-18 4:19 ` bot+bpf-ci
2026-06-18 3:38 ` [PATCH 2/5] LoongArch: BPF: Add private stack support George Guo
2026-06-18 3:55 ` sashiko-bot
2026-06-18 3:38 ` [PATCH 3/5] LoongArch: BPF: Add exceptions (bpf_throw) support George Guo
2026-06-18 3:55 ` sashiko-bot
2026-06-18 3:38 ` [PATCH 4/5] selftests/bpf: Add LoongArch deny list George Guo
2026-06-18 3:52 ` sashiko-bot
2026-06-18 3:38 ` [PATCH 5/5] selftests/bpf: Enable struct_ops private stack test for LoongArch George Guo
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=20260618033809.98253-1-dongtai.guo@linux.dev \
--to=dongtai.guo@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=chenhuacai@kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=guodongtai@kylinos.cn \
--cc=hengqi.chen@gmail.com \
--cc=jolsa@kernel.org \
--cc=kernel@xen0n.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=yangtiezhu@loongson.cn \
--cc=yonghong.song@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.