Skip to content

Commit 6c1f7f0

Browse files
66542erostedt
authored andcommitted
ftrace: Hide one more entry in stack trace when ftrace_pid is enabled
On setting set_ftrace_pid, a extra entry generated by ftrace_pid_func() is shown on stack trace(CONFIG_UNWINDER_FRAME_POINTER=y). [004] ..... 68.459382: <stack trace> => 0xffffffffa00090af => ksys_read => __x64_sys_read => x64_sys_call => do_syscall_64 => entry_SYSCALL_64_after_hwframe To resolve this issue, increment skip count in function_stack_trace_call() if pids are set. Link: https://lore.kernel.org/linux-trace-kernel/[email protected] Signed-off-by: Tatsuya S <[email protected]> [ Rebased to current tree ] Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 4057fd2 commit 6c1f7f0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

kernel/trace/trace_functions.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ function_stack_trace_call(unsigned long ip, unsigned long parent_ip,
231231
long disabled;
232232
int cpu;
233233
unsigned int trace_ctx;
234+
int skip = STACK_SKIP;
234235

235236
if (unlikely(!tr->function_enabled))
236237
return;
@@ -247,7 +248,11 @@ function_stack_trace_call(unsigned long ip, unsigned long parent_ip,
247248
if (likely(disabled == 1)) {
248249
trace_ctx = tracing_gen_ctx_flags(flags);
249250
trace_function(tr, ip, parent_ip, trace_ctx);
250-
__trace_stack(tr, trace_ctx, STACK_SKIP);
251+
#ifdef CONFIG_UNWINDER_FRAME_POINTER
252+
if (ftrace_pids_enabled(op))
253+
skip++;
254+
#endif
255+
__trace_stack(tr, trace_ctx, skip);
251256
}
252257

253258
atomic_dec(&data->disabled);

0 commit comments

Comments
 (0)