* [PATCH] softirq: add detail info to WARN in do_softirq_post_smp_call_flush()
@ 2026-03-05 17:00 wen.yang
0 siblings, 0 replies; only message in thread
From: wen.yang @ 2026-03-05 17:00 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar; +Cc: linux-kernel, Wen Yang
From: Wen Yang <wen.yang@linux.dev>
When the following WARNING occasionally occurs during the idle path,
the bare WARN_ON_ONCE() provides no context about what actually changed
in the softirq pending mask, making it hard to diagnose the root cause:
WARNING: CPU: 1 PID: 0 at kernel/softirq.c:297 do_softirq_post_smp_call_flush+0xbc/0xc4
Call trace:
do_softirq_post_smp_call_flush+0xbc/0xc4
flush_smp_call_function_queue+0x98/0xcc
do_idle+0x110/0x15c
cpu_startup_entry+0x3c/0x44
secondary_start_kernel+0x138/0x13c
__secondary_switched+0xb0/0xb4
Replace WARN_ON_ONCE() with WARN_ONCE() to print the before and after
values of the softirq pending mask. This allows us to identify exactly
which softirq bit was raised unexpectedly during flush_smp_call_function_queue,
and determine whether it is causing preemption delays.
Signed-off-by: Wen Yang <wen.yang@linux.dev>
---
kernel/softirq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 5f435c1e48d8..45f9647df5eb 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -356,7 +356,9 @@ void do_softirq_post_smp_call_flush(unsigned int was_pending)
unsigned int is_pending = local_softirq_pending();
if (unlikely(was_pending != is_pending)) {
- WARN_ON_ONCE(was_pending != (is_pending & ~SCHED_SOFTIRQ_MASK));
+ WARN_ONCE(was_pending != (is_pending & ~SCHED_SOFTIRQ_MASK),
+ "Sirq mask changed(#%x -> #%x) may delay preemption.",
+ was_pending, is_pending);
invoke_softirq();
}
}
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-05 17:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-05 17:00 [PATCH] softirq: add detail info to WARN in do_softirq_post_smp_call_flush() wen.yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox