DragonFly BSD


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.

You will generally want to control all the CPUs at once:

 # sysctl hw.acpi.cpu.cx_lowest=C3

Additionaly, this enables deep C-states:

 # sysctl machdep.mwait.CX.idle=AUTODEEP

(Note that you can add the sysctl commands to /etc/sysctl.conf so they are called automatically at boot-time.)

Relevant sysctl's then look like this:

 $ sysctl hw.acpi | grep cx
 hw.acpi.cpu.cx_lowest: C3
 hw.acpi.cpu.cx_lowest_use: C3
 hw.acpi.cpu0.cx_supported: C1/1 C2/1 C3/57
 hw.acpi.cpu0.cx_lowest: C3
 hw.acpi.cpu0.cx_lowest_use: C3
 hw.acpi.cpu0.cx_usage: 3.54% 57.09% 39.36% last 9us
 hw.acpi.cpu1.cx_supported: C1/1 C2/1 C3/57
 hw.acpi.cpu1.cx_lowest: C3
 hw.acpi.cpu1.cx_lowest_use: C3
 hw.acpi.cpu1.cx_usage: 0.00% 9.09% 90.90% last 804us

You may need to add these lines to /boot/loader.conf (for example if you get a "No such file or directory" error and a "no suitable intr cputimer found" message in dmesg when calling sysctl with the above parameters):

 # Use i8254 as interrupt cputimer
 # Get proper deep C-states

On my idle laptop (Lenovo Thinkpad X61s) 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. Note that 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.

Frequency scaling

Use powerd(8) for frequency scaling by adding powerd_enable="YES" to /etc/rc.conf. You can then observe the frequency values in sysctl (example from the leaf.dragonflybsd.org machine):

 $ 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


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.


Some AHCI host bus adapters have link power management support. This feature can be controlled with a per-port sysctl, for example to activate agressive power management on ports 0 and 1:

 # sysctl hw.ahci0.0.link_pwr_mgmt=2
 # sysctl hw.ahci0.1.link_pwr_mgmt=2

Enabling AHCI link power management can save ~0.8W.

Other resources

If you are using a compatible Intel CPU, the corepower(4) kernel module can, once loaded, report power usage through either of these two commands

 sysctl hw.sensors 

 systat -sensors