Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 a46023d5616e ("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 <mathieu.desnoyers@efficios.com>
Link: https://patch.msgid.link/20260302213546.156e3e4f@gandalf.local.home
Fixes: a46023d5616e ("tracing: Guard __DECLARE_TRACE() use of __DO_TRACE_CALL() with SRCU-fast")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

+2
+2
kernel/trace/ftrace.c
··· 8611 8611 struct trace_pid_list *pid_list; 8612 8612 struct trace_array *tr = data; 8613 8613 8614 + guard(preempt)(); 8614 8615 pid_list = rcu_dereference_sched(tr->function_pids); 8615 8616 trace_filter_add_remove_task(pid_list, self, task); 8616 8617 ··· 8625 8624 struct trace_pid_list *pid_list; 8626 8625 struct trace_array *tr = data; 8627 8626 8627 + guard(preempt)(); 8628 8628 pid_list = rcu_dereference_sched(tr->function_pids); 8629 8629 trace_filter_add_remove_task(pid_list, NULL, task); 8630 8630