aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_functions_graph.c
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2018-11-15 14:06:47 -0500
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2018-12-08 20:54:07 -0500
commit688f7089d8851b1a81106f0c0b9b29181b2f2dc8 (patch)
tree4ba6a07d11c0a53d0d0dc4583ef9f5cb1e245ca2 /kernel/trace/trace_functions_graph.c
parent317e04ca905ac6c4b33cb879e9a107c412125f14 (diff)
fgraph: Add new fgraph_ops structure to enable function graph hooks
Currently the registering of function graph is to pass in a entry and return function. We need to have a way to associate those functions together where the entry can determine to run the return hook. Having a structure that contains both functions will facilitate the process of converting the code to be able to do such. This is similar to the way function hooks are enabled (it passes in ftrace_ops). Instead of passing in the functions to use, a single structure is passed in to the registering function. The unregister function is now passed in the fgraph_ops handle. When we allow more than one callback to the function graph hooks, this will let the system know which one to remove. Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_functions_graph.c')
-rw-r--r--kernel/trace/trace_functions_graph.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 855c13c61e77..140b4b51ab34 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -345,17 +345,25 @@ static void trace_graph_thresh_return(struct ftrace_graph_ret *trace)
345 trace_graph_return(trace); 345 trace_graph_return(trace);
346} 346}
347 347
348static struct fgraph_ops funcgraph_thresh_ops = {
349 .entryfunc = &trace_graph_entry,
350 .retfunc = &trace_graph_thresh_return,
351};
352
353static struct fgraph_ops funcgraph_ops = {
354 .entryfunc = &trace_graph_entry,
355 .retfunc = &trace_graph_return,
356};
357
348static int graph_trace_init(struct trace_array *tr) 358static int graph_trace_init(struct trace_array *tr)
349{ 359{
350 int ret; 360 int ret;
351 361
352 set_graph_array(tr); 362 set_graph_array(tr);
353 if (tracing_thresh) 363 if (tracing_thresh)
354 ret = register_ftrace_graph(&trace_graph_thresh_return, 364 ret = register_ftrace_graph(&funcgraph_thresh_ops);
355 &trace_graph_entry);
356 else 365 else
357 ret = register_ftrace_graph(&trace_graph_return, 366 ret = register_ftrace_graph(&funcgraph_ops);
358 &trace_graph_entry);
359 if (ret) 367 if (ret)
360 return ret; 368 return ret;
361 tracing_start_cmdline_record(); 369 tracing_start_cmdline_record();
@@ -366,7 +374,10 @@ static int graph_trace_init(struct trace_array *tr)
366static void graph_trace_reset(struct trace_array *tr) 374static void graph_trace_reset(struct trace_array *tr)
367{ 375{
368 tracing_stop_cmdline_record(); 376 tracing_stop_cmdline_record();
369 unregister_ftrace_graph(); 377 if (tracing_thresh)
378 unregister_ftrace_graph(&funcgraph_thresh_ops);
379 else
380 unregister_ftrace_graph(&funcgraph_ops);
370} 381}
371 382
372static int graph_trace_update_thresh(struct trace_array *tr) 383static int graph_trace_update_thresh(struct trace_array *tr)