Re: STI, HLT in acpi_cpu_idle_c1

From: Matthew Dillon <dillon_at_apollo.backplane.com>
Date: Thu, 17 Jun 2004 13:13:01 -0700 (PDT)
:> In acpi_cpu_idle_c1, it does:
:> 
:>  sti
:>  hlt
:> 
:> shouldn't there be a NOP in there so that interrupts
:> are guaranteed on?
:
:I think your reading of it is right..
:but I also think that if it was ALWAYS right we'd see processors
:go idle and never wake up again....
:Since this doesn't seem to happen, maybe ther eis a bug in the emulator?
:
:We can always add a nop I guess and see what happens..

    No no no no!

    The whole point is for interrupts to be disabled when the HLT instruction
    *begins* execution (they're only disabled for one cycle).

    If you do:  sti; nop; hlt  then an interrupt may occur before the HLT
    instruction is executed.  The HLT instruction is then executed even though
    the interrupt might have scheduled something.  In otherwords, you will
    wind up in a halted state with schedulable threads pending.

    When you 'STI; HLT' the halt is entered atomicaly while interrupts
    are still disabled, so no interrupt can squeeze.  Then interrupts will
    be enabled and HLT will resume when the next interrupt occurs.

    CLI;
    <check to see if any threads can be scheduled>
    YES-> RETURN
    NO (STI;HLT).

						-Matt
Received on Thu Jun 17 2004 - 18:14:13 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:57 UTC