diff options
author | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-11-15 14:06:47 -0500 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-12-08 20:54:07 -0500 |
commit | 688f7089d8851b1a81106f0c0b9b29181b2f2dc8 (patch) | |
tree | 4ba6a07d11c0a53d0d0dc4583ef9f5cb1e245ca2 /kernel/trace/ftrace.c | |
parent | 317e04ca905ac6c4b33cb879e9a107c412125f14 (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/ftrace.c')
-rw-r--r-- | kernel/trace/ftrace.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index c53533b833cf..d06fe588e650 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -849,15 +849,19 @@ static void profile_graph_return(struct ftrace_graph_ret *trace) | |||
849 | local_irq_restore(flags); | 849 | local_irq_restore(flags); |
850 | } | 850 | } |
851 | 851 | ||
852 | static struct fgraph_ops fprofiler_ops = { | ||
853 | .entryfunc = &profile_graph_entry, | ||
854 | .retfunc = &profile_graph_return, | ||
855 | }; | ||
856 | |||
852 | static int register_ftrace_profiler(void) | 857 | static int register_ftrace_profiler(void) |
853 | { | 858 | { |
854 | return register_ftrace_graph(&profile_graph_return, | 859 | return register_ftrace_graph(&fprofiler_ops); |
855 | &profile_graph_entry); | ||
856 | } | 860 | } |
857 | 861 | ||
858 | static void unregister_ftrace_profiler(void) | 862 | static void unregister_ftrace_profiler(void) |
859 | { | 863 | { |
860 | unregister_ftrace_graph(); | 864 | unregister_ftrace_graph(&fprofiler_ops); |
861 | } | 865 | } |
862 | #else | 866 | #else |
863 | static struct ftrace_ops ftrace_profile_ops __read_mostly = { | 867 | static struct ftrace_ops ftrace_profile_ops __read_mostly = { |