mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 0/2] LoongArch: BPF: per-CPU addr MOV and timed may_goto
@ 2026-06-09  4:14 George Guo
  2026-06-09  4:14 ` [PATCH v1 1/2] LoongArch: BPF: Support internal-only MOV to resolve per-CPU addrs George Guo
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: George Guo @ 2026-06-09  4:14 UTC (permalink / raw)
  To: Huacai Chen, Tiezhu Yang, Hengqi Chen
  Cc: WANG Xuerui, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman,
	Kumar Kartikeya Dwivedi, Song Liu, Yonghong Song, Jiri Olsa,
	loongarch, bpf, linux-kernel, George Guo

From: George Guo <guodongtai@kylinos.cn>

This series enables two independent BPF JIT features on LoongArch, each
advertised to the verifier via the corresponding bpf_jit_supports_*()
hook:

Patch 1 implements the internal-only BPF_MOV that resolves a per-CPU
address from its per-CPU offset. LoongArch keeps the current CPU's
per-CPU offset in $r21 (__my_cpu_offset), so the resolution is a single
add of $r21 to the source register. This is used by verifier/JIT
inlining (e.g. bpf_get_smp_processor_id() and per-CPU map lookups) and
is not exposed to BPF users.

Patch 2 implements arch_bpf_timed_may_goto() (in a small assembly stub
with a custom calling convention passing the count/timestamp slot offset
in BPF_REG_AX) and advertises it, so the verifier lowers may_goto into
the timed, wall-clock-bounded variant instead of a fixed iteration
counter.

Tested on a LoongArch (Loongson-3A5000) QEMU/KVM guest with
CONFIG_PAGE_SIZE_16KB and CONFIG_UNWINDER_ORC:
 - patch 1: test_progs cpumask and percpu map cases pass;
 - patch 2: test_progs iters (incl. the cond_break / may_goto loop
   cases) all pass.

George Guo (2):
  LoongArch: BPF: Support internal-only MOV to resolve per-CPU addrs
  LoongArch: BPF: Add timed may_goto support

 arch/loongarch/include/asm/inst.h       |  1 +
 arch/loongarch/net/Makefile             |  2 +-
 arch/loongarch/net/bpf_jit.c            | 27 ++++++++++++++-
 arch/loongarch/net/bpf_timed_may_goto.S | 44 +++++++++++++++++++++++++
 4 files changed, 72 insertions(+), 2 deletions(-)
 create mode 100644 arch/loongarch/net/bpf_timed_may_goto.S

-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-06-15  9:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-09  4:14 [PATCH v1 0/2] LoongArch: BPF: per-CPU addr MOV and timed may_goto George Guo
2026-06-09  4:14 ` [PATCH v1 1/2] LoongArch: BPF: Support internal-only MOV to resolve per-CPU addrs George Guo
2026-06-09  4:14 ` [PATCH v1 2/2] LoongArch: BPF: Add timed may_goto support George Guo
2026-06-13  3:09 ` [PATCH v1 0/2] LoongArch: BPF: per-CPU addr MOV and timed may_goto Huacai Chen
2026-06-15  9:08   ` Tiezhu Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome