Thursday, March 25, 2010

to fix ubuntu speedstepping

For some reason my laptop decided to start scaling the processor back to the slowest possible frequency even when I was on AC power and running cpu intensive workloads.

I scanned for cpufreq modules in the kernel using
$lsmod | grep cpufreq

And I found nothing. I attempted to insert speedstep-centrino or acpi-cpufreq as a kernel module and found there were no modules to be loaded.
[~]$ sudo modprobe speedstep-centrino
FATAL: Module speedstep_centrino not found.

[~]$ sudo modprobe acpi-cpufreq
FATAL: Module acpi_cpufreq not found.

At this point I started looking at bug reports and user forums and I found the following:
* speedstep-centrino appears to be deprecated in favor of acpi-cpufreq
* acpi-cpufreq is actually compiled as part of the 2.6.31 ubuntu kernel so there is no module to load
* Ubuntu 10.x may revert to using acpi-cpufreq as a module but thats not confirmed
* cpufreqd and powernowd are userspace speed stepping daemons
* Ubuntu prefers powernowd but my system had cpufreqd installed
* hal (hardware abstraction layer) also has a speed step controller that no one talks about.

The last point is the one that tripped me up. I think the behavior I was seeing was hal getting confused when I would suspend the laptop, change from running on battery to AC, and then restart the laptop. The hald-addon-cpufreq daemon was doing speed stepping by setting min cpu = max cpu = target frequency. Which means switching the governors didn't do anything.

On the advice of a hal configuration bug report I found I removed the 10-cpufreq.fdi file I found in /usr/share/hal/fdi/policy/10osvendor/10-cpufreq.fdi and restarted the computer.

Removing the hal cpu controller, powernowd, cpudyn, and cpufreqd finally removed every last bit of automated control over my cpu speed stepping. I have cpufrequtils installed which gives me the ability to view and change cpu max, cpu min, and cpu governor manually. After the headache of trying to figure out why my cpu frequency randomly changed I think I'll stick with a system I can control.