Ubuntu – Ubuntu 13.10 on Thinkpad slows down dramatically when power adapter is plugged in

13.10dmesgpower-managementthinkpad

When I plug in my power cable — sometimes — Ubuntu 13.10 immediately slows down in just about every way. This has been happening for months, but I only recently finally connected the dots, in part because it does not happen in all situations. However, when it is a problem, I can create it 100% reliably by unplugging and plugging my laptop back in.

This is on my Lenovo Thinkpad W520, running kernel version 3.11.0-15-generic.

Here's the output of dmesg immediately after plugging in:

[  228.581251] e1000e 0000:00:19.0: setting latency timer to 64
[  228.581505] e1000e 0000:00:19.0: irq 48 for MSI/MSI-X

There are no relevant messages when I unplug.

I can't spot any meaningful patterns in top or htop before or after plugging in. The latency particularly affects nautilus, Chrome, and the desktop (Alt+Tab-ing, etc.).

I have both an Nvidia card and an integrated card, but I have Optimus disabled. This slowdown effect occurs no matter which card I currently have enabled.

Here are the Power settings I had in my BIOS when I wrote this report:

BIOS power settings

I've since tried moving the Adaptive Thermal Management's Scheme for AC to be "Balanced" like it is for Battery, and tried moving the Intel SpeedStep setting for AC to be "Battery Optimized" like it is for Battery. I even disabled Wake-on-LAN, which had been set to "AC only". None of these eliminated the slowdown effect when plugging in AC power.

I haven't found anything that isolates and talks about this on Ask Ubuntu or Launchpad or the Internet. The closest thing is this thread on 11.10, which might be the same, but it's unanswered, and I don't see the same CPU patterns (though it's possible my 8 cores make the CPU changes less noticeable). What's going on?

Edit: removed some lines about the Thermal Table, added the photo and more details about BIOS changes I've made since then.

Best Answer

After a long story which began with the same analysis as you told - power cable plug in => slow down the system - I found a solution and another better reproducible situation which works for me.

After waking up the system from suspend to ram the system is remarkable slow. I checked after a tip of a colleague the cpu frequency and the set governor. But the governor was set to performance (watch -s 1 'cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor') and all cpu seems to run with full MHz. (watch -n 1 'cat /proc/cpuinfo | grep MHz'). It seems that this information is not really reliable. After setting the governor to e.g. ondemand and than back to performance the system runs again as expected: fast!

For me the suspend to ram thing is a reproducible situation where the system slows down. But I think there are maybe also some other situations like the power cable - sometimes. And I had also a situation where the governor was automatically set to ondemand if I put some load to the cpu. Only a restart of the system stopped this behaviour.

For setting the governor i used this as a source: http://wiki.ubuntuusers.de/Prozessortaktung (German only) the tool for unity e.g. is indicator-cpufreq sudo apt-get install indicator-cpufreq relogin or start it afterwards with indicator-cpufreq.

Bugs which might be interesting in this context: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1188647 https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1233479

Related Question