From 5505be91c9413e52efcb37aea528d5699356e075 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Tue, 25 Aug 2026 19:10:36 -0400 Subject: [PATCH] ftrace: Have stacktrace option work with func-args When both the func_stack_trace option is enabled first, the func-args option can not be enabled. Same if the func-args option is enabled first, the func_stack_trace option can not be enabled. Allow the two to work together. The stack trace is already slow and testing the current tracer flags should be in the noise of overhead. Link: https://patch.msgid.link/20260825191036.11b19036@gandalf.local.home Signed-off-by: Steven Rostedt --- kernel/trace/trace_functions.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c index c879d43a5fbb..acaba990aaaa 100644 --- a/kernel/trace/trace_functions.c +++ b/kernel/trace/trace_functions.c @@ -121,6 +121,7 @@ static ftrace_func_t select_trace_function(u32 flags_val) case TRACE_FUNC_OPT_ARGS: return function_args_trace_call; case TRACE_FUNC_OPT_STACK: + case TRACE_FUNC_OPT_STACK | TRACE_FUNC_OPT_ARGS: return function_stack_trace_call; case TRACE_FUNC_OPT_NO_REPEATS: return function_no_repeats_trace_call; @@ -295,7 +296,9 @@ function_stack_trace_call(unsigned long ip, unsigned long parent_ip, if (likely(disabled == 1)) { trace_ctx = tracing_gen_ctx_flags(flags); - trace_function(tr, ip, parent_ip, trace_ctx, NULL); + if (!(tr->current_trace_flags->val & TRACE_FUNC_OPT_ARGS)) + fregs = NULL; + trace_function(tr, ip, parent_ip, trace_ctx, fregs); #ifdef CONFIG_UNWINDER_FRAME_POINTER if (ftrace_pids_enabled(op)) skip++;