HOWTO: FreeBSD CPU Scaling and Power Saving

Talking of power savings, from a FreeBSD mailing list in November last year with an early beta version of the AMD 10h cpufreq patch which I have updated above for 10h and now 11h CPUs:

cpu: Phenom 9350e quadcore 4x 2.0GHz (energy efficient 65W version, not black edition)
mem: 1GB DDR2/666 CL5 (1 DIMM)
mobo: Asus M3N72-D Socket AM2+ with nVidia 750a SLI chipset.
hdd: 2,5" 40GB Hitachi notebook HDD on Parallel ATA (udma33)
power supply: Huntkey Greenstar 400W
measurement: average real power drain at wall socket, tested with
Voltcraft Energycheck 3000

@2000: 88.4W
@1200: 75.0W
@1000: 68.5W
@800: 65.0
@600: 60.7W
@400: 58.0W

So in total i shave off 30.4W when idling using cool'n'quiet!! This is very very cool. =)
 
Are you sure that you don't have some lines in loader.conf
What CPU is that, and what modules are loaded?
Better to post this on mailing list because PR may be ignored for a while.
 
@richardpl

You are right of course, it was that setting in /boot/loader.conf:
[cmd=]hint.acpi_throttle.0.disabled=1[/cmd], I will update "bug" info right now.
 
I use that one on loader.conf for following reasons:
1. acpi_throttle fails to attach on second core sometimes
2. acpi_throttle have very little power save gain and very big performance drop (when combined with wrong powerd flags)
3. it actually makes CPU just wait/halt - it doesnt put it in any "lower power state"
4. I really hate acpi
 
*bump* I've edited the post "cpufreq for Phenoms and Opterons (AMD Family 10h)" above as a new file is now required for the current FreeBSD 7.2-STABLE source.
 
vermaden said:
What about 8.0-RELEASE/8-STABLE, these changes have been already merged there?

Not according to http://cameldung.org/man/index.cgi?...ropos=0&manpath=FreeBSD+8.0-RELEASE+and+Ports and http://cameldung.org/man/index.cgi?...tion=4&manpath=FreeBSD+8.0-stable&format=html which only show support for K7 and K8 (not K10 and K11).

I don't know for sure as I haven't upgraded the AMD box to 8 yet because 8.0-R and -S do not boot on my other system (Mac Mini, early 2009) and I like to keep them in sync (sharing same source tree).
 
Carpetsmoker said:
I've been thinking, and I wonder just how useful this is.

A 2GHz CPU running at 1GHz will not consume anywhere near half the power, while a CPU running at 2GHz will complete a task close to twice as fast.
The result is that the CPU will take more time to complete a task, and it will require more power in the end.

I haven't done any test, but I suspect that setting this value lower than the maximum will actually cause the battery to last shorter.

Dropping the CPU frequency can be useful for non-power-saving reasons.

I'm actually interested in debug.cpufreq.highest for underclocking a system with a bad fan (that I can't replace until later this week).
 
royce said:
I'm actually interested in debug.cpufreq.highest for underclocking a system with a bad fan (that I can't replace until later this week).
I suspect that's unnecessary. Between Intel and AMD, I don't think any CPUs have been made without thermal protection in the last 5 years. They limit the clock speed if over temperature by themselves...
 
no savings...

I enabled powerd on a Dell PE1900 - single Xeon quad-core, using flags

Code:
-a adaptive -b adaptive -i 90 -r 50 -p 100

When powerd was started, CPU was throttled down to ~600Mhz, but there was zero change in the overall power consumption of the server, as measured by the UPS it is connected to. At idle I was still seeing a draw of ~105 watts. I ran unixbench to get an idea of what full load draws, and that was ~140 watts peak.

Turning off powerd - I saw no change in consumption...

Any thoughts?
 
Do you use C3 or deeper states?

Check:

Code:
$ sysctl dev.cpu.0.cx_lowest

and

Code:
$ sysctl dev.cpu.0.cx_supported

Code:
$ sysctl dev.cpu.0.cx_usage


+

from acpi man:

The acpi CPU idle power management drive conflicts with the local APIC
(LAPIC) timer. Disable the local APIC timer with hint.apic.0.clock=0 or
do not use the C3 and deeper states if the local APIC timer is enabled.
 
set

Code:
performance_cx_lowest="C2"
economy_cx_lowest="C2"

in /etc/rc.conf, and see if it changes power draw.

You can check C states usage from $ sysctl dev.cpu.0.cx_usage
 
oddly enough - making those changes has actually increased the consumption to an average of 140 watts. UPS load went from 14% to 18%. I did notice in BIOS though that performance based power consumption feature is read-only and set to disable - which is an indicator this Xeon lacks certain support. Sysctl knobs do indicate the rc.conf settings did force it to use C2 states. Does not make much sense - but it's likely not worth putting a bunch of work into, I have bigger fish to fry.
 
chavez243ca said:
oddly enough - making those changes has actually increased the consumption to an average of 140 watts. UPS load went from 14% to 18%. I did notice in BIOS though that performance based power consumption feature is read-only and set to disable - which is an indicator this Xeon lacks certain support. Sysctl knobs do indicate the rc.conf settings did force it to use C2 states. Does not make much sense - but it's likely not worth putting a bunch of work into, I have bigger fish to fry.

My Intel server has slightly better savings with:
/etc/rc.conf
Code:
performance_cx_lowest="C3"
economy_cx_lowest="C3"

than with:
/etc/rc.conf
Code:
powerd_enable="YES"
powerd_flags="-m 199 -M 2395 -a adaptive -n adaptive"

Using them together gives a little higher energy use.

Regards,

Bert
 
BertK88 said:
Using them together gives a little higher energy use.

I suggest you try add the following to /boot/loader.conf:

Code:
hint.p4tcc.0.disabled="1"
hint.acpi_throttle.0.disabled="1"

I've seen more than one FreeBSD dev saying (more kindly than me) that P4TCC is useless, and I for one have seen one of my systems use more energy with it enabled.

YMMV
 
Back
Top