ftrace: Grab any ops for a rec for enabled_functions output
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Thu, 24 Jul 2014 20:00:31 +0000 (16:00 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Wed, 10 Sep 2014 14:48:43 +0000 (10:48 -0400)
When dumping the enabled_functions, use the first op that is
found with a trampoline to the record, as there should only be
one, as only one ops can be registered to a function that has
a trampoline.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/ftrace.c

index 2c4eef49b1af8aad0030ed9bfbd8efa5ac0960a7..858ac16f84920ab6238db2ddcd383cfa1972baa5 100644 (file)
@@ -1900,6 +1900,25 @@ int ftrace_test_record(struct dyn_ftrace *rec, int enable)
        return ftrace_check_record(rec, enable, 0);
 }
 
+static struct ftrace_ops *
+ftrace_find_tramp_ops_any(struct dyn_ftrace *rec)
+{
+       struct ftrace_ops *op;
+
+       do_for_each_ftrace_op(op, ftrace_ops_list) {
+
+               if (!op->trampoline)
+                       continue;
+
+               if (ftrace_lookup_ip(op->func_hash->filter_hash, rec->ip) &&
+                   (ftrace_hash_empty(op->func_hash->notrace_hash) ||
+                    !ftrace_lookup_ip(op->func_hash->notrace_hash, rec->ip)))
+                       return op;
+       } while_for_each_ftrace_op(op);
+
+       return NULL;
+}
+
 static struct ftrace_ops *
 ftrace_find_tramp_ops_curr(struct dyn_ftrace *rec)
 {
@@ -2966,7 +2985,7 @@ static int t_show(struct seq_file *m, void *v)
                if (rec->flags & FTRACE_FL_TRAMP_EN) {
                        struct ftrace_ops *ops;
 
-                       ops = ftrace_find_tramp_ops_curr(rec);
+                       ops = ftrace_find_tramp_ops_any(rec);
                        if (ops && ops->trampoline)
                                seq_printf(m, "\ttramp: %pS",
                                           (void *)ops->trampoline);