Fixing noise on Ubuntu Hardy 8.04, aka setting max_cstate

Not security related at all, but it took me so much time to figure this out, I want to share this with the world!

I own a Lenovo Thinkpad T60 that I like very much. There is one annoyance, and that is that when on battery, the laptop produces a high pitched noise when idle. It turns out that this has something to do with the ACPI state. States of C3 and higher made my laptop produce the noise. In Ubuntu Gutsy 7.10 there was a simple solution. I could force the laptop to never use anything higher that C2. That was done like this:

echo “2″ > /sys/module/processor/parameters/max_cstate

And everyone was happy! Noise gone, battery life still decent. All was good. Until I upgraded to Hardy. Hardy uses kernel 2.6.24, and for some reason the sysfs interface has been removed. So there is no way to set the max_cstate on the fly. See here for the bug report.

In theory the ‘processor’ module should be able to take an option ‘max_cstate=2′. But setting this option didn’t seem to work. It took some time to figure out why, but the reason is simple. The ‘processor’ module is in the initrd image, and is loaded before /etc/modprobe.d/options is inspected. Luckily, the solution is simple:

Add the following line to your /etc/modprobe.d/options file:

options processor max_cstate=2

Then update the initrd image using the following command:

sudo update-initramfs -u

The initrd image is now updated to include the option. Then reboot. Verify if it works:

$ cat /proc/acpi/processor/CPU0/power |grep max_cstate
max_cstate:              C2

Success! Again, no more noise…

Tags: , , , ,

13 Responses to “Fixing noise on Ubuntu Hardy 8.04, aka setting max_cstate”

  1. Alan says:

    Well done! I build a custom kernel for the express purpose of getting rid of the initramfs, but this is a fantastic find.

  2. Jason says:

    I did similar with my Lenovo X61 (which I like very much as well), but did have a noticeable battery drop. 45 mins to 1 hour off of my usual 4.5 hour time.

    But that wine is annoying. My C2D MacBook has it as well, but the casing on the MacBook must be thicker as you have to put your ear right up to it to notice it. I understand that it is an issue with most, if not all C2D mobile CPUs.

  3. Andrew says:

    Thank you! I have been working on this with my Macbook CD for days, and now no whine, I haven’t noticed a significant drop in battery life. This is a lifesaver.

  4. Jon says:

    Great! I just installed Ubuntu on my Macbook and the whining was really starting to get one my nerves…enough to just stick with OSX for now, but now I don’t have to. Thanks a lot!

  5. Patrik says:

    Excellent post :).

    Did this on my X61s running Debian Lenny and it worked like a charm.
    Thank you!

  6. Jeanck says:

    Thank you sooooooo much!

  7. Tereza says:

    Thank you, it helped me with my old Acer Aspire running Archlinux. I can use latest kernel again, and the laptop stays quiet!

    I adapted your solution for Archlinux and add link to your blog. http://wiki.archlinux.org/index.php/Acer_Aspire_1691_WLMi#ACPI

    Thanks again!

  8. [...] *The above solutions indeed do not work for the 2.6.24 kernel, however a workaround which does not require installing Ubuntu Tweak can be found here: http://www.inliniac.net/blog/2008/07/25/fixing-noise-on-ubuntu-hardy-804-aka-setting-max_cstate.html [...]

  9. Spencer says:

    Awesome! You helped me fix the annoying whine on my Macbook!

  10. mika says:

    Helped me too! Thank you!!

  11. Srini says:

    THis did NOT work for me. When I run the command : I see the following output
    cat /proc/acpi/processor/CPU0/power |grep max_cstat
    max_cstate : C8.

    It does not make it C2.
    I am a newbie to Ubuntu. Please help

  12. Srini says:

    Never mind. It worked for me after a restart.
    This has tremendously helped my vmware performance.

    Incredible help. Thanks a Million

  13. Andreas says:

    Works under Intrepid too.
    Thank you.

    However, this reduces battery lifetime; I have a x300 Thinkpad and compared with having C4 enabled power usage is about 1 W higher.

Leave a Reply