Luck, Tony wrote:
I don't suppose safe_halt can be called with interrupts off
safely, like the i386 function of the same name?


Yes.  Looking at the code for safe_halt() [chasing through
ia64_do_halt_light() to PAL_CALL() to ia64_pal_call_static] I see
that we disable interrupts before calling into the PAL, and restore
the state after we return.  So somewhere in the depths of the PAL
code the cpu is checking to see whether an external interrupt is
pending, even though we have interrupts blocked.


OK, in which case we should be able to disable interrupts before
checking need_resched() ?

Something like the following:

 void
 default_idle (void)
 {
-       while (!need_resched())
-               if (can_do_pal_halt)
-                       safe_halt();
-               else
+       if (can_do_pal_halt) {
+               while (!need_resched()) {
+                       local_irq_disable();
+                       if (!need_resched())
+                               safe_halt();
+                       local_irq_enable();
+       } else {
+               while (!need_resched())
                        cpu_relax();
+       }
 }



--
SUSE Labs, Novell Inc.

Send instant messages to your online friends http://au.messenger.yahoo.com

Reply via email to