Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Apr 2008 16:10:42 -0400 (EDT)
From:      Andrew Gallatin <gallatin@cs.duke.edu>
To:        Jeff Roberson <jroberson@jroberson.net>
Cc:        arch@freebsd.org
Subject:   Re: monitor/mwait support for idle
Message-ID:  <18444.62681.319881.638165@grasshopper.cs.duke.edu>
In-Reply-To: <20080419004911.R942@desktop>
References:  <20080419004911.R942@desktop>

next in thread | previous in thread | raw e-mail | index | archive | help

Jeff Roberson writes:
 > http://people.freebsd.org/~jeff/mwait.diff
 > 
 > This patch implements support for the x86/amd64 monitor and mwait 
 > instructions in the idle loop.  This also implements idle loop selection 
 > via a sysctl string.  The following loops are supported, in 
 > decreasing order of performance and power consumption:
 > 
 > spin      - Simply returns
 > mwait     - Always use mwait to sleep.  CPU enters C0 or C1 depending on
 >              how busy it is.
 > mwait_hlt - Use mwait when busy but fall back to hlt/acpi when not.
 > hlt       - pure hlt loop
 > acpi      - uses acpi_cpu_idle if available and hlt if not.  This is the 
 > default.
 > 

Something which may be a bit confusing is that machines like recent
Core2 Xeons will go into C1E when hlt is executed, depending on an MSR
setting that most BIOSes enable (bit 25, MSR 0x1a0).  I think C1E
might be a deeper sleep than what is reached by mwait.  I confess that
I don't know much about C1E, other than it kills network io intensive
performance, and I turn off this (mis)feature whenever I can.

It will be interesting to see how much mwait helps.  I'm sure it will
save power over my current workaround of disabling hlt altogether :)

Drew




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?18444.62681.319881.638165>