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: Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxx>
Date: Sun, 2 Sep 2007 11:50:55 +0200
Mail-followup-to: kernel@crater.dragonflybsd.org

On Sat, Sep 01, 2007 at 11:26:10AM -0700, Matthew Dillon wrote:
>     I dont know the semantics of MONITOR/MWAIT.  What happens if you issue
>     a MONITOR and the cpu takes an interrupt and issues another MONITOR/MWAIT
>     before returning to your MWAIT?  That will govern whether/how we use the
>     feature because it will determine whether we need to disable interrupts
>     while doing the monitor/mwait sequence or not.

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.

Joerg



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