Re: [RFC PATCH bpf-next 00/12] bpf: Introduce static-defined tracing probe for BPF
From: Leon Hwang
Date: Mon Jun 29 2026 - 07:01:26 EST
On 29/6/26 15:51, Xu Kuohai wrote:
>>
>> With the elimination, the callsite of 'subprog' has been eliminated.
>>
>> However, as you mentioned above, the argument preparation insns are kept.
>>
>
> I see, the CALL insntruction is removed, not patched to NOP.
>
> So the call site is either a call to subprog, or totally removed. The
> fentry
> tracing only works when the CALL instruction and the subprog are not
> eliminated.
> This is exactly what SDT tries to solve.
>
So, why not add a macro for the stub following the subprog+fentry idea?
#define DEFINE_TRACING_STUB(__stub, ...) \
static __noinline void __stub(...) \
{ \
... \
}
DEFINE_TRACING_STUB(my_trace, int, len, int, ret);
SEC("xdp")
int xdp_prog(struct xdp_md *ctx)
{
...
my_trace(len, ret);
...
}
Then, add a libbpf API bpf_program__remove_stub(prog, my_stub) to drop
the stub by the way like my demo.
Thanks,
Leon