From owner-freebsd-acpi@FreeBSD.ORG Sun May 3 23:32:53 2009 Return-Path: Delivered-To: freebsd-acpi@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3DD0106566C; Sun, 3 May 2009 23:32:53 +0000 (UTC) (envelope-from nate@root.org) Received: from nlpi053.prodigy.net (nlpi053.sbcis.sbc.com [207.115.36.82]) by mx1.freebsd.org (Postfix) with ESMTP id 842CD8FC16; Sun, 3 May 2009 23:32:53 +0000 (UTC) (envelope-from nate@root.org) Received: from [10.0.5.18] (ppp-71-139-5-28.dsl.snfc21.pacbell.net [71.139.5.28]) (authenticated bits=0) by nlpi053.prodigy.net (8.13.8 smtpauth/dk/map_regex/8.13.8) with ESMTP id n43NWpPQ009414; Sun, 3 May 2009 18:32:51 -0500 Message-ID: <49FE29A4.30507@root.org> Date: Sun, 03 May 2009 16:32:52 -0700 From: Nate Lawson User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Alexander Motin References: <49FE1826.4060000@FreeBSD.org> In-Reply-To: <49FE1826.4060000@FreeBSD.org> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Cc: FreeBSD acpi , FreeBSD-Current , freebsd-mobile@FreeBSD.org Subject: Re: Fighting for the power. X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 May 2009 23:32:54 -0000 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: > hint.p4tcc.0.disabled=1 > hint.acpi_throttle.0.disabled=1 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 to boot/default/device.hints? > In my case frequency/voltage control saves about 5W of idle power. > C-states > - 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 > default. > - 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: > performance_cx_lowest="C2" > economy_cx_lowest="C2" 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: > hint.apic.0.clock=0 > 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: > kern.hz=100 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: > hint.atrtc.0.clock=0 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). -- Nate