Pages

23 March 2013

368. Slow mouse and keyboard triggered by kworker running custom 3.8.0 kernel on debian wheezy on laptop SL410

Another update (8 Apr. 2013):
A fix is on the way to kernel 3.9 or 3.10.
https://patchwork.kernel.org/patch/2400621/
https://patchwork.kernel.org/patch/2402211/

Update: More links:
http://verahill.blogspot.com.au/2013/04/375-bisecting-kernel-looking-for-commit.html
https://bbs.archlinux.org/viewtopic.php?pid=1248190
https://bbs.archlinux.org/viewtopic.php?pid=1254285#p1254285

Update: it might be an issue in kernel 3.8 -- http://forums.gentoo.org/viewtopic-p-7278760.html#7278760. Seems related to intel graphics which would explain why I only see it on my laptop. Finally, disabling polling probably had no effect -- it was going back to stock kernel 3.2 that solved. The issue is still present in kernel 3.8.5. Awaiting fix in 3.9 or 3.10?

I compiled 3.8.5 and it has the same issue. Powertop shows:
Usage Events/s Category Description 21.9 ms/s 1921.2 Interrupt [49] i915@pci:0000:00:02.0 1.8 ms/s 111.9 kWork od_dbs_timer
I've since also compiled 3.7.10 and haven't yet experienced any issues. Still testing though.

Original post

I've rediscovered an annoying problem that I must have solved at some point with my old debian installation on my laptop (lenovo SL410):  whenever kworker/u starts my mouse and keyboard become unresponsive. They work, but they lag horribly. The total cpu usage of kworker is only around 2-3%, and there's no excessive I/O, and it's consistent with the appearance of kworker in top.

When does kworker start? Whenever anything, anywhere happens e.g. if the fan goes on or if the fan goes off.

Unplugging mains power makes my USB keyboard and mouse behave strangely as well, although it's a bit more subtle. The fan off/mouse slowdown happens everytime though

I disabled kworker polling by editing /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet drm_kms_helper.poll=N"
(don't forget to run sudo update-grub after you've made your changes) but while it makes things run smoothly as long as there's no system state change, fan on/fan off still makes things slow down occasionally. Still, the slowdowns are a lot less frequent and random than before.

I also pulled in laptop-mode-tools, powertop and cpufrequtils. Not sure whether laptop-mode-tools could have a (positive) effect here, but from my reading it shouldn't kick in unless the laptop is running on battery. [update: DO NOT INSTALL laptop-mode-tools -- you'll have issues shutting down the laptop when it's on battery -- it'll reboot itself instead: http://verahill.blogspot.com.au/2013/04/379-thinkpad-sl410-reboot-instead-of.html]

The problem exists on both debian testing/wheezy (my own kernel 3.8) and arch linux (kernel 3.7.10-3.8).

After another reboot I have issues reproducing any sort of slowdown, and I don't seem to be able to reproduce it on the stock wheezy kernel (3.2). Maybe it's a kernel regression?

To anyone else with a similar issue: 
Most likely your best bet is to downgrade the kernel to pre 3.8. For me, kernel 3.2 works fine, but I haven't tested e.g. 3.7.

If you don't think the kernel is the issues you can edit /etc/default/grub as shown above and see how that goes.

6 comments:

  1. I also have the kworker-problem on my notebook (thinkpad edge), even with 3.2 (3.2.0-4-amd64 #1 SMP Debian 3.2.41-2+deb7u2 x86_64 GNU/Linux). It also has ATI graphics and not intel (Mobility Radeon HD 4200).
    The machine is almost unusable since the update to debian 7 :-(

    ReplyDelete
    Replies
    1. Sounds like it might be a different cause though -- the particular issue above stemmed from kernel versions 3.8 and above, and was related to i915 (i.e. intel graphics).

      Very annoying though.

      Delete
  2. Hi, just want to note that I suddenly (no kernel update, just a bunch of other software) have the same issue on Linux Mint with kernel version 3.2.0.45-generic. drm_kms_helper.poll=N in grub didn't change the lagging behaviour in mouse and typing. Machine is a Thinkpad X61 that worked like a charm until yesterday. -- Took several minutes to type this message because of the lag.

    ReplyDelete
    Replies
    1. That's absolutely no fun. Since you're using a laptop I'm presuming that you're not using a USB keyboard/mouse -- if you are, then you can disable sleep for USB devices and see what it does. Otherwise, have a look at /var/log/apt/history.log to see what was upgraded. Feel free to post the list over the last upgrade here.

      You can also selective downgrade packages to see whether it solves anything,

      Delete
    2. The same keyboard slowdown happens on my IBM Thinkpad T43, kernel 3.2.0.4, Debian 7.7, usually after an intensive-memory usage session (rendering sequences in synfig-studio / gimp)

      Delete
    3. Make sure whether it's due to the kworker issue or simply because you've been using swap due to running out of memory. Is the slow-down just a once-off, or does it happen every, say, ten minutes?

      Delete