mbox series

[bpf-next,0/3] Add RISC-V (RV64G) BPF JIT

Message ID 20190203115132.8766-1-bjorn.topel@gmail.com (mailing list archive)
Headers show
Series Add RISC-V (RV64G) BPF JIT | expand

Message

Björn Töpel Feb. 3, 2019, 11:51 a.m. UTC
From: Björn Töpel <bjorn.topel@gmail.com>

Hi!

This series adds an RV64G BPF JIT to the kernel. I've sent out a RFC
for a couple of weeks ago, and think this code is
feature-complete/stable enough (famous last words) for a proper patch.

Unfortunately, kprobes isn't supported by RISC-V yet (Patrick Stählin
sent out an RFC last year), which means that all tests involving
BPF_PROG_TYPE_TRACEPOINT, BPF_PROG_TYPE_PERF_EVENT,
BPF_PROG_TYPE_KPROBE and BPF_PROG_TYPE_RAW_TRACEPOINT will fail.

Further, the implementation does not support "far branching" (>4KiB).
    
The implementation passes all the test_bpf.ko tests: test_bpf:
    Summary: 378 PASSED, 0 FAILED, [366/366 JIT'ed]
    
All the tail_call tests in the selftest/bpf/test_verifier program
passes.
    
All tests where done on QEMU emulator version 3.1.50
(v3.1.0-688-g8ae951fbc106). I'll test it on real hardware, when I get
access to it.

I'm routing this patch via bpf-next/netdev mailing list (after a
conversation with Palmer at FOSDEM), mainly because the other JITs
went that path.

Thanks for all the comments!

Cheers,
Björn

RFCv1 -> v1:
* Cleaned up the Kconfig and net/Makefile. (Christoph)
* Removed the entry-stub and squashed the build/config changes to be
  part of the JIT implementation. (Christoph)
* Simplified the register tracking code. (Daniel)
* Removed unused macros. (Daniel)
* Added myself as maintainer and updated documentation. (Daniel)
* Removed HAVE_EFFICIENT_UNALIGNED_ACCESS. (Christoph, Palmer)
* Added tail-calls and cleaned up the code.



Björn Töpel (3):
  bpf, riscv: add BPF JIT for RV64G
  MAINTAINERS: add RISC-V BPF JIT maintainer
  bpf, doc: add RISC-V to filter.txt

 Documentation/networking/filter.txt |   16 +-
 MAINTAINERS                         |    6 +
 arch/riscv/Kconfig                  |    1 +
 arch/riscv/Makefile                 |    2 +-
 arch/riscv/net/Makefile             |    1 +
 arch/riscv/net/bpf_jit_comp.c       | 1502 +++++++++++++++++++++++++++
 6 files changed, 1520 insertions(+), 8 deletions(-)
 create mode 100644 arch/riscv/net/Makefile
 create mode 100644 arch/riscv/net/bpf_jit_comp.c