The reason is that cpu_idle() loops testing (ci->ci_want_resched),
but this is not enough to detect if another thread is ready to run
(several places do cpu_need_resched(ci, 0)). cpu_idle() is itself called
in a loop, which does more thing and especially call sched_curcpu_runnable_p()
to see if the idle lwp needs to switch to another lwp.
So cpu_idle() should do whatever is needed to put the CPU into sleep
waiting for an interrupt (if possible), but should not do so in a loop.
The attached patch still check for ci->ci_want_resched as x86 does, but
I'm not sure this is needed at all.
--
Manuel Bouyer <bou...@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--