Skip to content

Commit cc33797

Browse files
committed
ftrace: Disable preemption in the tracepoint callbacks handling filtered pids
When function trace PID filtering is enabled, the function tracer will attach a callback to the fork tracepoint as well as the exit tracepoint that will add the forked child PID to the PID filtering list as well as remove the PID that is exiting. Commit a46023d ("tracing: Guard __DECLARE_TRACE() use of __DO_TRACE_CALL() with SRCU-fast") removed the disabling of preemption when calling tracepoint callbacks. The callbacks used for the PID filtering accounting depended on preemption being disabled, and now the trigger a "suspicious RCU usage" warning message. Make them explicitly disable preemption. Cc: Mathieu Desnoyers <[email protected]> Link: https://patch.msgid.link/[email protected] Fixes: a46023d ("tracing: Guard __DECLARE_TRACE() use of __DO_TRACE_CALL() with SRCU-fast") Signed-off-by: Steven Rostedt (Google) <[email protected]> Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
1 parent 0a663b7 commit cc33797

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

kernel/trace/ftrace.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8611,6 +8611,7 @@ ftrace_pid_follow_sched_process_fork(void *data,
86118611
struct trace_pid_list *pid_list;
86128612
struct trace_array *tr = data;
86138613

8614+
guard(preempt)();
86148615
pid_list = rcu_dereference_sched(tr->function_pids);
86158616
trace_filter_add_remove_task(pid_list, self, task);
86168617

@@ -8624,6 +8625,7 @@ ftrace_pid_follow_sched_process_exit(void *data, struct task_struct *task)
86248625
struct trace_pid_list *pid_list;
86258626
struct trace_array *tr = data;
86268627

8628+
guard(preempt)();
86278629
pid_list = rcu_dereference_sched(tr->function_pids);
86288630
trace_filter_add_remove_task(pid_list, NULL, task);
86298631

0 commit comments

Comments
 (0)