Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+23 -14
+10 -4
kernel/trace/trace.c
··· 509 509 510 510 /* trace_flags holds trace_options default values */ 511 511 #define TRACE_DEFAULT_FLAGS \ 512 - (FUNCTION_DEFAULT_FLAGS | \ 513 - TRACE_ITER(PRINT_PARENT) | TRACE_ITER(PRINTK) | \ 512 + (FUNCTION_DEFAULT_FLAGS | FPROFILE_DEFAULT_FLAGS | \ 513 + TRACE_ITER(PRINT_PARENT) | TRACE_ITER(PRINTK) | \ 514 514 TRACE_ITER(ANNOTATE) | TRACE_ITER(CONTEXT_INFO) | \ 515 - TRACE_ITER(RECORD_CMD) | TRACE_ITER(OVERWRITE) | \ 515 + TRACE_ITER(RECORD_CMD) | TRACE_ITER(OVERWRITE) | \ 516 516 TRACE_ITER(IRQ_INFO) | TRACE_ITER(MARKERS) | \ 517 517 TRACE_ITER(HASH_PTR) | TRACE_ITER(TRACE_PRINTK) | \ 518 518 TRACE_ITER(COPY_MARKER)) ··· 520 520 /* trace_options that are only supported by global_trace */ 521 521 #define TOP_LEVEL_TRACE_FLAGS (TRACE_ITER(PRINTK) | \ 522 522 TRACE_ITER(PRINTK_MSGONLY) | TRACE_ITER(RECORD_CMD) | \ 523 - TRACE_ITER(PROF_TEXT_OFFSET)) 523 + TRACE_ITER(PROF_TEXT_OFFSET) | FPROFILE_DEFAULT_FLAGS) 524 524 525 525 /* trace_flags that are default zero for instances */ 526 526 #define ZEROED_TRACE_FLAGS \ ··· 5331 5331 trace_printk_start_stop_comm(enabled); 5332 5332 trace_printk_control(enabled); 5333 5333 break; 5334 + 5335 + #if defined(CONFIG_FUNCTION_PROFILER) && defined(CONFIG_FUNCTION_GRAPH_TRACER) 5336 + case TRACE_GRAPH_GRAPH_TIME: 5337 + ftrace_graph_graph_time_control(enabled); 5338 + break; 5339 + #endif 5334 5340 } 5335 5341 5336 5342 return 0;
+12 -1
kernel/trace/trace.h
··· 1368 1368 #ifdef CONFIG_FUNCTION_PROFILER 1369 1369 # define PROFILER_FLAGS \ 1370 1370 C(PROF_TEXT_OFFSET, "prof-text-offset"), 1371 + # ifdef CONFIG_FUNCTION_GRAPH_TRACER 1372 + # define FPROFILE_FLAGS \ 1373 + C(GRAPH_TIME, "graph-time"), 1374 + # define FPROFILE_DEFAULT_FLAGS TRACE_ITER(GRAPH_TIME) 1375 + # else 1376 + # define FPROFILE_FLAGS 1377 + # define FPROFILE_DEFAULT_FLAGS 0UL 1378 + # endif 1371 1379 #else 1372 1380 # define PROFILER_FLAGS 1381 + # define FPROFILE_FLAGS 1382 + # define FPROFILE_DEFAULT_FLAGS 0UL 1373 1383 # define TRACE_ITER_PROF_TEXT_OFFSET_BIT -1 1374 1384 #endif 1375 1385 ··· 1422 1412 FGRAPH_FLAGS \ 1423 1413 STACK_FLAGS \ 1424 1414 BRANCH_FLAGS \ 1425 - PROFILER_FLAGS 1415 + PROFILER_FLAGS \ 1416 + FPROFILE_FLAGS 1426 1417 1427 1418 /* 1428 1419 * By defining C, we can make TRACE_FLAGS a list of bit names
+1 -9
kernel/trace/trace_functions_graph.c
··· 85 85 /* Include sleep time (scheduled out) between entry and return */ 86 86 { TRACER_OPT(sleep-time, TRACE_GRAPH_SLEEP_TIME) }, 87 87 88 - #ifdef CONFIG_FUNCTION_PROFILER 89 - /* Include time within nested functions */ 90 - { TRACER_OPT(graph-time, TRACE_GRAPH_GRAPH_TIME) }, 91 - #endif 92 - 93 88 { } /* Empty entry */ 94 89 }; 95 90 ··· 92 97 /* Don't display overruns, proc, or tail by default */ 93 98 .val = TRACE_GRAPH_PRINT_CPU | TRACE_GRAPH_PRINT_OVERHEAD | 94 99 TRACE_GRAPH_PRINT_DURATION | TRACE_GRAPH_PRINT_IRQS | 95 - TRACE_GRAPH_SLEEP_TIME | TRACE_GRAPH_GRAPH_TIME, 100 + TRACE_GRAPH_SLEEP_TIME, 96 101 .opts = trace_opts 97 102 }; 98 103 ··· 1621 1626 { 1622 1627 if (bit == TRACE_GRAPH_SLEEP_TIME) 1623 1628 ftrace_graph_sleep_time_control(set); 1624 - 1625 - if (bit == TRACE_GRAPH_GRAPH_TIME) 1626 - ftrace_graph_graph_time_control(set); 1627 1629 1628 1630 /* Do nothing if the current tracer is not this tracer */ 1629 1631 if (tr->current_trace != &graph_trace)