aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ftrace.h
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2013-11-07 09:36:25 -0500
committerSteven Rostedt <rostedt@goodmis.org>2014-02-20 12:13:12 -0500
commitb7e00a6c53e9134d5cf7631582acaf027a5ded26 (patch)
treeeb30ea8ede4a31e1b848d0b2c92eeef9a822ebe5 /include/linux/ftrace.h
parentf1b21c9a40704dfdf7b8423c7d2969ea31c9857d (diff)
ftrace: Add private data to ftrace_ops
Passing data to the function callback was originally done by adding the ftrace_ops in another structure, and using the container_of() to get the field. But this adds a bit more complexity than it is worth, and adding a simple .private field to ftrace_ops makes things a lot easier. But be warned, the .private data should not be freed once it is used unless the ftrace_ops itself has gone through the necessary freeing routines. A simple synchronize_sched() is not enough as functions can be traced that are called outside the view of RCU and all its concoctions. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/linux/ftrace.h')
-rw-r--r--include/linux/ftrace.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index f4233b195dab..ef1607ed7044 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -105,11 +105,23 @@ enum {
105 FTRACE_OPS_FL_INITIALIZED = 1 << 8, 105 FTRACE_OPS_FL_INITIALIZED = 1 << 8,
106}; 106};
107 107
108/*
109 * Note, ftrace_ops can be referenced outside of RCU protection.
110 * (Although, for perf, the control ops prevent that). If ftrace_ops is
111 * allocated and not part of kernel core data, the unregistering of it will
112 * perform a scheduling on all CPUs to make sure that there are no more users.
113 * Depending on the load of the system that may take a bit of time.
114 *
115 * Any private data added must also take care not to be freed and if private
116 * data is added to a ftrace_ops that is in core code, the user of the
117 * ftrace_ops must perform a schedule_on_each_cpu() before freeing it.
118 */
108struct ftrace_ops { 119struct ftrace_ops {
109 ftrace_func_t func; 120 ftrace_func_t func;
110 struct ftrace_ops *next; 121 struct ftrace_ops *next;
111 unsigned long flags; 122 unsigned long flags;
112 int __percpu *disabled; 123 int __percpu *disabled;
124 void *private;
113#ifdef CONFIG_DYNAMIC_FTRACE 125#ifdef CONFIG_DYNAMIC_FTRACE
114 struct ftrace_hash *notrace_hash; 126 struct ftrace_hash *notrace_hash;
115 struct ftrace_hash *filter_hash; 127 struct ftrace_hash *filter_hash;