linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ftrace: Fix softlockup in ftrace_module_enable
@ 2025-09-11 13:33 Vladimir Riabchun
  2025-09-11 13:38 ` Masami Hiramatsu
  2025-09-11 14:41 ` Steven Rostedt
  0 siblings, 2 replies; 6+ messages in thread
From: Vladimir Riabchun @ 2025-09-11 13:33 UTC (permalink / raw)
  To: rostedt; +Cc: mhiramat, mark.rutland, linux-kernel, linux-trace-kernel

A soft lockup was observed when loading amdgpu module,
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.

Signed-off-by: Vladimir Riabchun <ferr.lambarginio@gmail.com>
---
 kernel/trace/ftrace.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index a69067367c29..23c4d37c7bcd 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -7526,6 +7526,9 @@ void ftrace_module_enable(struct module *mod)
 
 	do_for_each_ftrace_rec(pg, rec) {
 		int cnt;
+
+		cond_resched();
+
 		/*
 		 * do_for_each_ftrace_rec() is a double loop.
 		 * module text shares the pg. If a record is
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-09-11 18:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-11 13:33 [PATCH] ftrace: Fix softlockup in ftrace_module_enable Vladimir Riabchun
2025-09-11 13:38 ` Masami Hiramatsu
2025-09-11 14:41 ` Steven Rostedt
2025-09-11 18:16   ` Vladimir Riabchun
2025-09-11 18:37     ` Steven Rostedt
2025-09-11 18:42       ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).