Skip to content

RISC-V JIT support for bpf_get_current_task/_btf

Varun R Mallya bpf linux-kselftest linux-riscv lkml 1 version Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesApplied 2/2

Patches in v1 All 2 applied

#Subject and filesSizeRepliesApplied
1/2selftests/bpf: use host CPU features in JIT disassemblertools/testing/selftests/bpf/jit_disasm_helpers.c+11 -21 replyApplied
2/2bpf, riscv: inline bpf_get_current_task() and bpf_get_current_task_btf()arch/riscv/net/bpf_jit_comp64.c tools/testing/selftests/bpf/progs/verifier_jit_inline.c+11 -01 replyApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchBjörn Töpel
1/2R-b
2/2A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH bpf-next 0/2] RISC-V JIT support for bpf_get_current_task/_btf

These two patches add support for the bpf_get_current_task and bpf_get_current_task_btf kfuncs in RISC-V JIT and add a selftest.

The first patch adds support for cpu and feature detection on the JIT disassembly helper function as RISC-V JITed code was not being disassembled using LLVMCreateDisasm as it was missing the "+c" CPU feature and JITed code contained RISC-V Compressed (C) Extension. This patch generalizes that to detect CPU features and enables testing on more RISC-V JIT work ahead.

The second patch, which actually adds this support has been benchmarked on QEMU RISC-V and shows significant improvements.
It was benchmarked using a simple loop inside a bpf program that ran bpf_get_current_task() and execution time was measured. It used bpf_prog_test_run_opts() to repeatedly trigger the BPF program. The loop ran in 1 second intervals and it kept firing bpf_prog_test_run_opts() as fast as possible until a second had elapsed and then reported statistics.

Varun R Mallya (2):
selftests/bpf: use host CPU features in JIT disassembler bpf, riscv: inline bpf_get_current_task() and
bpf_get_current_task_btf()

 arch/riscv/net/bpf_jit_comp64.c                     |  9 +++++++++
 tools/testing/selftests/bpf/jit_disasm_helpers.c    | 13 +++++++++++--
 .../selftests/bpf/progs/verifier_jit_inline.c       |  2 ++
 3 files changed, 22 insertions(+), 2 deletions(-)
Signature · 1 line
2.54.0