OpenSolaris

Printable Version Enter a New Search
Bug ID 6495392
Synopsis use monitor/mwait for halting idle CPUs where supported
State 10-Fix Delivered (Fix available in build)
Category:Subcategory kernel:arch-x86
Keywords SFO | amdfamily10h
Responsible Engineer Bill Holler
Reported Against
Duplicate Of
Introduced In
Commit to Fix snv_68
Fixed In snv_68
Release Fixed solaris_nevada(snv_68) , solaris_10u5(s10u5_03) (Bug ID:2153591)
Related Bugs 6571080 , 6577948
Submit Date 20-November-2006
Last Update Date 21-March-2008
Description
Currently, idle CPUS use the "halt' instruction to "sleep" to both save power and minimally impact the performance of other CPUs on the same pipeline, chip, etc.

On processors that support it, a lighter weight monitor/mwait based implementation could yield similar power savings benefits as halt, but with better performance (since the xcall to "wakeup" the halted CPU wouldn't be necessary).

Such an implementation should be implemented/evaluated for processors that support it.
wx tpdiffs and Webrev is attached.

See attached "benchmark" cv_token.c.  This user-land program has a 6% to 16%
performance improvement on the mwait enabled Solaris kernel on a 2-socket
Core 2 Duo and a 2-socket XEON.  This program is a modified "dining philosophers".
It creates a bound thread per cpu and a mutex/condition-variable per cpu.
Each thread sleeps on its own condition variable.  When a thread wakes up,
it selects a target cpu, cv_signals the target, and then waits on its cv.
cpu order can be specified.

The suggested fix queries the cpuid instruction in OS initialization to
determine if monitor/mwait is available on this processor and the size to use.
During Solaris startup proper size/aligned buffers are allocated for monitor/
mwait.  If mwait is used idle_cpu is set pointing to idle_cpu_mwait and
disp_enq_thread is pointed at cpu_wakeup_mwait.

This fix does not include deaper C-states.
Work Around
N/A
Comments
N/A