[RFC PATCH RESEND bpf-next 0/4] Support bpf trampoline for RV64

Pu Lehui posted 4 patches 2 years, 9 months ago
There is a newer version of this series
arch/riscv/net/bpf_jit.h        |   5 +
arch/riscv/net/bpf_jit_comp64.c | 483 ++++++++++++++++++++++++++++++--
kernel/bpf/trampoline.c         |   8 +-
3 files changed, 471 insertions(+), 25 deletions(-)
[RFC PATCH RESEND bpf-next 0/4] Support bpf trampoline for RV64
Posted by Pu Lehui 2 years, 9 months ago
BPF trampoline is the critical infrastructure of the bpf
subsystem, acting as a mediator between kernel functions
and BPF programs. Numerous important features, such as
using ebpf program for zero overhead kernel introspection,
rely on this key component. We can't wait to support bpf
trampoline on RV64. The implementation of bpf trampoline
was closely to x86 and arm64 for future development.

As most of riscv cpu support unaligned memory accesses,
we temporarily use patch [1] to facilitate testing. The
test results are as follow, and test_verifier with no
new failure ceses.

- fexit_test:OK
- fentry_test:OK
- fentry_fexit:OK
- fexit_stress:OK
- fexit_bpf2bpf:OK
- dummy_st_ops:OK
- modify_return:OK
- get_func_ip_test:OK
- get_func_args_test:OK
- trampoline_count:OK

[1] https://lore.kernel.org/linux-riscv/20210916130855.4054926-2-chenhuang5@huawei.com/

Pu Lehui (4):
  bpf: Rollback to text_poke when arch not supported ftrace direct call
  riscv, bpf: Factor out emit_call for kernel and bpf context
  riscv, bpf: Add bpf_arch_text_poke support for RV64
  riscv, bpf: Add bpf trampoline support for RV64

 arch/riscv/net/bpf_jit.h        |   5 +
 arch/riscv/net/bpf_jit_comp64.c | 483 ++++++++++++++++++++++++++++++--
 kernel/bpf/trampoline.c         |   8 +-
 3 files changed, 471 insertions(+), 25 deletions(-)

-- 
2.25.1
Re: [RFC PATCH RESEND bpf-next 0/4] Support bpf trampoline for RV64
Posted by Björn Töpel 2 years, 8 months ago
Pu Lehui <pulehui@huaweicloud.com> writes:

> BPF trampoline is the critical infrastructure of the bpf
> subsystem, acting as a mediator between kernel functions
> and BPF programs. Numerous important features, such as
> using ebpf program for zero overhead kernel introspection,
> rely on this key component. We can't wait to support bpf
> trampoline on RV64. The implementation of bpf trampoline
> was closely to x86 and arm64 for future development.

Thank you for working on this! BPF trampoline is the "missing piece"
from getting proper kfunc support.

Unfortunately, I wont be able to do a proper review until next week.


Happy holidays,
Björn
Re: [RFC PATCH RESEND bpf-next 0/4] Support bpf trampoline for RV64
Posted by Pu Lehui 2 years, 8 months ago

On 2022/12/22 21:00, Björn Töpel wrote:
> Pu Lehui <pulehui@huaweicloud.com> writes:
> 
>> BPF trampoline is the critical infrastructure of the bpf
>> subsystem, acting as a mediator between kernel functions
>> and BPF programs. Numerous important features, such as
>> using ebpf program for zero overhead kernel introspection,
>> rely on this key component. We can't wait to support bpf
>> trampoline on RV64. The implementation of bpf trampoline
>> was closely to x86 and arm64 for future development.
> 
> Thank you for working on this! BPF trampoline is the "missing piece"
> from getting proper kfunc support.
> 
> Unfortunately, I wont be able to do a proper review until next week.
> 

Take your time, it might take several rounds of optimization. Yep, riscv 
bpf will look more complete when bpf trampoline and kfunc are supported.

Anyway, have a nice christmas holidays.😄

Lehui

> 
> Happy holidays,
> Björn