]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ftrace: Fix softlockup in ftrace_module_enable
authorVladimir Riabchun <ferr.lambarginio@gmail.com>
Fri, 12 Sep 2025 11:28:55 +0000 (13:28 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Nov 2025 20:37:34 +0000 (15:37 -0500)
commit7e3c96010ade29bb340a5bdce8675f50c7f59001
tree014d06238b99cb270530b24c3209b4802b98f7ec
parentc2ca015ac109fd743fdde27933d59dc5ad46658e
ftrace: Fix softlockup in ftrace_module_enable

[ Upstream commit 4099b98203d6b33d990586542fa5beee408032a3 ]

A soft lockup was observed when loading amdgpu module.
If a module has a lot of tracable functions, multiple calls
to kallsyms_lookup can spend too much time in RCU critical
section and with disabled preemption, causing kernel panic.
This is the same issue that was fixed in
commit d0b24b4e91fc ("ftrace: Prevent RCU stall on PREEMPT_VOLUNTARY
kernels") and commit 42ea22e754ba ("ftrace: Add cond_resched() to
ftrace_graph_set_hash()").

Fix it the same way by adding cond_resched() in ftrace_module_enable.

Link: https://lore.kernel.org/aMQD9_lxYmphT-up@vova-pc
Signed-off-by: Vladimir Riabchun <ferr.lambarginio@gmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/trace/ftrace.c