Re: [RFC PATCH bpf-next 00/12] bpf: Introduce static-defined tracing probe for BPF
From: Xu Kuohai
Date: Mon Jun 29 2026 - 07:37:42 EST
On 6/29/2026 6:55 PM, Leon Hwang wrote:
On 29/6/26 15:51, Xu Kuohai wrote:
So, why not add a macro for the stub following the subprog+fentry idea?
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.
#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.
Since the stub prog is dropped in libbpf, where is the fentry prog attached?
Thanks,
Leon