[PATCH bpf-next v6 0/7] Mixing bpf2bpf and tailcalls for RV64
Pu Lehui
pulehui at huaweicloud.com
Tue Jul 21 20:05:04 PDT 2026
On 2026/7/22 2:30, patchwork-bot+netdevbpf at kernel.org wrote:
> Hello:
>
> This series was applied to bpf/bpf-next.git (master)
> by Kumar Kartikeya Dwivedi <memxor at gmail.com>:
>
> On Wed, 8 Jul 2026 06:44:29 +0000 you wrote:
>> 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 updated 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. As for the tailcall hierarchy issue,
>> inspired by the s390's low-overhead approach, we store TCC from
>> RV_REG_TCC back to stack after calling bpf2bpf call or calling orig bpf
>> func in bpf trampoline.
>>
>> [...]
>
> Here is the summary with links:
> - [bpf-next,v6,1/7] bpf: Extract the is_struct_ops_tramp helper
> https://git.kernel.org/bpf/bpf-next/c/6bcecae4b65d
> - [bpf-next,v6,2/7] riscv, bpf: Fix memory leak in bpf_jit_free
> https://git.kernel.org/bpf/bpf-next/c/369e4635d048
> - [bpf-next,v6,3/7] riscv, bpf: Using kvzalloc_objs to allocate cache buffer
> https://git.kernel.org/bpf/bpf-next/c/f3ab878594b5
> - [bpf-next,v6,4/7] riscv, bpf: Fix kernel stack corruption in tailcall with CFI
> https://git.kernel.org/bpf/bpf-next/c/52fb1756ea1d
> - [bpf-next,v6,5/7] riscv, bpf: Add RV_TAILCALL_OFFSET macro to format tailcall offset
> https://git.kernel.org/bpf/bpf-next/c/a21731f54cfe
> - [bpf-next,v6,6/7] riscv, bpf: Mixing bpf2bpf and tailcalls
> https://git.kernel.org/bpf/bpf-next/c/ec72848ca0ad
> - [bpf-next,v6,7/7] selftests/bpf: Remove tailcalls tests from DENYLIST.riscv64
> https://git.kernel.org/bpf/bpf-next/c/683ed8b78c1d
>
> You are awesome, thank you!
Finally got this covered, what a long journey...
But it looks like bpf selftests in riscv is pretty unhappy now.😅
If anyone has some spare cycles, it'd be awesome if we could figure
these out together.:)
More information about the linux-riscv
mailing list