Re: [PATCH] Change stack_skip to 3

Nick Alcock <[email protected]> Fri, 23 Jan 2026 19:05:57 +0000
Newsgroups dev.linux.lists.dtrace
Message-ID <[email protected]>
On 21 Jan 2026, eugene loh told this:

> From: Eugene Loh <[email protected]>
>
> For most probes, bpf_get_stack() strips off artificial BPF JIT stack
> frames.  In a few cases -- like fprobes and rawtp -- we have to skip
> the first few frames manually.  Typically, we should skip 3 frames
> (trampoline, clause, and the bpf_get_stack call itself).  Further,
> our BPF functions like
>     get_bvar_caller()
>     get_bvar_stackdepth()
>     get_bvar_ucaller()
>     get_bvar_ustackdepth()
> skip an additional frame to account for that call.
>
> Change stack_skip to 3 for the dt_fbt_fprobe and dt_rawtp providers.
>
> This raises the thorny question of testing.  Until recently, the
> stack_skip value we had been using -- 4, not 3 -- worked since it was
> chosen empirically:  there was a bug in the kernel that added an extra
> frame.  But now, the kernel situation is muddled.  The bug has been
> fixed in recent kernels, but only for x86.  See
>
> https://github.com/torvalds/linux/commit/6d08340d1e354787d6c65a8c3cdd4d41ffb8a5ed
> Revert "perf/x86: Always store regs->ip in perf_callchain_kernel()"
>
> A broader fix, for non-x86, is also expected.  See the thread that
> starts at:
> https://lore.kernel.org/all/[email protected]/
>
> So, for now, XFAIL tests on "unfixed" (older) kernels.
>
> Orabug: 38776929
> Signed-off-by: Eugene Loh <[email protected]>

Reviewed-by: Nick Alcock <[email protected]>

(verified that it fixes these tests and doesn't break older kernels,
which XFAIL with the appropriate message.)

-- 
NULL && (void)