LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* sys_sched_yield keeps locked irq before call of schedule()
@ 2008-11-05 12:57 Zdenek Kabelac
  2008-11-05 13:01 ` Ingo Molnar
  0 siblings, 1 reply; 9+ messages in thread
From: Zdenek Kabelac @ 2008-11-05 12:57 UTC (permalink / raw)
  To: Linux Kernel Mailing List

Hi

With recent 2.6.28-rc3 kernel I've noticed that  schedule() is
sometime being called with locked IRQ

Call Trace:
 [<ffffffff81334592>] _spin_lock_irq+0x92/0xa0
 [<ffffffff8133126b>] schedule+0x13b/0x4cb
 [<ffffffff81013c10>] ? native_sched_clock+0x70/0xa0
 [<ffffffff81040930>] ? sys_sched_yield+0x0/0x80
 [<ffffffff810409a5>] sys_sched_yield+0x75/0x80
 [<ffffffff8100c6bb>] system_call_fastpath+0x16/0x1b


Which is a result of the function sys_sched_yield() that calls
schedule() while it keeps irq.

Is it correct to call the function schedule() which 'usually' expects
irq being unlocked and do some 'lenghty'
operations (i.e. debug statistics)  which do not need to keep irq
locked for such a long time?

I've no idea whether this bug or feature and for now  I'm using this
simple patch to fix this issue.

diff --git a/kernel/sched.c b/kernel/sched.c
index e8819bc..80eb633 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -5546,6 +5546,7 @@ asmlinkage long sys_sched_yield(void)
        spin_release(&rq->lock.dep_map, 1, _THIS_IP_);
        _raw_spin_unlock(&rq->lock);
        preempt_enable_no_resched();
+       local_irq_enable();

        schedule();


Zdenek

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

end of thread, other threads:[~2008-11-06 14:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-05 12:57 sys_sched_yield keeps locked irq before call of schedule() Zdenek Kabelac
2008-11-05 13:01 ` Ingo Molnar
2008-11-05 13:09   ` Zdenek Kabelac
2008-11-05 14:05     ` Arnd Bergmann
2008-11-05 14:37       ` Zdenek Kabelac
2008-11-06  7:57     ` Ingo Molnar
2008-11-06 13:46       ` Steven Rostedt
2008-11-06 14:34         ` Ingo Molnar
2008-11-06 14:46           ` 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).