Tuesday, September 25, 2007

Thinkpad buzzing/whining on battery

Every time when I was running my Thinkpad on battery I was hearing strange buzzing from the top left corner where the CPU is situated. It started to be really annoying and last week I began to search on web for some hints if it's feature or should I visit a Lenovo service. Well, I found that the problem is well known and many users have the same problem as me. It's feature of Intel Core2Duo processors with enabled power management. The solution is to disable CPU power management in BIOS. I still don't know if it reduce amount of time on battery ( definitely not significantly, I presume 5-10 min quite notably reduce battery time ) but CPU is not whining anymore.

You can find the setting in BIOS config section:
Config -> Power -> CPU Power Management -> Disabled


Thanks to insightful comments I re-enabled CPU Power Management in BIOS and set maximal value of processor power saving state to 2:
echo 2 > /sys/module/processor/parameters/max_cstate
Modification of max_cstate value fixed buzzing processor sound and didn't eminently increase power use.
To make this change automatic when unplugged from AC you can create script in /etc/acpi/battery.d/ e.g.

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

Power and Thermal Management in the Intel® Core™ Duo Processor


Anonymous said...

You can force C2 state as maximum with command when unplugging from AC and get at least C3 (C3 and 4 are faked into one when unplugged).

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

USB is making worse noise, make sure you have CONFIG_USB_SUSPEND compiled in kernel.

The impact on battery drain is quite significant, you don't get under cca 16W with C2 (normally I don't get over 14W).

Q said...

Thank you for your comment. As you suggested I've re-enabled CPU Power Management in BIOS, set max_cstate to 2 and CPU noise was gone. Power consumption dropped from 18-19W to 16-17W. When I returned max_cstate to default value 8 the power usage dropped under 16W sometimes under 15W but the CPU whining returned.

What really amaze me is, that when I plug in the USB receiver (for my wireless mouse) the CPU buzzing is gone though the max_cstate is at default value 8. Power usage in this case is around 16W.

I have CONFIG_USB_SUSPEND compiled in my kernel as I'm using generic kernel from ubuntu repository and use usbcore.autosuspend=1 kernel option.

Is there good place (file/script) where I can put all power saving features so that they execute when laptop is unpplugged from AC?

powertop suggest:

echo 5 > /proc/sys/vm/laptop_mode
echo 1500 > /proc/sys/vm/dirty_writeback_centisec
iwpriv eth1 set_power 5

Anonymous said...

The USB device prevents CPU from entering low power C3/C4 states because of bus activity (this may not be issue with all devices as my USB mouse does not affect it).

In Debian there is laptop-mode-tools package which sets some of these settings and can run other arbitrary scripts when entering battery or AC mode (laptop_mode is called from ACPI scripts).

Personally, I have modified and repackaged laptop-mode-tools and ACPI scripts so I really know what happens/which scripts are executed (there are several packages which install their own ACPI scripts for same ACPI events).

Don Insalata said...

diky za reseni :o), kazdopadne asi zustanu u té mensi zivotnosti baterie na nabiti, protoze prikaz "echo 2" opravdu netusim, kde zadat :o). ale i tak diky, to piskani me dohanelo k silenstvi...

Q said...

@Don Insalata
Bohuzial z noveho jadra vypadol parameter max_cstate takze uz nejde prepnut :-( a takisto mi nefunguje pridanie usbcore.autosuspend=1 ako parameter jadra.
Mozno tuto vlastnost ide zapnut ak si skompilujes jadro sam ale osobne som uz davno nekompilil vlastne jadro.
Kazdopadne bzucanie sa da obmedzit tak ze zasunies do usb nejake zariadenie (usb kluc, usb primac pre mys atd.)

Dalej sa da este nastavit autosuspend na vsetky usb zariadenia v /sys
a to tiez trochu pomoze
napr. takto:
for i in `find /sys -name autosuspend -exec echo {} \;` ; do echo "0" > $i ; done

- tento riadok/skript potom mozes ulozit do
a takto sa bude spustat pri kazdom odpojeni od el. siete.