OSDN Git Service

riscv, bpf: Adapt bpf trampoline to optimized riscv ftrace framework
authorPu Lehui <pulehui@huawei.com>
Fri, 21 Jul 2023 10:06:27 +0000 (18:06 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 2 Aug 2023 21:03:56 +0000 (14:03 -0700)
commit25ad10658dc1068a671553ff10e19a812c2a3783
tree878a2da2472ca097e1ddbd6c87b25ca5c0b94167
parent94e38c956b97d3bb3f6cc8215efb13ea851e3a91
riscv, bpf: Adapt bpf trampoline to optimized riscv ftrace framework

Commit 6724a76cff85 ("riscv: ftrace: Reduce the detour code size to
half") optimizes the detour code size of kernel functions to half with
T0 register and the upcoming DYNAMIC_FTRACE_WITH_DIRECT_CALLS of riscv
is based on this optimization, we need to adapt riscv bpf trampoline
based on this. One thing to do is to reduce detour code size of bpf
programs, and the second is to deal with the return address after the
execution of bpf trampoline. Meanwhile, we need to construct the frame
of parent function, otherwise we will miss one layer when unwinding.
The related tests have passed.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
Tested-by: Björn Töpel <bjorn@rivosinc.com>
Link: https://lore.kernel.org/r/20230721100627.2630326-1-pulehui@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
arch/riscv/net/bpf_jit_comp64.c