From owner-freebsd-doc@FreeBSD.ORG Mon Dec 10 15:16:20 2012 Return-Path: Delivered-To: freebsd-doc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 25A5B87B for ; Mon, 10 Dec 2012 15:16:20 +0000 (UTC) (envelope-from b.smeelen@ose.nl) Received: from mail.ose.nl (mail.ose.nl [212.178.134.164]) by mx1.freebsd.org (Postfix) with ESMTP id 64B0C8FC08 for ; Mon, 10 Dec 2012 15:16:18 +0000 (UTC) X-Footer: b3NlLm5s Received: from localhost ([127.0.0.1]) by mail.ose.nl (using TLSv1/SSLv3 with cipher AES256-SHA (256 bits)) for freebsd-doc@freebsd.org; Mon, 10 Dec 2012 16:16:15 +0100 Message-ID: <50C5FCBF.9030205@ose.nl> Date: Mon, 10 Dec 2012 16:16:15 +0100 From: Bas Smeelen User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: freebsd-doc@freebsd.org Subject: [patch] deleting the "freebsd on laptops" article Content-Type: multipart/mixed; boundary="------------090102060704090501010909" X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Dec 2012 15:16:20 -0000 This is a multi-part message in MIME format. --------------090102060704090501010909 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi I have reviewed Benedict's article http://people.freebsd.org/~bcr/laptop_article.html There are a lot of additions to the xml article, I did not find any changes with the existing xml content. I have a FreeBSD laptop but only changed kern.hz and some things due to running on zfs only. I will see and try to further look into it, the full (wiki) article is a good start as far as I have read until now. Patch is attached and maybe this can then be maintained as xml and eventually being moved over to the handbook. --------------090102060704090501010909 Content-Type: text/x-patch; name="articlelaptop.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="articlelaptop.diff" Index: en_US.ISO8859-1/articles/laptop/article.xml =================================================================== --- en_US.ISO8859-1/articles/laptop/article.xml (revision 40316) +++ en_US.ISO8859-1/articles/laptop/article.xml (working copy) @@ -300,5 +300,270 @@ backlight. + + Tuning Power Consumption + + Based on notes in the FreeBSD Wiki by Alexander + Motin. Converted by Benedict Reuschling. + + Modern systems, especially laptops, are implementing many + different kinds of power-saving technologies. Some of them are + working automatically, other have significant requirements and + need special system tuning or trade-offs to be effectively used. We + will list some of the steps you can take to tune power + consumption, resulting in longer runtime when not connected to + an external power source. Note that following these instructions + might have better results on some laptops than others. Carefully + monitor your power consumption and adapt it to your needs. The + examples in this section are based on an Acer 12" Acer Travelmate + 6292 laptop with an Intel Core2Duo T7700 2.4 GHz CPU, 965GM chipset + and a SATA hard disk. + + + Tuning CPU power consumption + + CPU is the most consuming part of the system. Under + the full load it alone may consume more then 40W of power, but + for real laptop usage the most important is idle consumption. + Core2Duo T7700 CPU has 2 cores, runs on 2.4GHz frequency, + supports EIST technology with P-states at 2400, 2000, 1600, 1200 + and 800MHz levels, supports C1, C2 and C3 idle C-states, plus + throttling. So how can we use it: + + + C-states + + C1 stops clock on some parts of CPU core + during inactivity. It is safe, cheap and supported by CPUs for + ages. The system uses the C1 state by default. + + C2 state allows the CPU to turn off all core clocks on + idle. It is also cheap, but requires a correct ACPI-chipset-CPU + interoperation to be used. The use of the C2 state can be + enabled by adding the following to + /etc/rc.conf: + performance_cx_lowest="C2" +economy_cx_lowest="C2" + The effect from this state is not so big when + powerd is used, but is still + noticeable. + + The C3 state allows the CPU completely + stop all internal clocks, reduce voltage and to disconnect + itself from the system bus. This state gives additional power + saving effect, but it is not cheap and require trade-offs. + As soon as the CPU is completely stopped in the C3 state, local + APIC timers in each CPU core, used by FreeBSD as event sources + on SMP, are not functioning anymore. It stops the system time, + breaks scheduling which makes system close to dead. The only + solution for this problem is to use some external timers. + Originally, before the SMP era, FreeBSD used i8254 (for HZ) and + RTC (for stats) chipset timers. Changes in FreeBSD 8-CURRENT + were made to resurrect them for SMP systems. To use them, you + can disable local APIC timers by adding the following line to + /boot/loader.conf: + hint.apic.0.clock=0 + Also, to either drop or raise the voltage on the C3 state, the + CPU needs time (57us for my system). It means that C3 state can + not be effectively used when the system is waking up often. To + increase inactivity periods, you should reduce the interrupt + rate as much as possible by adding this to + /boot/loader.conf: + kern.hz=100 + As result, the system has only 100 interrupts per core and the + CPUs are using C3 with high efficiency: + %sysctl dev.cpu |grep cx +dev.cpu.0.cx_supported: C1/1 C2/1 C3/57 +dev.cpu.0.cx_lowest: C3 +dev.cpu.0.cx_usage: 0.00% 0.00% 100.00% last 7150us +dev.cpu.1.cx_supported: C1/1 C2/1 C3/57 +dev.cpu.1.cx_lowest: C3 +dev.cpu.1.cx_usage: 0.00% 0.00% 100.00% last 2235us + The result of an effective C3 state usage, compared to C2 + combined with powerd, is about 2 + W. + + + + + + + Reducing power consumption of the screen + + The screen back light can consume much power. From + 1.5 W at a minimum, up to 4 W with maximum brightness on our + example laptop. You should find a way (either by hardware or + software) to control it and tune for a level minimally required + in specific conditions. In our case, the screen brightness it + is controlled via hardware buttons. + + + + Tuning memory power consumption + + Our example laptop has two 1GB DDR2-667 SODIMM + memory modules installed. Removing one of them saves about 1 W, + replacing two 1 GB modules with a single 2 GB module also saves + about 0.5 W. + + + + + Saving power on PCI devices + + The PCI bus provides a method to control the power + of the attached devices. For example, when you have no use for + i.e. the Firewire controller and, for most of the time, the EHCI + USB controller, you can disable them completey. Doing that + allows you to save about 3 W of power. To disable all unneeded + PCI devices you should build a kernel without their drivers and + add this to /boot/loader.conf: + hw.pci.do_power_nodriver=3 + To enable these devices back, all you need to do is just load + their drivers as kernel modules. The new EHCI USB driver in + FreeBSD 8.x consumes much less power than the previous one. + + + + + Tuning Power consumption of radio devices + + WiFi and Bluetooth adapters can consume a + significant amount of power when used (up to 2 W on our example + laptop when the iwn WiFi driver is connected) or just enabled + (0.5 W). Turning them off when no wireless network is available + almost always results in a prolonged time before battery power + runs out. + + + + + Power consumption on HDA modems + + Surprisingly, the integrated HDA modem in our + example laptop consumed about 1 W of power even when it is not + used. We used the most radical solution - removing it + mechanically from the socket. As a result, the case surface in + that area became much cooler. + + Be careful when attempting such drastic + measures on your device. This will void your warranty and may + break other parts or the whole device, rendering it useless! + + + + + + Power consumption on HDA sound chips + + To reduce the number of sound generated interrupts, you + can add the following to /boot/loader.conf: + hint.pcm.0.buffersize=65536 +hint.pcm.1.buffersize=65536 +hw.snd.feeder_buffersize=65536 +hw.snd.latency=7 + + + + + Reducing hard disk drive power consumption + + The first common recommendation is to use tmpfs for + temporary files. RAM is cheap and fast these days 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 the drive's life time. + You could try using solid state disks or SDHC cards with a + built-in PCI sdhci card reader as the main file system. On + random read requests it is much faster than common hard disks, + but they are very slow on random writes by comparison. At the + same time, it consumes almost nothing for power. USB drives + could also be used, but the effect is much less as the EHCI USB + controller consumes much power. Spinning-down our example 2.5" + Hitachi SATA disk saves about 1 W of power. Removing it + completely saves 2 W. + + Compared to the older PATA, the SATA interface uses + differential signaling for the data transfer. To work properly, + it has to transmit a pseudo-random scrambled sequence even when + idle. As you understand, that requires power. But SATA + implements two power saving modes: PARTIAL and SLUMBER. These + modes could be activated by either the host or the device if + both sides support them. PARTIAL mode just stops scrambling, + but keeps a neutral link state. The resume time is 50-100 us. + SLUMBER mode powers down the interface completely, but the + respective resume time is 3-10 ms. a minimal SATA power + management was added to AHCI's ata(4) driver. There are + hint.ata.X.pm_level loader tunables can be + used to control it. Setting it to 1 allows the drive itself to + initiate the power saving, when it wishes to. Values 2 and 3 + cause the AHCI controller to initiate PARTIAL and SLUMBER + transitions after every command completion. The new + &man.ahci.4; driver also has a + hint.ahcich.X.pm_level tunable. It also + supports modes 4 and 5 for minimal performance degradation. + Note that SATA power saving is not compatible with drive + hot-swap, as the controller is unable to detect drive presence + when link is powered-down. In our case, PARTIAL mode saves 0.5 + W and SLUMBER - 0.8 W of power. + + + + + Measuring power consumption results + + To monitor the current system power consumption you can + use the information provided by the ACPI battery via the + acpiconf -i0 command. Below is the result for the system + before any power consumption tuning was applied: + Design capacity: 4800 mAh +Last full capacity: 4190 mAh +Technology: secondary (rechargeable) +Design voltage: 11100 mV +Capacity (warn): 300 mAh +Capacity (low): 167 mAh +Low/warn granularity: 32 mAh +Warn/full granularity: 32 mAh +Model number: Victoria +Serial number: 292 +Type: LION +OEM info: SIMPLO +State: discharging +Remaining capacity: 93% +Remaining time: 2:24 +Present rate: 1621 mA +Voltage: 12033 mV + + We can compare this output to the one after the above power + saving measures were made: + Design capacity: 4800 mAh +Last full capacity: 4190 mAh +Technology: secondary (rechargeable) +Design voltage: 11100 mV +Capacity (warn): 300 mAh +Capacity (low): 167 mAh +Low/warn granularity: 32 mAh +Warn/full granularity: 32 mAh +Model number: Victoria +Serial number: 292 +Type: LION +OEM info: SIMPLO +State: discharging +Remaining capacity: 94% +Remaining time: 4:47 +Present rate: 826 mA +Voltage: 12231 mV + + Using these settings we have doubled our on-battery time — + 4:47 hours instead of 2:24 with the default settings. The + cooling fans, which were previously running all the time, now + idle most of time, when the system is idle as well. The + preinstalled vendor-tuned Windows XP on the same system + provides a maximum of 3:20 hours battery life. + + + + + --------------090102060704090501010909--