Fighting for the power.
nate at root.org
Sun May 3 23:44:31 UTC 2009
Alexander Motin wrote:
> I would like to summarize some of my knowledge on reducing FreeBSD power
> consumption and describe some new things I have recently implemented in
> 8-CURRENT. The main character of this story is my 12" Acer TravelMate
> 6292 laptop with C2D T7700 2.4GHz CPU, 965GM chipset and SATA HDD, under
> amd64 8-CURRENT.
Very nice summary. Thanks for doing the research.
> P-states and throttling
> Enabling powerd allows to effectively control CPU frequency/voltage
> depending on CPU load. powerd on recent system can handle it quite
> transparently. By default, frequency controlled via mix of EIST and
> throttling technologies. First one controls both core frequency and
> voltage, second - only core frequency. Both technologies give positive
> power-saving effect. But effect of throttling is small and can be
> completely hidden by using C2 state, that's why I recommend to disable
> throttling control by adding to /boot/loader.conf:
When I first wrote cpufreq, there was some question if vendors (even
non-Intel) might use throttling for more than just cutting the duty
cycle. It turns out they haven't, and have focused more on dropping the
voltage with P-state transitions (EIST, PowerNow) and are treating
throttling as a legacy feature.
The time may have come to disable p4tcc and throttling by default, as
long as it's easy for a user to enable them again. Perhaps just a change
> In my case frequency/voltage control saves about 5W of idle power.
> - C1 stops clock on some parts of CPU core during inactivity. It is
> safe, cheap and supported by CPUs for ages. System uses C1 state by
> - C2 state allows CPU to turn off all core clocks on idle. It is also
> cheap, but requires correct ACPI-chipset-CPU interoperation to be used.
> Use of C2 state can be enabled by adding to /etc/rc.conf:
The default settings in rc.conf should allow the lowest Cx setting
available to be used. Perhaps that changed? Really, we want C3+ to be
enabled by default without the user doing anything.
> - C3 state allows CPU completely stop all internal clocks, reduce
> voltage and disconnect from system bus. This state gives additional
> power saving effect, but it is not cheap and require trade-offs.
> As soon as CPU is completely stopped in C3 state, local APIC timers in
> each CPU core, used by FreeBSD as event sources on SMP, are not
> functioning. It stops system time, breaks scheduling that makes system
> close to dead. The only solution for this problem is to use some
> external timers. Originally, before SMP era, FreeBSD used i8254 (for HZ)
> and RTC (for stats) chipset timers. I have made changes to 8-CURRENT to
> resurrect them for SMP systems. To use them, you can disable local APIC
> timers by adding to /boot/loader.conf:
> Also, to drop/rise voltage on C3, CPU needs time (57us for my system).
> It means that C3 state can't be effectively used when system is waking
> up often. To increase inactivity periods we should reduce interrupt rate
> as much as possible by adding to loader.conf:
Yeah, hz=1000 doesn't make sense for laptops and I use hz=100 everywhere.
> It may increase system response time a bit, but it is not significant
> for laptop. Also we may avoid additional 128 interrupts per second per
> core, by the cost of scheduling precision, with using i8254 timer also
> for statistic collection purposes instead of RTC clock, by using another
> newly added option:
The real solution for C3 (and C4, etc.) is to implement tickless
scheduling and to fix the current dependence on LAPIC for timer
interrupts. Hopefully someone will do that soon. With that change, this
change isn't needed.
> 4. HDA modem
> I was surprised, but integrated HDA modem consumed about 1W of power
> even when not used. I have used the most radical solution - removed it
> mechanically from socket. Case surface in that area become much cooler.
Most modems support the ACPI Dx states, where D3 = device powered off.
I'd think the PCI "power no driver option" would disable the soft modem
since it's unlikely you have a driver for it.
> 6. HDD
> First common recommendation is use tmpfs for temporary files. RAM is
> cheap, fast and anyway with you.
> Also you may try to setup automatic idle drive spin-down, but if it is
> the only system drive you should be careful, as every spin-up reduces
> drive's life time.
Did you increase the fsflush delay also?
> So I have really doubled my on-battery time by this tuning - 4:47 hours
> instead of 2:24 with default settings. Preinstalled vendor-tuned Windows
> XP on the same system, provides maximum 3:20 hours.
Very nice. I think tickless scheduling is the single largest win for
power mgmt we could get. Second best would be S4 (suspend to disk).
More information about the freebsd-mobile