Skip to content

Commit 10d9dda

Browse files
committed
tracing: tprobe-events: Fix to register tracepoint correctly
Since __tracepoint_user_init() calls tracepoint_user_register() without initializing tuser->tpoint with given tracpoint, it does not register tracepoint stub function as callback correctly, and tprobe does not work. Initializing tuser->tpoint correctly before tracepoint_user_register() so that it sets up tracepoint callback. I confirmed below example works fine again. echo "t sched_switch preempt prev_pid=prev->pid next_pid=next->pid" > /sys/kernel/tracing/dynamic_events echo 1 > /sys/kernel/tracing/events/tracepoints/sched_switch/enable cat /sys/kernel/tracing/trace_pipe Link: https://lore.kernel.org/all/176244793514.155515.6466348656998627773.stgit@devnote2/ Fixes: 2867495 ("tracing: tprobe-events: Register tracepoint when enable tprobe event") Reported-by: Beau Belgrave <[email protected]> Cc: [email protected] Signed-off-by: Masami Hiramatsu (Google) <[email protected]> Tested-by: Beau Belgrave <[email protected]> Reviewed-by: Beau Belgrave <[email protected]>
1 parent 6146a0f commit 10d9dda

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

kernel/trace/trace_fprobe.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,14 @@ static struct tracepoint_user *__tracepoint_user_init(const char *name, struct t
106106
if (!tuser->name)
107107
return NULL;
108108

109+
/* Register tracepoint if it is loaded. */
109110
if (tpoint) {
111+
tuser->tpoint = tpoint;
110112
ret = tracepoint_user_register(tuser);
111113
if (ret)
112114
return ERR_PTR(ret);
113115
}
114116

115-
tuser->tpoint = tpoint;
116117
tuser->refcount = 1;
117118
INIT_LIST_HEAD(&tuser->list);
118119
list_add(&tuser->list, &tracepoint_user_list);

0 commit comments

Comments
 (0)