DragonFly kernel List (threaded) for 2007-09
DragonFly BSD
DragonFly kernel List (threaded) for 2007-09
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: Detangle lwkt_switch() and the idle thread and consolidate sleep variables


From: "Simon 'corecode' Schubert" <corecode@xxxxxxxxxxxx>
Date: Sun, 02 Sep 2007 14:54:37 +0200

Joerg Sonnenberger wrote:
According to the AMD documentation, MWAIT would exit because:

Events that cause an exit from the monitor event pending state include:
...
- Any far control transfer that occurs between the MONITOR and the MWAIT.

The exact conditions are written in the Architecture Guide, part 3. It
should be noted that a number of Opteron CPUs have an errata if you use
MONITOR/MWAIT in a tight loop and certain race conditions with other
CPUs happen and you have interrupts disabled. It should also be noted
that MWAIT produces less bus contention as well, so it should be used
for all spinlocks.

Using it for spinlocks is rather easy, because there is just one variable to monitor. The intel docs also indicate that there can be a MWAIT functionality to work with interrupts disabled and as interrupt as a break condition. I'm not exactly sure how this would work, maybe the interrupt would be serviced as soon as you enable interrupts again?


cheers
 simon




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]