LoongArch: BPF: per-CPU address resolution and timed may_goto
Status from this message: Applied, thanks.
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest2 patches 4 repliesApplied
- v12 patches 2 repliesSuperseded
Patches in v3 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | LoongArch: BPF: Support internal-only MOV to resolve per-CPU addrsarch/ arch/ | +15 | 0 replies | |
| 2/2 | LoongArch: BPF: Add timed may_goto supportarch/ arch/ arch/ | +60 | 0 replies |
Reviews trailers per patch
None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Tiezhu Yang |
|---|---|
| Series | A-b T-b |
| 1/2 | |
| 2/2 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 0/2] LoongArch: BPF: per-CPU address resolution and timed may_goto
These are the first two patches of the LoongArch BPF JIT feature work, sent on their own to make review easier. The remaining pieces (per-program private stacks, exceptions/bpf_throw, sign-extending loads and atomics on arena pointers, and the matching selftests) will follow in a later series.
Both patches are independent of each other. They apply on top of Chenguang Zhao's "LoongArch bpf kptr xchg inline support" v4 series:
https://lore.kernel.org/all/[email protected]/
Patch 1 adds the internal-only BPF MOV that resolves a per-CPU offset to the current CPU's address, advertised through bpf_jit_supports_percpu_insn(). LoongArch keeps the current CPU's per-CPU base in $r21 (__my_cpu_offset), so the resolution is a single add. Exercised by the cpumask and percpu_alloc selftests.
Patch 2 implements arch_bpf_timed_may_goto() and advertises it, so the verifier lowers may_goto to its timed variant, which bounds the loop by a wall-clock timeout kept in a per-loop stack slot. It uses a custom calling
convention: the count/timestamp stack offset is passed in BPF_REG_AX and returned there, so the JIT call path skips the usual "BPF_REG_0 = return value" move for this helper. Exercised by the iters selftests.
Selftest results (all PASS):
Feature Test(s)
--------------------------------------------------------------
1 internal-only MOV (percpu) cpumask, percpu_alloc 2 timed may_goto iters
$ sudo ./test_progs -t cpumask ... Summary: 1/35 PASSED, 0 SKIPPED, 0 FAILED
$ sudo ./test_progs -t percpu_alloc ... Summary: 1/18 PASSED, 0 SKIPPED, 0 FAILED
$ sudo ./test_progs -t iters ... Summary: 1/93 PASSED, 0 SKIPPED, 0 FAILED
Based on loongarch-next:
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson.git/log/?h=loongarch-next
These two patches are split from the full v2 series (11 patches):
https://lore.kernel.org/all/[email protected]/
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 | 47 +++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 arch/loongarch/net/bpf_timed_may_goto.S
Signature · 1 line
2.53.0