DragonFly BSD

Powersave

Powersaving with DragonFly laptop

Here are some hints to make DragonFly laptop suck less power and therefore run longer and cooler.

At first general note - just blow dust out of your laptop. Due to nature of cooling used in laptops this might make huge difference in temperature. I've seen laptops where temperature dropped ~20°C after 5 seconds blowing session.

CPU C states

Let CPU(s) switch to lower C-states than default C1. In DragonFly this can be controlled by hw.acpi.cpu.cx_lowest or hw.cpu[NUM].cx_lowest sysctl(8). CPU(s) have to support lower states. With hw.acpi.cpu.cx_lowest you can control all CPUs (cores) at once, with hw.cpu[NUM].cx_lowest every CPU individually. hw.cpu[NUM].cx_supported gives to you the list of supported C-states and latencies of each supported state (how long it takes to switch from Cx to C0). hw.cpu[NUM].cx_usage gives to you some statistics.

In my Lenovo Thinkpad X61s relevant sysctl's look like this:

 $ sysctl hw.acpi.cpu.cx_lowest
 hw.acpi.cpu.cx_lowest: C3

 $ sysctl -a | grep ^hw.cpu
 hw.cpu0.cx_supported: C1/1 C2/1 C3/17
 hw.cpu0.cx_lowest: C3
 hw.cpu0.cx_usage: 0.00% 0.80% 99.19%
 hw.cpu1.cx_supported: C1/1 C2/1 C3/17
 hw.cpu1.cx_lowest: C3
 hw.cpu1.cx_usage: 0.00% 0.48% 99.51%

On my idle laptop switching lowest to C3 from C1 makes ~2.5W difference in power consumption and 10°C difference in temperature.

ACPI supports only states up to C3, but modern mobile CPU's support C-states up to C6. CPU's can be forced to enter these lower states, but it's not really recommended. If you really want to experiment with this, you have to consult the manual of chipset you are using.

My brief experience shows that there is no difference in power consumption whether you are using C4 or lowering a voltage with est(4). C5 and C6 can make sense in tickless system only (DragonFly isn't such).

You can find more general info about processor C-states here.

EST

Use est(4) if possible. The one currently in the DragonFly kernel doesn't support modern multicore CPU's. I'm using the one written by Michal Belczyk you can get from here.

In my Lenovo Thinkpad X61s relevant sysctl's look like this:

 $ sysctl machdep.est
 machdep.est.frequency.available: 1200 1400 1600
 machdep.est.frequency.current: 1200
 machdep.est.frequency.target: 1200
 machdep.est.voltage.available: 940 956 972 988 1004 1020 1036 1052 1068 1084 1100 1116
 machdep.est.voltage.current: 940
 machdep.est.voltage.target: 940

Switching to minimums (frequency really doesn't matter in idle machine though) makes ~1.7W difference in power consumption in my idle laptop.

CPU P states

Alternatively to EST one can use CPU P states which make the frequency scaling features of the CPU accessible through a standardized interface. CPU P states work on multicore CPUs and the frequencies can be scaled individually depending on the hardware capabilities.

The relevant sysctl's look like this on leaf.dragonflybsd.org:

 $ sysctl hw.acpi.cpu | grep px
 hw.acpi.cpu.px_dom3.available: 2600 1300
 hw.acpi.cpu.px_dom3.members: cpu3(2600)
 hw.acpi.cpu.px_dom3.select: 2600
 hw.acpi.cpu.px_dom2.available: 2600 1300
 hw.acpi.cpu.px_dom2.members: cpu2(2600)
 hw.acpi.cpu.px_dom2.select: 2600
 hw.acpi.cpu.px_dom1.available: 2600 1300
 hw.acpi.cpu.px_dom1.members: cpu1(2600)
 hw.acpi.cpu.px_dom1.select: 2600
 hw.acpi.cpu.px_dom0.available: 2600 1300
 hw.acpi.cpu.px_dom0.members: cpu0(2600)
 hw.acpi.cpu.px_dom0.select: 2600
 hw.acpi.cpu.px_global: 2600

Both, EST and CPU P states sysctl's can be adjusted automatically depending on the system load with sysutils/estd from pkgsrc.

Backlight

Switch backlight to (usable) minimum. There might be several ways to do it, you have to find the one which works for you.

Things you can look at:

Switching backlight brightness from 100% to 20% (still completely usable) with acpi_video(4) makes ~2.6W difference in power consumption in my X61s.

Network interfaces down

Put network interfaces not in use to down (ifconfig if[NUM] down). This can make huge difference in both power consumption and temperature especially with wireless devices.

It makes ~2.5W difference in power consumption and 10°C difference (according to acpi_thinkpad(4) sensors) in my X61s with ath(4) card.

Unused devices

DragonFly lets you put devices not in use (no driver attached to it) to the D3 (power off) state. By default no device is put into D3, but you can control it with hw.pci.do_power_nodriver tunable (set it to 3 if you don't have good reason not to do it). You can switch devices into D3 at runtime via unloading module (ie. making a device "not in use"). Please note that unloading/loading modules is not well tested and it's common that unloading module (or loading it after unloading) makes device unusable or even panics a system.

Savings highly depend on hardware. There are some numbers from my X61s:

Here you can find more general info about devices' D-states.

AHCI

Some AHCI host bus adapters have link power management support. This feature can be controlled with a per-port sysctl.

 $ sysctl hw.ahci0
 hw.ahci0.0.link_pwr_mgmt: 2

Enabling AHCI link power management can save ~0.8W.

More to come ...