Date: Mon, 10 Dec 2012 16:16:15 +0100 From: Bas Smeelen <b.smeelen@ose.nl> To: freebsd-doc@freebsd.org Subject: [patch] deleting the "freebsd on laptops" article Message-ID: <50C5FCBF.9030205@ose.nl>
next in thread | raw e-mail | index | archive | help
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 <http://people.freebsd.org/%7Ebcr/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.</para> </sect2> + <sect2> + <title>Tuning Power Consumption</title> + + <para><emphasis>Based on notes in the FreeBSD Wiki by Alexander + Motin. Converted by Benedict Reuschling.</emphasis></para> + + <para>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.</para> + + <sect3> + <title>Tuning CPU power consumption</title> + + <para>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:</para> + + <sect4> + <title> C-states</title> + + <para>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.</para> + + <para>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 + <filename>/etc/rc.conf:</filename> + <programlisting>performance_cx_lowest="C2" +economy_cx_lowest="C2"</programlisting> + The effect from this state is not so big when + <application>powerd</application> is used, but is still + noticeable.</para> + + <para>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 + <filename>/boot/loader.conf:</filename> + <programlisting>hint.apic.0.clock=0</programlisting> + 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 + <filename>/boot/loader.conf:</filename> + <programlisting>kern.hz=100</programlisting> + As result, the system has only 100 interrupts per core and the + CPUs are using C3 with high efficiency: + <programlisting>%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</programlisting> + The result of an effective C3 state usage, compared to C2 + combined with <application>powerd</application>, is about 2 + W.</para> + + </sect4> + + </sect3> + + <sect3> + <title>Reducing power consumption of the screen</title> + + <para>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.</para> + </sect3> + + <sect3> + <title>Tuning memory power consumption</title> + + <para>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.</para> + + </sect3> + + <sect3> + <title>Saving power on PCI devices</title> + + <para>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 <filename>/boot/loader.conf:</filename> + <programlisting>hw.pci.do_power_nodriver=3</programlisting> + 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.</para> + + </sect3> + + <sect3> + <title>Tuning Power consumption of radio devices</title> + + <para>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.</para> + + </sect3> + + <sect3> + <title>Power consumption on HDA modems</title> + + <para>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.</para> + + <warning><para>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! + </para></warning> + + </sect3> + + <sect3> + <title>Power consumption on HDA sound chips</title> + + <para>To reduce the number of sound generated interrupts, you + can add the following to <filename>/boot/loader.conf:</filename> + <programlisting>hint.pcm.0.buffersize=65536 +hint.pcm.1.buffersize=65536 +hw.snd.feeder_buffersize=65536 +hw.snd.latency=7</programlisting></para> + + </sect3> + + <sect3> + <title>Reducing hard disk drive power consumption</title> + + <para>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.</para> + + <para>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 + <literal>hint.ata.X.pm_level</literal> 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 + <literal>hint.ahcich.X.pm_level</literal> 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.</para> + + </sect3> + + <sect3> + <title>Measuring power consumption results</title> + + <para>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: + <programlisting>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</programlisting> + + We can compare this output to the one after the above power + saving measures were made: + <programlisting>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</programlisting> + + 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.</para> + + </sect3> + + </sect2> + </sect1> </article> --------------090102060704090501010909--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50C5FCBF.9030205>