Skip to content

Commit c7a60a7

Browse files
committed
ftrace: Have funcgraph-args take affect during tracing
Currently, when function_graph is started, it looks at the option funcgraph-args, and if it is set, it will enable tracing of the arguments. But if tracing is already running, and the user enables funcgraph-args, it will have no effect. Instead, it should enable argument tracing when it is enabled, even if it means disabling the function graph tracing for a short time in order to do the transition. Cc: Mark Rutland <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Sven Schnelle <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Albert Ou <[email protected]> Cc: Guo Ren <[email protected]> Cc: Donglin Peng <[email protected]> Cc: Zheng Yejian <[email protected]> Link: https://lore.kernel.org/[email protected] Acked-by: Masami Hiramatsu (Google) <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent ff5c9c5 commit c7a60a7

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

kernel/trace/trace_functions_graph.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ static int graph_trace_init(struct trace_array *tr)
464464
else
465465
tr->gops->retfunc = trace_graph_return;
466466

467-
/* Make gops functions are visible before we start tracing */
467+
/* Make gops functions visible before we start tracing */
468468
smp_mb();
469469

470470
ret = register_ftrace_graph(tr->gops);
@@ -475,6 +475,28 @@ static int graph_trace_init(struct trace_array *tr)
475475
return 0;
476476
}
477477

478+
static int ftrace_graph_trace_args(struct trace_array *tr, int set)
479+
{
480+
trace_func_graph_ent_t entry;
481+
482+
if (set)
483+
entry = trace_graph_entry_args;
484+
else
485+
entry = trace_graph_entry;
486+
487+
/* See if there's any changes */
488+
if (tr->gops->entryfunc == entry)
489+
return 0;
490+
491+
unregister_ftrace_graph(tr->gops);
492+
493+
tr->gops->entryfunc = entry;
494+
495+
/* Make gops functions visible before we start tracing */
496+
smp_mb();
497+
return register_ftrace_graph(tr->gops);
498+
}
499+
478500
static void graph_trace_reset(struct trace_array *tr)
479501
{
480502
tracing_stop_cmdline_record();
@@ -1607,6 +1629,9 @@ func_graph_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
16071629
if (bit == TRACE_GRAPH_GRAPH_TIME)
16081630
ftrace_graph_graph_time_control(set);
16091631

1632+
if (bit == TRACE_GRAPH_ARGS)
1633+
return ftrace_graph_trace_args(tr, set);
1634+
16101635
return 0;
16111636
}
16121637

0 commit comments

Comments
 (0)