bpf, riscv: use prog pack allocator in the BPF JIT
authorPuranjay Mohan <puranjay12@gmail.com>
Thu, 31 Aug 2023 13:12:29 +0000 (13:12 +0000)
committerPalmer Dabbelt <palmer@rivosinc.com>
Wed, 6 Sep 2023 13:26:07 +0000 (06:26 -0700)
commit48a8f78c50bd6f7f08fd40daa62252fd043f2f18
treead26a3315aca1638541a551bfa8c097ece5acced
parentcad539baa48ff257b598000a90db2b7edd4b2dd5
bpf, riscv: use prog pack allocator in the BPF JIT

Use bpf_jit_binary_pack_alloc() for memory management of JIT binaries in
RISCV BPF JIT. The bpf_jit_binary_pack_alloc creates a pair of RW and RX
buffers. The JIT writes the program into the RW buffer. When the JIT is
done, the program is copied to the final RX buffer with
bpf_jit_binary_pack_finalize.

Implement bpf_arch_text_copy() and bpf_arch_text_invalidate() for RISCV
JIT as these functions are required by bpf_jit_binary_pack allocator.

Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
Reviewed-by: Song Liu <song@kernel.org>
Reviewed-by: Pu Lehui <pulehui@huawei.com>
Acked-by: Björn Töpel <bjorn@kernel.org>
Tested-by: Björn Töpel <bjorn@rivosinc.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/r/20230831131229.497941-5-puranjay12@gmail.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/net/bpf_jit.h
arch/riscv/net/bpf_jit_comp64.c
arch/riscv/net/bpf_jit_core.c