7

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.

Eric Mill
  • 180
  • I'd imagine something is wrong with Ubuntu's power management for your hardware. A reinstall may work for a bad configuration. However, it's very possible the solution is much more complicated than that. – Dillmo Feb 02 '14 at 20:09
  • Any idea where I should start looking? – Eric Mill Feb 02 '14 at 20:48

4 Answers4

2

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

Kuhpid
  • 121
  • Hmm, I just spent some time with all this - watching cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor showed me ondemand at all times, whether or not I was plugged in. I installed indicator-cpufreq and changed it back and forth from ondemand to performance and observed the plugged and unplugged states in both -- no change in behavior. I still observed the slowdown while plugged in under either CPU profile. Any other ideas? – Eric Mill Mar 06 '14 at 15:51
  • If I remember correctly than I disabled the power management in bios, so the cpus constantly runs with 19xxMhz or so. Than the behaviour with the power plugin was gone and I recognized the thing with the suspend to ram. I enabled the power management again and come to my described solution. Maybe check at first if it helps to completely disable the power management in bios. – Kuhpid Mar 07 '14 at 09:04
  • After a while the problems came back and I decided to look for problems with the T520 without limiting to linux. I found the following information: http://forums.lenovo.com/t5/T400-T500-and-newer-T-series/T520-Slow-performance-and-unexplained-low-Windows-experience/ta-p/489099 After the BIOS update I think the problem is gone away. Unfortunately I do not know which BIOS version I had before the update. Shame on me :-/ – Kuhpid Jul 03 '14 at 12:29
1

I have a (seemingly) very similar issue on a Lenovo ThinkPad T61: (sometimes) when the laptop is plugged-in, it is very slowish. I plug-out the adapter, and the slowness stops.

Here I notice the following symptoms:

  • The kworker or watchdog process is going haywire, spiking at 100% CPU every ~1sec (see also: Kworker, what is it and why is it hogging so much CPU?)
  • This causes UI freezes and essentially renders Ubuntu unusable
  • When I type any text in any program then I experience freezes, and dyslexic typing (like: "dystyping")
  • The green lights of my network ethernet controller is always on

I tracked it down to the following: it looks like the kernel is being under a shower of IRQ interrupts, possibly due to faulty behavior at driver level in the kernel. Apparently this is a known issue related to ACPI interrupt calls, but obviously it hasn't been fixed yet in the kernel for specific hardware (like ours).

Solution:

  • The workaround that you suggested, unplugging, works here too. But this is only temporary.
  • The "definitive" workaround is to do a cold reboot. You need to shutdown the laptop (NOT just reboot), if necessary even remove the charger and the battery after the shutdown, to make sure that nothing weird is happening. Then boot again. Usually this gets rid of the issue (and the ethernet lights turn off).
    • Sometimes this is insufficient, and you need to make sure that the charger is disconnected while the kernel initializes at boot time. I usually wait until the login screen to avoid surprises.

This said, I'm still hoping for a nicer solution to this issue. The workaround is aggravating. Does it help?

landroni
  • 5,941
  • 7
  • 36
  • 58
  • 1
    Hmm, so I think we're probably in different situations - my ethernet light is not on, I don't get the dystyping problem, I don't see kworker or watchdog spiking, and I never experience any freezes or get to the point of unusability. I'll do a cold reboot anyway, and will update it if helps. Either way, I bet your description here will help some others, though, definitely a +1. – Eric Mill Mar 08 '14 at 16:15
1

We had the same problem (on a T520), and thanks to Honza's answer, we found that using a 90W adapter instead of the 65W adapter fixed the problem for us too (thanks!).

After some googling, I found an explanation here: http://linux-thinkpad.10952.n7.nabble.com/WARNING-Lenovo-ThinkPads-and-65W-power-supplies-td13173.html

Basically according to this post "the 65W power supplies alone are NOT sufficient to power the notebook in all scenarios...and the firmware knows this."

The post seems to imply that if your battery is charged then the performance won't be throttled because it can draw on both the 3.25A supply and/or the battery to supply a peak load without being underpowered, but if your battery is not present or not charged, then the cpu frequency will be throttled as a safety measure if it determines that your supply is underpowered.

BobH
  • 11
  • 1
  • I don't think this is it -- in my original question, I saw clear reproducible slowdown when the laptop was plugged in (regardless of its level of charge). I think your answer is implying that the issue occurs when the laptop is low on battery or missing a battery. – Eric Mill Jul 14 '15 at 05:17
0

I'm having similar problem with Lenovo ThinkPad L540 - on battery FPS in 3D game are around 70, when on AC power, FPS drops to 20. Finally I've found why.

Have a look at the power adaptor. I have output 3.25A. I tried to plug 4.5A and the problem dissappeared!

Sorry for posting in "Ubuntu" forum since I have W8 :-) But I think that doesn't change anything.

Honza
  • 1