Skip to content

Commit 5fecaa0

Browse files
committed
ftrace: Grab any ops for a rec for enabled_functions output
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 <[email protected]>
1 parent 3296fc4 commit 5fecaa0

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

kernel/trace/ftrace.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1900,6 +1900,25 @@ int ftrace_test_record(struct dyn_ftrace *rec, int enable)
19001900
return ftrace_check_record(rec, enable, 0);
19011901
}
19021902

1903+
static struct ftrace_ops *
1904+
ftrace_find_tramp_ops_any(struct dyn_ftrace *rec)
1905+
{
1906+
struct ftrace_ops *op;
1907+
1908+
do_for_each_ftrace_op(op, ftrace_ops_list) {
1909+
1910+
if (!op->trampoline)
1911+
continue;
1912+
1913+
if (ftrace_lookup_ip(op->func_hash->filter_hash, rec->ip) &&
1914+
(ftrace_hash_empty(op->func_hash->notrace_hash) ||
1915+
!ftrace_lookup_ip(op->func_hash->notrace_hash, rec->ip)))
1916+
return op;
1917+
} while_for_each_ftrace_op(op);
1918+
1919+
return NULL;
1920+
}
1921+
19031922
static struct ftrace_ops *
19041923
ftrace_find_tramp_ops_curr(struct dyn_ftrace *rec)
19051924
{
@@ -2966,7 +2985,7 @@ static int t_show(struct seq_file *m, void *v)
29662985
if (rec->flags & FTRACE_FL_TRAMP_EN) {
29672986
struct ftrace_ops *ops;
29682987

2969-
ops = ftrace_find_tramp_ops_curr(rec);
2988+
ops = ftrace_find_tramp_ops_any(rec);
29702989
if (ops && ops->trampoline)
29712990
seq_printf(m, "\ttramp: %pS",
29722991
(void *)ops->trampoline);

0 commit comments

Comments
 (0)