[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
hotkey-setup (0.1-17ubuntu19) gutsy; urgency=low * Fix number of '.' in 'grep' mask string * Set the top 8-bits of the mask and see if the they stick * Add back in 'thinkpad-keys' lockfile logic * 'thinkpad-keys': Move open("fifo") into loop to reduce code duplication. * Roll 'thinkpad-keys-update' into "thinkpad-keys --update"; remove second binary and duplicated FIFO location. * Change 'init.d' shebang from 'bash' to 'sh' * Add alias '--no-brightness' for 'LENOVO'; move policy decision from 'thinkpad-keys' to the 'init.d' -- Paul Sladen <[EMAIL PROTECTED]> Tue, 18 Sep 2007 19:41:36 +0300 0.1-17ubuntu18 Removed in gutsy-release on 2007-09-16 hotkey-setup (0.1-17ubuntu18) gutsy; urgency=low * Fix build breakage -- Matthew Garrett <[EMAIL PROTECTED]> Sun, 16 Sep 2007 00:52:07 +0100 0.1-17ubuntu17 Removed in gutsy-release on 2007-09-15 hotkey-setup (0.1-17ubuntu17) gutsy; urgency=low * Make sure that thinkpad-keys-update is actually installed -- Matthew Garrett <[EMAIL PROTECTED]> Sat, 15 Sep 2007 22:49:35 +0100 0.1-17ubuntu16 Removed in gutsy-release on 2007-09-15 hotkey-setup (0.1-17ubuntu16) gutsy; urgency=low * Add support for event-driven thinkpad-keys for machines that still need that. Requires kernel update for getting the notifications. * Reenable thinkpad-keys on hardware that doesn't have a sufficiently wide hotkey mask. Might still need some tuning. -- Matthew Garrett <[EMAIL PROTECTED]> Sat, 15 Sep 2007 22:05:20 +0100 0.1-17ubuntu15 Removed in gutsy-release on 2007-09-13 hotkey-setup (0.1-17ubuntu15) gutsy; urgency=low * Reduce power consumption and try to avoid circular relationships between key and brightness events. - Disable the 'thinkpad-keys' daemon - Enable extended ThinkPad hotkey ACPI events. (Combined with update to 'acpi-support' to handle new events). -- Paul Sladen <[EMAIL PROTECTED]> Thu, 13 Sep 2007 19:11:08 +0300 ** Changed in: hotkey-setup (Ubuntu) Assignee: (unassigned) => Paul Sladen (sladen) Status: Confirmed => Fix Released ** Changed in: linux-source-2.6.20 (Ubuntu) Status: New => Won't Fix -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
The new acpi-support (0.101) and hotkey-setup (0.1-17ubuntu15) packages stop thinkpad-keys from running so the 2% CPU usage dropped which is good. However, none of the hotkeys were working. After a quick investigation, it seems that the thinkpad_acpi kernel module wasn't being loaded. A simple "sudo modprobe thinkpad_acpi" was enough to get the keys working again (I just tested the volume and brightness keys but I assume the rest were working). For reference, I am using a Thinkpad X60s (i.e. one that reports Lenovo as the manufacturer, if that makes a difference). -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
I have a T60 and run Kubuntu. I used to see 2% CPU. I changed some settings on my system and it went off mostly after I disabled arts in the kcontrol center (Enable sound system -> uncheck), though I'm not entirely sure if it was arts. However, if I compile a newer kernel and install it, it thinkpad-keys shows up at 2%. The stock kernels from the kubuntu repo (currently 2.6.20-16-generic) doesn't have this problem for me. -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
Confirmed on a T60p, 2% of CPU all time... -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
Confirmed on a T43. thinkpad-keys hogs around 2-3% CPU time when running without the patch. Patched is much better. -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
I did not see that problem in feisty. I am not sure if thinkpad-keys was running, but the volume keys worked. In gutsy it uses 2% cpu time on my laptop and battery is drained a lot faster. -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
By the way, I've only noticed this since upgrading to gutsy, but it may have been there before since I didn't go looking for it. -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
Seeing this on a Thinkpad T30, too. top and powertop both show that thinkpad-keys is using a lot of CPU. -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
Is this patch going to be applied to hotkey-setup anytime soon? -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
I just tested here, you're right: echo 0x | sudo tee /proc/acpi/ibm/hotkey acpi_listen now we get the rest of the events: 0x1001 FN_F1 ... 0x100c FN_F12 0x100d FN_BACKSPACE 0x100e FN_INSERT 0x100f FN_DELETE 0x1010 FN_HOME (brightness) 0x1011 FN_END (brightness) --- the one that was missing 0x1012 FN_PAGEUP (thinklight) 0x1013 FN_PAGEDOWN 0x1014 FN_SPACE (zoom) 0x1015 VolumeUp 0x1016 VolumeDown 0x1017 VolumeMute 0x1018 ThinkPad/AccessIBM/ThinkVantage The kernel proc driver needs fixing to display at least 24-bits. We need to watch the mask handling; otherwise Fn-F7 (video switch) will break on older laptops. -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
Confirmed here too on my X60s... and just to amplify on what Benjamin Pineau mentioned, on my system, PowerTOP shows thinkpad-keys on my system is responsible for ~20 wakeups/second (exactly what you would expect with a 50 msec timer), which is currently about 10% of all the wakeups on my system. So it would really help save power to make thinkpad-keys able to sleep much more... -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
Kristian: it also works with the thinkpad_acpi version in 2.6.22-rc, although the output of /proc/acpi/ibm/hotkey doesn't show the whole 0xfff. But that's just a cosmetic issue. -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
Whoopie: That sounds great! Just what is needed. (But does it work on any thinkpad model, older ones in particular?) Also, I think thinkpad-keys will be with us for some time still, and as such should be patched ASAP anyway to provide a general fix that it not dependent on a recent kernel version. (I agree with Benjamin that 5Hz polling frequency should be more than enough) If what I read on ibm-acpi-devel is correct, the reporting of keys as ACPI events was only recently added, its target kernel release being 2.6.23 which is still a little way off into the future for the ordinary ubuntu user: http://www.mail-archive.com/[EMAIL PROTECTED]/msg00378.html -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
** Attachment added: "/etc/acpi/ibm-buttons.sh" http://launchpadlibrarian.net/8198341/ibm-buttons.sh -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
Hi, the thinkpad_acpi kernel module generate an ACPI event when "echo 0x > /proc/acpi/ibm/hotkey". So, we don't need thinkpad-keys anymore which polls nvram. we could have ACPI event scripts for this. I'm attaching my proof-of-concept scripts. Best regards, Whoopie -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
** Attachment added: "/etc/acpi/events/ibm-buttons" http://launchpadlibrarian.net/8198340/ibm-buttons -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
Patch works great here too. (X60s) -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
Ben Collins : yes. I'm running this on 2.6.22-rc5 on a Thinkpad X40, and: 1) This Thinkpad model is also affected, indeed. 2) The bug is still present on the original unpatched package (it's even more visible because of dynticks, see above). 3) The Kristian Berge Nessa's patch works flawlesly, and actualy fix the problem (CPU usage become marginal). I also slightly modified the Kristian's patch to make POLL_DELAY a 200ms delay ("#define POLL_DELAY 200", in thinkpad-keys.c line 40), rather than 100ms on Kristian's, and worse, 50ms on the original. That's because a second bug, related to this one, in hotkey-setup: not only it use a large amount of CPU by doing needly heavy operations, but it also suck lot of power, by waking up the CPU out of C3/C4 power saving c-states too often (odd for a laptop utility), and this should be avoided now we have a tickless kernel. The original, unpatched, hotkey-setup wakes the CPU 20 times a second for no good reason. Kristian reduced this nvram poll freq to 10Hz. But I think we should go for 5Hz : that's what tpb does (tpb being the original IBM Thinkpad special keys manager, well tested), and 5Hz is enough to keep up and not loose any key event. Arjan van de Ven pointed out tpb as an heavy power consumer on the PowerTOP hall of shame ( http://www.linuxpowertop.org/known.php#tpb ), but hotkey-setup is doing much n worse because of this to small nvram polling delay. With Kristian's patch and a 200ms POLL_DELAY, we're on par with tpb (not _that_ bad). -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
** Changed in: linux-source-2.6.20 (Ubuntu) Sourcepackagename: linux-source-2.6.22 => linux-source-2.6.20 -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
I don't see anything showing this was actually tested on 2.6.22. Can someone confirm this is the correct target? -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
Heck! At least now we know why the effect of a slow NVRAM is so amplified. Why on earth does the '/dev'/nvram' need to check the checksum *each* time. I'm not sure we can avoid the lseek() overhead, though I guess if this is the way the 'nvram' driver is working, it *would* actually be cheaper to read the whole NVRAM block in a single read. ** Also affects: linux-source-2.6.22 (Baltix) Importance: Undecided Status: Unconfirmed ** Changed in: linux-source-2.6.22 (Baltix) Status: Unconfirmed => Rejected ** Also affects: linux-source-2.6.22 (Ubuntu) Importance: Undecided Status: Unconfirmed -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
Update: After running the patched thinkpad-keys for >24 hours, CPU time is a meagre 1 sec, just a tad better than the >25 minutes it used to spend a day... This just seemed to good to be true. So, to verify the correctness of the patch, here's some background: The tpb source (from which thinkpad-keys is inspired) says the following: /* Read only the interesting bytes from nvram to reduce the CPU consupmtion of tpb */ /* The kernel nvram driver reads byte-by-byte from nvram, so just reading interesting bytes reduces the amount of inb() calls */ ...So I went to the kernel and checked drivers/char/nvram.c, and found: * Each lseek() calls lock/unlock_kernel() * Each read() calls spin_lock/unlock_irq (which is expensive) * Each read() calls nvram_check_checksum (!). To check the nvram checksum on a PC platform means to inb 30+2 times... So, instead of saving 6 inb operations as intended, the current grok_nvram function does (32+1)*4=132 instead of (32+10)=42, spending 90 more than it should (in addition to any other overhead in calling lseek+read 6 times too many). -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
** Attachment removed: "add DEBUG define, default -O2" http://librarian.launchpad.net/7398541/hotkey- setup_0.1-17ubuntu9_CFLAGS.patch -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
Sorry, please disregard the above ^ patch, this is the correct one. Applies to latest release (0.1-17ubuntu9). cd hotkey-setup-0.1 patch < hotkey-setup_0.1-17ubuntu9_optimize+CFLAGS.patch ** Attachment added: "bundle nvram reads, POLL_DELAY 100ms, add DEBUG define, default -O2" http://librarian.launchpad.net/7398548/hotkey-setup_0.1-17ubuntu9_optimize%2BCFLAGS.patch -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
I had the same behaviour on my T60p and X60t, thinkpad-keys using ~2% cpu at all times: $ uptime ; ps aux | awk '/[t]hinkpad-keys/{print$11,$10}' 12:37:57 up 6 days, 19:39, 1 user, load average: 0.17, 0.14, 0.11 /usr/sbin/thinkpad-keys 189:07 The attached patch bundles the 4 read+seek operations into one (10 byte read), as well increasing POLL_DELAY to 100ms. As a result thinkpad-keys drops off the top(1) charts entirely. Additionally, the Makefile is fixed to forward CFLAGS, and call CC with default -02. Tested on: T60p, X60t (Feisty, 2.6.20-lowlatency kernel), A30p (Edgy). The A30p did not exhibit this behaviour, but applying the patch did not do any harm either. Applies to latest release (0.1-17ubuntu9). cd hotkey-setup-0.1 patch < hotkey-setup_0.1-17ubuntu9_optimize+CFLAGS.patch DISCLAIMER: I have no knowledge of the inner workings of /dev/nvram, but this seems to work for me... Also, this is my first patch here, so constructive criticism are very welcome. ** Attachment added: "bundle nvram reads, POLL_DELAY 100ms, add DEBUG define, default -O2" http://librarian.launchpad.net/7398541/hotkey-setup_0.1-17ubuntu9_CFLAGS.patch -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://bugs.launchpad.net/bugs/45404 You received this bug notification because you are a member of Ubuntu Bugs, which is a direct subscriber. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 45404] Re: thinkpad-keys on ThinkPad X60* uses a large amount of CPU
getting the same behavior on an R40. R40-2722 with pentium-m 1.7Ghz, using acpi. I've taken to killing the thinkpad-keys process after startup. All the buttons continue working with including osd for volume control, access- ibm, brightness, thinklight, etc. (I'm using kde). -- thinkpad-keys on ThinkPad X60* uses a large amount of CPU https://launchpad.net/bugs/45404 -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs