tracing: Move graph-time out of function graph options

The option "graph-time" affects the function profiler when it is using the
function graph infrastructure. It has nothing to do with the function
graph tracer itself. The option only affects the global function profiler
and does nothing to the function graph tracer.

Move it out of the function graph tracer options and make it a global
option that is only available at the top level instance.

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: https://patch.msgid.link/20251114192318.781711154@kernel.org
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
This commit is contained in:
Steven Rostedt 2025-11-14 14:22:31 -05:00 committed by Steven Rostedt (Google)
parent 6479325eca
commit 4132886e1b
3 changed files with 23 additions and 14 deletions

View File

@ -509,10 +509,10 @@ EXPORT_SYMBOL_GPL(unregister_ftrace_export);
/* trace_flags holds trace_options default values */
#define TRACE_DEFAULT_FLAGS \
(FUNCTION_DEFAULT_FLAGS | \
TRACE_ITER(PRINT_PARENT) | TRACE_ITER(PRINTK) | \
(FUNCTION_DEFAULT_FLAGS | FPROFILE_DEFAULT_FLAGS | \
TRACE_ITER(PRINT_PARENT) | TRACE_ITER(PRINTK) | \
TRACE_ITER(ANNOTATE) | TRACE_ITER(CONTEXT_INFO) | \
TRACE_ITER(RECORD_CMD) | TRACE_ITER(OVERWRITE) | \
TRACE_ITER(RECORD_CMD) | TRACE_ITER(OVERWRITE) | \
TRACE_ITER(IRQ_INFO) | TRACE_ITER(MARKERS) | \
TRACE_ITER(HASH_PTR) | TRACE_ITER(TRACE_PRINTK) | \
TRACE_ITER(COPY_MARKER))
@ -520,7 +520,7 @@ EXPORT_SYMBOL_GPL(unregister_ftrace_export);
/* trace_options that are only supported by global_trace */
#define TOP_LEVEL_TRACE_FLAGS (TRACE_ITER(PRINTK) | \
TRACE_ITER(PRINTK_MSGONLY) | TRACE_ITER(RECORD_CMD) | \
TRACE_ITER(PROF_TEXT_OFFSET))
TRACE_ITER(PROF_TEXT_OFFSET) | FPROFILE_DEFAULT_FLAGS)
/* trace_flags that are default zero for instances */
#define ZEROED_TRACE_FLAGS \
@ -5331,6 +5331,12 @@ int set_tracer_flag(struct trace_array *tr, u64 mask, int enabled)
trace_printk_start_stop_comm(enabled);
trace_printk_control(enabled);
break;
#if defined(CONFIG_FUNCTION_PROFILER) && defined(CONFIG_FUNCTION_GRAPH_TRACER)
case TRACE_GRAPH_GRAPH_TIME:
ftrace_graph_graph_time_control(enabled);
break;
#endif
}
return 0;

View File

@ -1368,8 +1368,18 @@ extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
#ifdef CONFIG_FUNCTION_PROFILER
# define PROFILER_FLAGS \
C(PROF_TEXT_OFFSET, "prof-text-offset"),
# ifdef CONFIG_FUNCTION_GRAPH_TRACER
# define FPROFILE_FLAGS \
C(GRAPH_TIME, "graph-time"),
# define FPROFILE_DEFAULT_FLAGS TRACE_ITER(GRAPH_TIME)
# else
# define FPROFILE_FLAGS
# define FPROFILE_DEFAULT_FLAGS 0UL
# endif
#else
# define PROFILER_FLAGS
# define FPROFILE_FLAGS
# define FPROFILE_DEFAULT_FLAGS 0UL
# define TRACE_ITER_PROF_TEXT_OFFSET_BIT -1
#endif
@ -1412,7 +1422,8 @@ extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
FGRAPH_FLAGS \
STACK_FLAGS \
BRANCH_FLAGS \
PROFILER_FLAGS
PROFILER_FLAGS \
FPROFILE_FLAGS
/*
* By defining C, we can make TRACE_FLAGS a list of bit names

View File

@ -85,11 +85,6 @@ static struct tracer_opt trace_opts[] = {
/* Include sleep time (scheduled out) between entry and return */
{ TRACER_OPT(sleep-time, TRACE_GRAPH_SLEEP_TIME) },
#ifdef CONFIG_FUNCTION_PROFILER
/* Include time within nested functions */
{ TRACER_OPT(graph-time, TRACE_GRAPH_GRAPH_TIME) },
#endif
{ } /* Empty entry */
};
@ -97,7 +92,7 @@ static struct tracer_flags tracer_flags = {
/* Don't display overruns, proc, or tail by default */
.val = TRACE_GRAPH_PRINT_CPU | TRACE_GRAPH_PRINT_OVERHEAD |
TRACE_GRAPH_PRINT_DURATION | TRACE_GRAPH_PRINT_IRQS |
TRACE_GRAPH_SLEEP_TIME | TRACE_GRAPH_GRAPH_TIME,
TRACE_GRAPH_SLEEP_TIME,
.opts = trace_opts
};
@ -1627,9 +1622,6 @@ func_graph_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
if (bit == TRACE_GRAPH_SLEEP_TIME)
ftrace_graph_sleep_time_control(set);
if (bit == TRACE_GRAPH_GRAPH_TIME)
ftrace_graph_graph_time_control(set);
/* Do nothing if the current tracer is not this tracer */
if (tr->current_trace != &graph_trace)
return 0;