aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2014-07-03 14:51:36 -0400
committerSteven Rostedt <rostedt@goodmis.org>2014-10-31 12:22:54 -0400
commit15d5b02cc575e5b20ddfa1645fc1242f0b0ba1c8 (patch)
tree92a2a3f35ac196354fc5c6dfa73f2b6af0d2d6d4 /kernel/trace
parentf3bea49115b21e0995abf41402ad2f4d9c69eda4 (diff)
ftrace/x86: Show trampoline call function in enabled_functions
The file /sys/kernel/debug/tracing/eneabled_functions is used to debug ftrace function hooks. Add to the output what function is being called by the trampoline if the arch supports it. Add support for this feature in x86_64. Cc: H. Peter Anvin <hpa@linux.intel.com> Tested-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Tested-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/ftrace.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 15f85eac7e95..422e1f8300b1 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2952,6 +2952,22 @@ static void t_stop(struct seq_file *m, void *p)
2952 mutex_unlock(&ftrace_lock); 2952 mutex_unlock(&ftrace_lock);
2953} 2953}
2954 2954
2955void * __weak
2956arch_ftrace_trampoline_func(struct ftrace_ops *ops, struct dyn_ftrace *rec)
2957{
2958 return NULL;
2959}
2960
2961static void add_trampoline_func(struct seq_file *m, struct ftrace_ops *ops,
2962 struct dyn_ftrace *rec)
2963{
2964 void *ptr;
2965
2966 ptr = arch_ftrace_trampoline_func(ops, rec);
2967 if (ptr)
2968 seq_printf(m, " ->%pS", ptr);
2969}
2970
2955static int t_show(struct seq_file *m, void *v) 2971static int t_show(struct seq_file *m, void *v)
2956{ 2972{
2957 struct ftrace_iterator *iter = m->private; 2973 struct ftrace_iterator *iter = m->private;
@@ -2975,19 +2991,21 @@ static int t_show(struct seq_file *m, void *v)
2975 2991
2976 seq_printf(m, "%ps", (void *)rec->ip); 2992 seq_printf(m, "%ps", (void *)rec->ip);
2977 if (iter->flags & FTRACE_ITER_ENABLED) { 2993 if (iter->flags & FTRACE_ITER_ENABLED) {
2994 struct ftrace_ops *ops = NULL;
2995
2978 seq_printf(m, " (%ld)%s", 2996 seq_printf(m, " (%ld)%s",
2979 ftrace_rec_count(rec), 2997 ftrace_rec_count(rec),
2980 rec->flags & FTRACE_FL_REGS ? " R" : " "); 2998 rec->flags & FTRACE_FL_REGS ? " R" : " ");
2981 if (rec->flags & FTRACE_FL_TRAMP_EN) { 2999 if (rec->flags & FTRACE_FL_TRAMP_EN) {
2982 struct ftrace_ops *ops;
2983
2984 ops = ftrace_find_tramp_ops_any(rec); 3000 ops = ftrace_find_tramp_ops_any(rec);
2985 if (ops) 3001 if (ops)
2986 seq_printf(m, "\ttramp: %pS", 3002 seq_printf(m, "\ttramp: %pS",
2987 (void *)ops->trampoline); 3003 (void *)ops->trampoline);
2988 else 3004 else
2989 seq_printf(m, "\ttramp: ERROR!"); 3005 seq_printf(m, "\ttramp: ERROR!");
3006
2990 } 3007 }
3008 add_trampoline_func(m, ops, rec);
2991 } 3009 }
2992 3010
2993 seq_printf(m, "\n"); 3011 seq_printf(m, "\n");