netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/4] Mixing bpf2bpf and tailcalls for RV64
@ 2023-09-19  3:57 Pu Lehui
  2023-09-19  3:57 ` [PATCH bpf-next 1/4] riscv, bpf: Remove redundant ctx->offset initialization Pu Lehui
                   ` (4 more replies)
  0 siblings, 5 replies; 21+ messages in thread
From: Pu Lehui @ 2023-09-19  3:57 UTC (permalink / raw)
  To: bpf, linux-riscv, netdev
  Cc: Björn Töpel, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Palmer Dabbelt, Conor Dooley, Luke Nelson, Pu Lehui, Pu Lehui

In the current RV64 JIT, if we just don't initialize the TCC in subprog,
the TCC can be propagated from the parent process to the subprocess, but
the TCC of the parent process cannot be restored when the subprocess
exits. Since the RV64 TCC is initialized before saving the callee saved
registers into the stack, we cannot use the callee saved register to
pass the TCC, otherwise the original value of the callee saved register
will be destroyed. So we implemented mixing bpf2bpf and tailcalls
similar to x86_64, i.e. using a non-callee saved register to transfer
the TCC between functions, and saving that register to the stack to
protect the TCC value. At the same time, we also consider the scenario
of mixing trampoline.

In addition, some code cleans are also attached to this patchset.

Tests test_bpf.ko and test_verifier have passed, as well as the relative
testcases of test_progs*.

Pu Lehui (4):
  riscv, bpf: Remove redundant ctx->offset initialization
  riscv, bpf: Using kvcalloc to allocate cache buffer
  riscv, bpf: Add RV_TAILCALL_OFFSET macro to format tailcall offset
  riscv, bpf: Mixing bpf2bpf and tailcalls

 arch/riscv/net/bpf_jit.h        |   1 +
 arch/riscv/net/bpf_jit_comp64.c | 104 ++++++++++++++------------------
 arch/riscv/net/bpf_jit_core.c   |   9 +--
 3 files changed, 48 insertions(+), 66 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-01-31  9:19 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-19  3:57 [PATCH bpf-next 0/4] Mixing bpf2bpf and tailcalls for RV64 Pu Lehui
2023-09-19  3:57 ` [PATCH bpf-next 1/4] riscv, bpf: Remove redundant ctx->offset initialization Pu Lehui
2023-09-19  3:57 ` [PATCH bpf-next 2/4] riscv, bpf: Using kvcalloc to allocate cache buffer Pu Lehui
2023-09-19  3:57 ` [PATCH bpf-next 3/4] riscv, bpf: Add RV_TAILCALL_OFFSET macro to format tailcall offset Pu Lehui
2023-09-19  3:57 ` [PATCH bpf-next 4/4] riscv, bpf: Mixing bpf2bpf and tailcalls Pu Lehui
2023-09-19 10:04   ` Conor Dooley
2023-09-19 10:54     ` Conor Dooley
2023-09-19 11:23     ` Pu Lehui
2023-09-19 11:50       ` Conor Dooley
2023-09-19 12:01         ` Pu Lehui
2023-09-28  9:59   ` Björn Töpel
2023-09-28 10:39     ` Pu Lehui
2024-01-16 14:21     ` Pu Lehui
2024-01-30  8:29       ` Björn Töpel
2024-01-30  9:14         ` Pu Lehui
2024-01-30 13:28           ` Björn Töpel
2024-01-30 14:10             ` Pu Lehui
2024-01-30 16:03               ` Björn Töpel
2024-01-31  9:18                 ` Pu Lehui
2024-01-30  3:26   ` Pu Lehui
2023-09-26 13:30 ` [PATCH bpf-next 0/4] Mixing bpf2bpf and tailcalls for RV64 Björn Töpel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).