public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Prevent going idle with softirq pending
@ 2007-05-21 21:34 Thomas Gleixner
  2007-05-22  5:04 ` Ingo Molnar
  2007-05-22  6:32 ` Andrew Morton
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Gleixner @ 2007-05-21 21:34 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: LKML, Ingo Molnar, Andrew Morton, David Miller, Stable Team,
	Anant Nitya

The NOHZ patch contains a check for softirqs pending when a CPU goes
idle. The BUG is unrelated to NOHZ, it just was made visible by the NOHZ
patch. The BUG showed up mainly on P4 / hyperthreading enabled machines
which lead the investigations into the wrong direction in the first
place. The real cause is in cond_resched_softirq():

cond_resched_softirq() is enabling softirqs without invoking the softirq
daemon when softirqs are pending. This leads to the warning message in
the NOHZ idle code:

t1 runs softirq disabled code on CPU#0
interrupt happens, softirq is raised, but deferred (softirqs disabled)
t1 calls cond_resched_softirq()
	enables softirqs via _local_bh_enable()
	calls schedule()
t2 runs
t1 is migrated to CPU#1
t2 is done and invokes idle()
NOHZ detects the pending softirq

Fix: change _local_bh_enable() to local_bh_enable() so the softirq
daemon is invoked.

Thanks to Anant Nitya for debugging this with great patience !

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4776,7 +4776,7 @@ int __sched cond_resched_softirq(void)
 
 	if (need_resched() && system_state == SYSTEM_RUNNING) {
 		raw_local_irq_disable();
-		_local_bh_enable();
+		local_bh_enable();
 		raw_local_irq_enable();
 		__cond_resched();
 		local_bh_disable();



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

end of thread, other threads:[~2007-05-22  6:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-21 21:34 [PATCH] Prevent going idle with softirq pending Thomas Gleixner
2007-05-22  5:04 ` Ingo Molnar
2007-05-22  6:32 ` Andrew Morton
2007-05-22  6:38   ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox