The advent of CONFIG_PREEMPT_AUTO, AKA lazy preemption, will mean that even kernels built with CONFIG_PREEMPT_NONE or CONFIG_PREEMPT_VOLUNTARY might see the occasional preemption, and that this preemption just might happen within a trampoline.
Therefore, update ftrace_shutdown() to invoke synchronize_rcu_tasks() based on CONFIG_TASKS_RCU instead of CONFIG_PREEMPTION. Only build tested. Signed-off-by: Paul E. McKenney <paul...@kernel.org> Cc: Steven Rostedt <rost...@goodmis.org> Cc: Masami Hiramatsu <mhira...@kernel.org> Cc: Mark Rutland <mark.rutl...@arm.com> Cc: Mathieu Desnoyers <mathieu.desnoy...@efficios.com> Cc: Ankur Arora <ankur.a.ar...@oracle.com> Cc: Thomas Gleixner <t...@linutronix.de> Cc: <linux-trace-ker...@vger.kernel.org> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 2da4eaa2777d6..c9e6c69cf3446 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -3156,7 +3156,7 @@ int ftrace_shutdown(struct ftrace_ops *ops, int command) * synchronize_rcu_tasks() will wait for those tasks to * execute and either schedule voluntarily or enter user space. */ - if (IS_ENABLED(CONFIG_PREEMPTION)) + if (IS_ENABLED(CONFIG_TASKS_RCU)) synchronize_rcu_tasks(); ftrace_trampoline_free(ops);