Re: scheduling problem?

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Fri, 17 Dec 1999 15:28:37 +0100


Andrea Arcangeli wrote:
> On Thu, 16 Dec 1999, Jamie Lokier wrote:
>
> > asm volatile("sti ; hlt" : : : "memory");
> ^^^^^^^^^
>
> The wakeup can still happen between sti and hlt so it doesn't fix the
> irq race condition.

sti enables interrupts /after/ the next instruction, so there is no race.

cli should not wait, so the "cli; movb current->need_resched,%reg"
sequence should be ok.

> The trivial way to fix that is to loop on the need_resched in the idle
> task (ugh, not nice :( ).

The trivial way, if it was a problem which it shouldn't be, would be for
ret_from_intr to check if the return address is the hlt instruction and
bump the address in that case.

There might be an interaction with NMIs, if you receive an NMI between
the sti and hlt. I don't think it's important but if anyone cares it
should be fixed up in the NMI handler return path.

-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/