apm - Advanced Power Management control program



Home


Apm is the Advanced Power Management control program for OpenBSD. it will dynamically increase and decrease the CPU speed of compatible processors in order to balance usable speed with low power and temps.

The reason to use apm is to reduce the cpu temperature of a server system and to slightly reduce the power consumption of that system. When tested on an AMD 4000 CPU one can expect a temperature reduction of 15F degrees and around 10 watts less system usage.This is _not_ a huge reduction, but it may help people at home reduce their electric bills or a small company with a tiny server "closet" save power and cooling costs.

If you want to try out apm then you first need to see if the CPU you have is compatible. Execute a "dmesg" and look for a line starting with "cpu0" that includes cpu speed stepping information. This is the output for a AMD 4000 and is speed stepping compatible. Apm will adjust the cpu speed anywhere from 2400MHz down to 1000MHz.

cpu0: Cool'n'Quiet K8 2403 MHz: speeds: 2400 2200 2000 1800 1000 MHz



Getting Started

To use apm all you have to do is decide how you want apm to act and start the daemon.

Option 1: apm -C will allow apm to increase or decrease the cpu speed depending on cpu load. The idea is that the cpu does not need to run at full speed while lightly loaded. Apm will increase the cpu speed 50% every second if the load is over 70% usage. Once the cpu load drops under 70%, apm will decrease the cpu speed 20% every second till the cpu is at its lowest speed.

Option 2: apm -L will lock the cpu at its lowest speed. The cpu will never increase speed in this mode. You may use this if you have a fast system, but want to reduce the temp/power and do not need the speed.

Option 3: apm -H will lock the cpu at its highest speed. This is useful when you temporarily want the system at full speed.

Once apm is running you can execute "apm" without arguments and see what speed the cpu is currently running at. Here we have the daemon running as "apm -C" and there is no load on the system. The two top lines are for laptops, but since this is a server test box they are useless. The bottom line is what you are looking for.

   Battery state: unknown, 0% remaining, unknown life estimate
   A/C adapter state: not known
   Performance adjustment mode: cool running (1000 MHz)

Finally, to get apm to run at boot time you could put the "apm -C" line in the /etc/rc.local file.



For more information about OpenBSD's Pf firewall and HFSC quality of service options check out our PF Config (pf.conf) and PF quality of service HFSC "how to's".




Questions?

Won't the system act sluggish when apm is active?

The system may feel a little slow because the cpu speed has been reduced. As the system's load increases above 70% for at lease two(2) seconds then the cpu will ramp up to full speed.

If you know you are going to be working on the system and you want to make sure the cpu is running at full speed just execute "apm -H". This will clock the cpu to full speed. When you are done just execute "apm -C" before logging off to put the machine back into cool running mode.

Is APMd causing the "ichiic0" errors?

This error may be seen on single or multiple processor systems. Make sure to patch your system to the latest revision. There have been a lot of work done to fix these types of errors.

Jan 10 13:14:45 test0 /bsd: ichiic0: exec: op 1, addr 0x2e, cmdlen 1, len 1, flags 0x00: timeout, status 0x0
Jan 10 13:14:46 test0 /bsd: ichiic0: abort failed, status 0x0
Jan 10 13:14:57 test0 /bsd: ichiic0: exec: op 1, addr 0x2e, cmdlen 1, len 1, flags 0x00: timeout, status 0x0
Jan 10 13:14:58 test0 /bsd: ichiic0: abort failed, status 0x0

This error can be caused by ACPI being disabled _OR_ by APM being enabled. Try a test by enabling and/or disabling these two options in the kernel to see if the errors subside. Remember to reboot after you make any changes to rule out any false positives.

To enable ACPI:

 config -ef /bsd.mp
 ukc> enable acpi
 ukc> quit 

To disable APM:

 config -ef /bsd.mp
 ukc> disable apm
 ukc> quit 



NUT (Network UPS Tools) will monitor your UPS (uninteruptable power supply) and can send you mail or log power events. For more information about OpenBSD's install of NUT check out our NUT UPS monitor on OpenBSD "how to".




Questions, comments, or suggestions? Contact Calomel.org