Implement an architecture function cpu_mplock_contested() which is
authorMatthew Dillon <dillon@dragonflybsd.org>
Mon, 2 Jul 2007 01:37:11 +0000 (01:37 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Mon, 2 Jul 2007 01:37:11 +0000 (01:37 +0000)
commitb402c63383c29b53787bd1b33d0ea96d6d8a734e
tree566098b40ccc2b4eaab44cb8b451ed4de0483f26
parent02095b1cd19d3a87eb67df086b55d4a9cd0152d2
Implement an architecture function cpu_mplock_contested() which is
called by the LWKT thread scheduler when the only thread(s) it can
schedule need the MP lock and the scheduler was unable to acquire the
MP lock.

On real systems this function just executes the cpu 'pause' instruction,
and on virtual systems this functions sleeps for a millisecond.

Use umtx_sleep() instead of sigpause() in the virtual kernel's idle loop
to interlock threads scheduled via a signal with the idle loop sleep.
This fixes a race condition that caused the vkernel to stop scheduling
(but there may be more issues, stay tuned).
sys/kern/lwkt_thread.c
sys/platform/pc32/i386/machdep.c
sys/platform/vkernel/i386/cpu_regs.c
sys/sys/systm.h