On Thu, Nov 7, 2024 at 5:46 AM Leon Hwang <leon.hwang@xxxxxxxxx> wrote: > > In x64 JIT, propagate tailcall info only for subprogs, not for helpers > or kfuncs. > > Acked-by: Yonghong Song <yonghong.song@xxxxxxxxx> > Signed-off-by: Leon Hwang <leon.hwang@xxxxxxxxx> > --- > arch/x86/net/bpf_jit_comp.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c > index 06b080b61aa57..eb08cc6d66401 100644 > --- a/arch/x86/net/bpf_jit_comp.c > +++ b/arch/x86/net/bpf_jit_comp.c > @@ -2124,10 +2124,11 @@ st: if (is_imm8(insn->off)) > > /* call */ > case BPF_JMP | BPF_CALL: { > + bool pseudo_call = src_reg == BPF_PSEUDO_CALL; > u8 *ip = image + addrs[i - 1]; > > func = (u8 *) __bpf_call_base + imm32; > - if (tail_call_reachable) { > + if (pseudo_call && tail_call_reachable) { > LOAD_TAIL_CALL_CNT_PTR(bpf_prog->aux->stack_depth); > ip += 7; > } I've applied this patch with this tweak: if (src_reg == BPF_PSEUDO_CALL && tail_call_reachable) I don't see much value in patch 2. The tail_call feature is an old approach. It is now causing maintenance issues with other features. I'd rather not touch anything tail call related. So I dropped patch 2. I'd like to see proper indirect goto and indirect call support being developed further. Anton started working on it, but dropped the ball. We need to commandeer the patches.