Linux 2.6.1 Cpufreq Controls Speedstep on my Inspiron 3800

15 January 2004

I stumbled upon some discussion of cpufreq on a mailing list, followed some links, and ended up getting it working. My previous attempts had only yielded a locked-up laptop.

The key was to load the speedstep-smi module with the smi_cmd=0x82 option. This kept it from locking the whole machine. Then I could load the cpufreq_powersave and cpufreq_userspace modules.

I can twiddle the states directly through sysfs if I want, but I installed cpudynd to do it for me instead. It adjusts the scaling governor according to a configurable cpu idle ratio. When the machine is idle, it drops its speed and saves power. I'm also playing with an option to spin down the hard drive, but that's never been too successful -- I think I have too many servers running on the laptop.

Adjusting the speed through the kernel interface allows the kernel to adjust for the new speeds and not skew the clock or other things on the system. Setting Speedstep to adjust according to AC presence (in BIOS) caused problems with the clock in older 2.4 kernels, so I had always locked it to high performance.

I can send USR1 and USR2 signals to cpudynd to lock it into one state or another (say from ACPI events when AC power comes and goes), or I could have used another daemon, cpufreqd, which seems to be more configurable, though at one point it had trouble setting the speed back down. cpufreqd could account for battery level, AC presence, load, running programs (like a dvd player in its examples), and adjust the performance state accordingly.

This recent success has inspired me to revisit disk power management, so maybe someday soon I'll figure out how to get the filesystems to stop flushing to disk so often and just cache more data. I think the answer lies somewhere within /proc/sys/vm/*.

While reading, the cpufreqd docs mentioned that ACPI battery monitoring can be CPU-intensive, so it could be disabled. I've seen this since I switched to ACPI and have always been disappointed by that observation. While debugging and trying to watch logs, I decided to disable ACPI logging in the kernel config and rebuilt, since it was so noisy on my logging console. Eliminating the logging significantly decreased my CPU activity and the average load average dropped from 0.30 to 0.03 or so. If you don't need it, do yourself a favor and disable ACPI logging.

Filed Under: Linux