aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/ftrace.c
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2017-04-10 22:30:05 -0400
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2017-04-20 22:06:45 -0400
commitb5f081b563a6cdcb85a543df8c851951a8978275 (patch)
treeb9ab66a67e30d9f63fef8cb33da1d0e8893b1b15 /kernel/trace/ftrace.c
parent04ec7bb642b77374b53731b795b5654b5aff1c00 (diff)
tracing: Pass the trace_array into ftrace_probe_ops functions
Pass the trace_array associated to a ftrace_probe_ops into the probe_ops func(), init() and free() functions. The trace_array is the descriptor that describes a tracing instance. This will help create the infrastructure that will allow having function probes unique to tracing instances. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r--kernel/trace/ftrace.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index ea208e93f000..e51cd6b51253 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -3791,6 +3791,7 @@ static void function_trace_probe_call(unsigned long ip, unsigned long parent_ip,
3791 struct ftrace_ops *op, struct pt_regs *pt_regs) 3791 struct ftrace_ops *op, struct pt_regs *pt_regs)
3792{ 3792{
3793 struct ftrace_probe_ops *probe_ops; 3793 struct ftrace_probe_ops *probe_ops;
3794 struct trace_array *tr = op->private;
3794 3795
3795 probe_ops = container_of(op, struct ftrace_probe_ops, ops); 3796 probe_ops = container_of(op, struct ftrace_probe_ops, ops);
3796 3797
@@ -3800,7 +3801,7 @@ static void function_trace_probe_call(unsigned long ip, unsigned long parent_ip,
3800 * on the hash. rcu_read_lock is too dangerous here. 3801 * on the hash. rcu_read_lock is too dangerous here.
3801 */ 3802 */
3802 preempt_disable_notrace(); 3803 preempt_disable_notrace();
3803 probe_ops->func(ip, parent_ip, probe_ops, NULL); 3804 probe_ops->func(ip, parent_ip, tr, probe_ops, NULL);
3804 preempt_enable_notrace(); 3805 preempt_enable_notrace();
3805} 3806}
3806 3807
@@ -3969,6 +3970,7 @@ register_ftrace_function_probe(char *glob, struct trace_array *tr,
3969 ops->ops.func = function_trace_probe_call; 3970 ops->ops.func = function_trace_probe_call;
3970 ftrace_ops_init(&ops->ops); 3971 ftrace_ops_init(&ops->ops);
3971 INIT_LIST_HEAD(&ops->list); 3972 INIT_LIST_HEAD(&ops->list);
3973 ops->ops.private = tr;
3972 } 3974 }
3973 3975
3974 mutex_lock(&ops->ops.func_hash->regex_lock); 3976 mutex_lock(&ops->ops.func_hash->regex_lock);
@@ -3997,7 +3999,7 @@ register_ftrace_function_probe(char *glob, struct trace_array *tr,
3997 * to give the caller an opportunity to do so. 3999 * to give the caller an opportunity to do so.
3998 */ 4000 */
3999 if (ops->init) { 4001 if (ops->init) {
4000 ret = ops->init(ops, entry->ip, data); 4002 ret = ops->init(ops, tr, entry->ip, data);
4001 if (ret < 0) 4003 if (ret < 0)
4002 goto out; 4004 goto out;
4003 } 4005 }
@@ -4038,7 +4040,7 @@ register_ftrace_function_probe(char *glob, struct trace_array *tr,
4038 hlist_for_each_entry(entry, &hash->buckets[i], hlist) { 4040 hlist_for_each_entry(entry, &hash->buckets[i], hlist) {
4039 if (ftrace_lookup_ip(old_hash, entry->ip)) 4041 if (ftrace_lookup_ip(old_hash, entry->ip))
4040 continue; 4042 continue;
4041 ops->free(ops, entry->ip, NULL); 4043 ops->free(ops, tr, entry->ip, NULL);
4042 } 4044 }
4043 } 4045 }
4044 goto out_unlock; 4046 goto out_unlock;
@@ -4055,6 +4057,7 @@ unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops)
4055 struct ftrace_hash *hash = NULL; 4057 struct ftrace_hash *hash = NULL;
4056 struct hlist_node *tmp; 4058 struct hlist_node *tmp;
4057 struct hlist_head hhd; 4059 struct hlist_head hhd;
4060 struct trace_array *tr;
4058 char str[KSYM_SYMBOL_LEN]; 4061 char str[KSYM_SYMBOL_LEN];
4059 int i, ret; 4062 int i, ret;
4060 int size; 4063 int size;
@@ -4062,6 +4065,8 @@ unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops)
4062 if (!(ops->ops.flags & FTRACE_OPS_FL_INITIALIZED)) 4065 if (!(ops->ops.flags & FTRACE_OPS_FL_INITIALIZED))
4063 return -EINVAL; 4066 return -EINVAL;
4064 4067
4068 tr = ops->ops.private;
4069
4065 if (glob && (strcmp(glob, "*") == 0 || !strlen(glob))) 4070 if (glob && (strcmp(glob, "*") == 0 || !strlen(glob)))
4066 func_g.search = NULL; 4071 func_g.search = NULL;
4067 else if (glob) { 4072 else if (glob) {
@@ -4139,7 +4144,7 @@ unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops)
4139 hlist_for_each_entry_safe(entry, tmp, &hhd, hlist) { 4144 hlist_for_each_entry_safe(entry, tmp, &hhd, hlist) {
4140 hlist_del(&entry->hlist); 4145 hlist_del(&entry->hlist);
4141 if (ops->free) 4146 if (ops->free)
4142 ops->free(ops, entry->ip, NULL); 4147 ops->free(ops, tr, entry->ip, NULL);
4143 kfree(entry); 4148 kfree(entry);
4144 } 4149 }
4145 mutex_unlock(&ftrace_lock); 4150 mutex_unlock(&ftrace_lock);