2.6.22-rc[23]: blinking capslock led, stuck keys?
Hi!
I started getting blinking capslock leds in 2.6.22-somewhere. Every 5 seconds or so, capslock led toggles on thinkpad x60. Ouch.
I also get some stuck keys I was not getting before. I hope my userland did not go crazy...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 5 lines · Pavel Machek wrote/
Hi!
I started getting blinking capslock leds in 2.6.22-somewhere. Every 5 seconds or so, capslock led toggles on thinkpad x60. Ouch.
Could it be related to commit f038f9a361a764ed013447174b7170073f89cbe9 aka "Add keyboard blink driver" ? Probably you don't want it in hard in the kernel ;-)
See you,
Eric
Quoted 2 lines · Pavel Machek
I also get some stuck keys I was not getting before. I hope my userland did not go crazy...
I get that too, and wasn't sure about it either. It happens irregularly, so it's hard to debug, but often enough to be annoying.
My mouse pointer tends to warp too in the same irregular way, no idea if that's related (it seemed to happen in an earlier kernel version than the sticky key thing, but not sure, as I don't have this mouse that long.)
Greetings,
Indan
Quoted 4 lines · Indan Zupancic
Quoted 2 lines
I also get some stuck keys I was not getting before. I hope my userland did not go crazy...
I get that too, and wasn't sure about it either. It happens irregularly, so it's hard to debug, but often enough to be annoying.
What kind of keyboards are they? I guess the x60 case is serio/ps2, what keyboard do you experience this with, Indan?
Signature · 1 line
Jiri Kosina
Quoted 9 lines · Jiri Kosina
Quoted 4 lines · Indan Zupancic
Quoted 2 lines
I also get some stuck keys I was not getting before. I hope my userland did not go crazy...
I get that too, and wasn't sure about it either. It happens irregularly, so it's hard to debug, but often enough to be annoying.
What kind of keyboards are they? I guess the x60 case is serio/ps2, what keyboard do you experience this with, Indan?
Also serio/ps2:
input: AT Translated Set 2 keyboard as /class/input/input0
Quoted 4 lines · Pavel Machek
I started getting blinking capslock leds in 2.6.22-somewhere. Every 5 seconds or so, capslock led toggles on thinkpad x60. Ouch. I also get some stuck keys I was not getting before. I hope my userland did not go crazy...
Hi Pavel,
what does
grep BLINK .config
show?
Signature · 1 line
Jiri Kosina
Quoted 7 lines · Jiri Kosina
Quoted 4 lines · Pavel Machek
I started getting blinking capslock leds in 2.6.22-somewhere. Every 5 seconds or so, capslock led toggles on thinkpad x60. Ouch. I also get some stuck keys I was not getting before. I hope my userland did not go crazy...
Quoted 6 lines
Hi Pavel,
what does
grep BLINK .config
show.
CONFIG_BLINK=y
OOps. WTF is that?
config BLINK
tristate "Keyboard blink driver"
help
Driver that when loaded will blink the keyboard LEDs
continuously.
This is useful for debugging and for kernels that cannot
necessarily
output something to the screen like kexec kernels to give
the user
a visual indication that the kernel is doing something.
..does it need "default n"? Why does it make keys stuck sometimes?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 14 lines · Pavel Machek
CONFIG_BLINK=y
OOps. WTF is that?config BLINK
tristate "Keyboard blink driver"
help
Driver that when loaded will blink the keyboard LEDs
continuously.
This is useful for debugging and for kernels that cannot
necessarily
output something to the screen like kexec kernels to give
the user
a visual indication that the kernel is doing something.
..does it need "default n"? Why does it make keys stuck sometimes?
Are you sure that it's this dummy blink driver that makes the kernel stuck? I can't see how it could be causing any hogs - see commit f038f9.
Anyway, added Andi to CC.
Signature · 1 line
Jiri Kosina
Hi!
Quoted 15 lines
Quoted 14 lines
CONFIG_BLINK=y
OOps. WTF is that?config BLINK
tristate "Keyboard blink driver"
help
Driver that when loaded will blink the keyboard LEDs
continuously.
This is useful for debugging and for kernels that cannot
necessarily
output something to the screen like kexec kernels to give
the user
a visual indication that the kernel is doing something.
..does it need "default n"? Why does it make keys stuck sometimes?
Quoted 4 lines
Are you sure that it's this dummy blink driver that makes the kernel stuck? I can't see how it could be causing any hogs - see commit f038f9.
Anyway, added Andi to CC.
I'm not sure, and stuck keys are quite hard to reproduce. It only happened twice in two days. But I've never seen stuck key on this thinkpad x60 before, so...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 3 lines · Pavel Machek
I'm not sure, and stuck keys are quite hard to reproduce. It only happened twice in two days. But I've never seen stuck key on this thinkpad x60 before, so...
Dmitry should be on CC here, re-added.
Signature · 1 line
Jiri Kosina
Quoted 4 lines · Jiri Kosina
Are you sure that it's this dummy blink driver that makes the kernel stuck? I can't see how it could be causing any hogs - see commit f038f9.
Anyway, added Andi to CC.
Hmm, in theory it could be triggering bugs in some buggy keyboard controller. But then a
while true ; do setleds +caps +numlock ; sleep 1 ; setleds -caps -numlock ; sleep 1 ; done
should trigger it too.
Anyways; it is normally only intended for special
case kdump or other debugging kernels which tend to not get much interaction; you shouldn't really set it anywhere else.
I've been also considering to make it always dependent on a command line option, but that is not done yet.
-Andi
Hi!
Quoted 5 lines
Quoted 4 lines
Are you sure that it's this dummy blink driver that makes the kernel stuck? I can't see how it could be causing any hogs - see commit f038f9.
Anyway, added Andi to CC.
Quoted 7 lines
Hmm, in theory it could be triggering bugs in some buggy keyboard controller. But then a
while true ; do setleds +caps +numlock ; sleep 1 ; setleds -caps -numlock ; sleep 1 ; done
should trigger it too.
...and it does.
pavel@amd:~$ while true; do setleds +num; setleds -num; done Hm,m so thiis iis a teest of fkeyboarad behaviour under lloadd.
pavel@amd:~$
...but I'm not quite sure it is a buggy keyboard. It happens _way_ too often. Launch the line above and try to do some typing...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 17 lines · Pavel Machek
Hi!
Quoted 5 lines
Quoted 4 lines
Are you sure that it's this dummy blink driver that makes the kernel stuck? I can't see how it could be causing any hogs - see commit f038f9.
Anyway, added Andi to CC.
Quoted 7 lines
Hmm, in theory it could be triggering bugs in some buggy keyboard controller. But then a
while true ; do setleds +caps +numlock ; sleep 1 ; setleds -caps -numlock ; sleep 1 ; done
should trigger it too.
...and it does.
Quoted 7 lines
pavel@amd:~$ while true; do setleds +num; setleds -num; done Hm,m so thiis iis a teest of fkeyboarad behaviour under lloadd.pavel@amd:~$
...but I'm not quite sure it is a buggy keyboard. It happens _way_ too often. Launch the line above and try to do some typing...
This used to work fine on my box last time I tried it (the switch itself is offloaded to a keventd and shoud not get in the way) but then they push all kind of ACPI/SMM crap together with KBC so who knows... I should try it again when I get home.
Signature · 1 line
Dmitry
thinkpad testers wanted (was Re: 2.6.22-rc[23]: blinking capslock led, stuck keys?)
Hi!
Quoted 18 lines
Quoted 18 lines
Quoted 6 lines
Quoted 1 line
Anyway, added Andi to CC.
Hmm, in theory it could be triggering bugs in some buggy keyboard controller. But then a
while true ; do setleds +caps +numlock ; sleep 1 ; setleds -caps
-numlock ;
Quoted 3 lines
sleep 1 ; done
should trigger it too.
...and it does.
pavel@amd:~$ while true; do setleds +num; setleds -num; done Hm,m so thiis iis a teest of fkeyboarad behaviour under lloadd.pavel@amd:~$
Quoted 7 lines
Quoted 2 lines
...but I'm not quite sure it is a buggy keyboard. It happens _way_ too often. Launch the line above and try to do some typing...
This used to work fine on my box last time I tried it (the switch itself is offloaded to a keventd and shoud not get in the way) but then they push all kind of ACPI/SMM crap together with KBC so who knows... I should try it again when I get home.
Hmm, this needs to be ran from console (not X). Can someone with thinkpad try this?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: thinkpad testers wanted (was Re: 2.6.22-rc[23]: blinking capslock led, stuck keys?)
Quoted 23 lines · Pavel Machek
Hi!
Quoted 21 lines
Quoted 20 lines
Quoted 6 lines
Quoted 1 line
Anyway, added Andi to CC.
Hmm, in theory it could be triggering bugs in some buggy keyboard controller. But then a
while true ; do setleds +caps +numlock ; sleep 1 ; setleds -caps
-numlock ;
Quoted 3 lines
sleep 1 ; done
should trigger it too.
...and it does.
pavel@amd:~$ while true; do setleds +num; setleds -num; done Hm,m so thiis iis a teest of fkeyboarad behaviour under lloadd.pavel@amd:~$
...but I'm not quite sure it is a buggy keyboard. It happens _way_ too often. Launch the line above and try to do some typing...
Quoted 7 lines
Quoted 4 lines
This used to work fine on my box last time I tried it (the switch itself is offloaded to a keventd and shoud not get in the way) but then they push all kind of ACPI/SMM crap together with KBC so who knows... I should try it again when I get home.
Hmm, this needs to be ran from console (not X). Can someone with thinkpad try this?
The version that doesn't sleep totally messes up keyboard input on my T43. Some keypresses are totally ignored and the keys that are part of the "numpad" sometimes generate crap, e.g. holding down "j" results in j, 1 or ^[[4~
Björn
Re: thinkpad testers wanted (was Re: 2.6.22-rc[23]: blinking capslock led, stuck keys?)
Hi!
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 7 lines
pavel@amd:~$ while true; do setleds +num; setleds -num; done Hm,m so thiis iis a teest of fkeyboarad behaviour under lloadd.pavel@amd:~$
...but I'm not quite sure it is a buggy keyboard. It happens _way_ too often. Launch the line above and try to do some typing...
This used to work fine on my box last time I tried it (the switch itself is offloaded to a keventd and shoud not get in the way) but then they push all kind of ACPI/SMM crap together with KBC so who knows... I should try it again when I get home.
Quoted 7 lines
Quoted 2 lines
Hmm, this needs to be ran from console (not X). Can someone with thinkpad try this?
The version that doesn't sleep totally messes up keyboard input on my T43. Some keypresses are totally ignored and the keys that are part of the "numpad" sometimes generate crap, e.g. holding down "j" results in j, 1 or ^[[4~
Ok, I did not want to focus on "numpad" keys. Even normal keys misbehave for me, like being lost or duplicated. Strange.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: thinkpad testers wanted (was Re: 2.6.22-rc[23]: blinking capslock led, stuck keys?)
Quoted 18 lines · Pavel Machek
Hi!
Quoted 16 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
pavel@amd:~$ while true; do setleds +num; setleds -num; done Hm,m so thiis iis a teest of fkeyboarad behaviour under lloadd.pavel@amd:~$
Quoted 7 lines
Quoted 2 lines
...but I'm not quite sure it is a buggy keyboard. It happens _way_ too often. Launch the line above and try to do some typing...
This used to work fine on my box last time I tried it (the switch itself is offloaded to a keventd and shoud not get in the way) but then they push all kind of ACPI/SMM crap together with KBC so who knows... I should try it again when I get home.
Hmm, this needs to be ran from console (not X). Can someone with thinkpad try this?
Quoted 7 lines
Quoted 4 lines
The version that doesn't sleep totally messes up keyboard input on my T43. Some keypresses are totally ignored and the keys that are part of the "numpad" sometimes generate crap, e.g. holding down "j" results in j, 1 or ^[[4~
Ok, I did not want to focus on "numpad" keys. Even normal keys misbehave for me, like being lost or duplicated. Strange.
That also happens here. The numpad keys were a special case, sorry if I didn't make that clear enough.
Björn
Re: thinkpad testers wanted (was Re: 2.6.22-rc[23]: blinking capslock led, stuck keys?)
In reply to Pavel MachekQuoted 18 lines · Pavel Machek
Quoted 18 lines
Quoted 17 lines
Quoted 7 lines
Hmm, in theory it could be triggering bugs in some buggy keyboard controller. But then a
while true ; do setleds +caps +numlock ; sleep 1 ; setleds -caps -numlock ; sleep 1 ; done
should trigger it too.
...and it does.
pavel@amd:~$ while true; do setleds +num; setleds -num; done Hm,m so thiis iis a teest of fkeyboarad behaviour under lloadd.pavel@amd:~$
...but I'm not quite sure it is a buggy keyboard. It happens _way_ too often. Launch the line above and try to do some typing...
Quoted 7 lines
Quoted 4 lines
This used to work fine on my box last time I tried it (the switch itself is offloaded to a keventd and shoud not get in the way) but then they push all kind of ACPI/SMM crap together with KBC so who knows... I should try it again when I get home.
Hmm, this needs to be ran from console (not X). Can someone with thinkpad try this?
I see the same thing with a 2.6.21 kernel on a T42p.
HTH,
Johannes
Re: thinkpad testers wanted (was Re: 2.6.22-rc[23]: blinking capslock led, stuck keys?)
In reply to Pavel MachekQuoted 3 lines · Pavel Machek
Hmm, this needs to be ran from console (not X). Can someone with thinkpad try this?
Are you saying it works OK when run in X?
Signature · 1 line
Dmitry
Re: thinkpad testers wanted (was Re: 2.6.22-rc[23]: blinking capslock led, stuck keys?)
Quoted 6 lines · Dmitry Torokhov
Quoted 3 lines · Pavel Machek
Hmm, this needs to be ran from console (not X). Can someone with thinkpad try this?
Are you saying it works OK when run in X?
setleds does not work in X, so there's no problem there.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: thinkpad testers wanted (was Re: 2.6.22-rc[23]: blinking capslock led, stuck keys?)
In reply to Pavel MachekPavel Machek wrote:
[]
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
pavel@amd:~$ while true; do setleds +num; setleds -num; done Hm,m so thiis iis a teest of fkeyboarad behaviour under lloadd....but I'm not quite sure it is a buggy keyboard. It happens _way_ too often. Launch the line above and try to do some typing...
Quoted 7 lines
Quoted 4 lines
This used to work fine on my box last time I tried it (the switch itself is offloaded to a keventd and shoud not get in the way) but then they push all kind of ACPI/SMM crap together with KBC so who knows... I should try it again when I get home.
Hmm, this needs to be ran from console (not X). Can someone with thinkpad try this?
I don't have a thinkpad, but I tried it - just for fun - with my desktop PC here. And it also shows some.. strangeness. Namely, after several secounds, it starts spewing:
drivers/usb/input/hid-core.c: control queue fulldrivers/usb/input/hid-core.c: control queue fulldrivers/usb/input/hid-core.c: control queue full
messages on the screen on every setleds (above) invocation. Even if I stop the loop and execute single setleds manually, it also shows this same message. And the led isn't working anymore too - even if I press NumLock key, NumLock mode activates/deactivates correctly, but not the led -- ditto for other leds (CapsLock & ScrollLock). And it doesn't restore when I switch to X and back.
(My keyboard is USB-connected).
I think it's something about count of setleds/etc operations. Rebooting and counting from 0...
(2.6.21.3 here)
/mjt
Quoted 7 lines · Dmitry Torokhov
Quoted 2 lines
...but I'm not quite sure it is a buggy keyboard. It happens _way_ too often. Launch the line above and try to do some typing...
This used to work fine on my box last time I tried it (the switch itself is offloaded to a keventd and shoud not get in the way) but then they push all kind of ACPI/SMM crap together with KBC so who knows... I should try it again when I get home.
Err... in laptops, almost *always* the KDC is emulated by the embedded controller, so I bet you're right on the money, there. It is not "a buggy KDC", it is a buggy EC firmware and/or buggy SMBIOS which is a lot more common.
And DoS'ing the EC is very high on the Don't Do That list on a laptop. If the X60 is only losing keypresses and producing no bigger fireworks, that's outstanding behavior (as far as I trust ThinkPad firmware, anyway).
So please throttle anything that might access the KDC way too much (as compared to normal keyboard operation by an user).
Signature · 4 lines
"One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh
Quoted 14 lines · Henrique de Moraes Holschuh
Quoted 7 lines · Dmitry Torokhov
Quoted 2 lines
...but I'm not quite sure it is a buggy keyboard. It happens _way_ too often. Launch the line above and try to do some typing...
This used to work fine on my box last time I tried it (the switch itself is offloaded to a keventd and shoud not get in the way) but then they push all kind of ACPI/SMM crap together with KBC so who knows... I should try it again when I get home.
Err... in laptops, almost *always* the KDC is emulated by the embedded controller, so I bet you're right on the money, there. It is not "a buggy KDC", it is a buggy EC firmware and/or buggy SMBIOS which is a lot more common.
Quoted 6 lines
And DoS'ing the EC is very high on the Don't Do That list on a laptop. If the X60 is only losing keypresses and producing no bigger fireworks, that's outstanding behavior (as far as I trust ThinkPad firmware, anyway).
So please throttle anything that might access the KDC way too much (as compared to normal keyboard operation by an user).
What would be reasonable throttling? Once every 100 ms?
Signature · 1 line
Dmitry
Quoted 15 lines · Dmitry Torokhov
Quoted 14 lines · Henrique de Moraes Holschuh
Quoted 7 lines · Dmitry Torokhov
Quoted 2 lines
...but I'm not quite sure it is a buggy keyboard. It happens _way_ too often. Launch the line above and try to do some typing...
This used to work fine on my box last time I tried it (the switch itself is offloaded to a keventd and shoud not get in the way) but then they push all kind of ACPI/SMM crap together with KBC so who knows... I should try it again when I get home.
Err... in laptops, almost *always* the KDC is emulated by the embedded controller, so I bet you're right on the money, there. It is not "a buggy KDC", it is a buggy EC firmware and/or buggy SMBIOS which is a lot more common.
Quoted 8 lines
Quoted 6 lines
And DoS'ing the EC is very high on the Don't Do That list on a laptop. If the X60 is only losing keypresses and producing no bigger fireworks, that's outstanding behavior (as far as I trust ThinkPad firmware, anyway).
So please throttle anything that might access the KDC way too much (as compared to normal keyboard operation by an user).
What would be reasonable throttling? Once every 100 ms?
Well... this thread began with me having problems with leds blinking once per ten seconds. I do not think throttling is going to help.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 20 lines · Pavel Machek
Quoted 19 lines · Dmitry Torokhov
Quoted 18 lines · Henrique de Moraes Holschuh
Quoted 7 lines · Dmitry Torokhov
Quoted 2 lines
...but I'm not quite sure it is a buggy keyboard. It happens _way_ too often. Launch the line above and try to do some typing...
This used to work fine on my box last time I tried it (the switch itself is offloaded to a keventd and shoud not get in the way) but then they push all kind of ACPI/SMM crap together with KBC so who knows... I should try it again when I get home.
Err... in laptops, almost *always* the KDC is emulated by the embedded controller, so I bet you're right on the money, there. It is not "a buggy KDC", it is a buggy EC firmware and/or buggy SMBIOS which is a lot more common.
And DoS'ing the EC is very high on the Don't Do That list on a laptop. If the X60 is only losing keypresses and producing no bigger fireworks, that's outstanding behavior (as far as I trust ThinkPad firmware, anyway).
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
So please throttle anything that might access the KDC way too much (as compared to normal keyboard operation by an user).
What would be reasonable throttling? Once every 100 ms?
Well... this thread began with me having problems with leds blinking once per ten seconds. I do not think throttling is going to help.
For what it worth I finally tried that setleds loop on my laptop. I am not getting any lost keypresses/releases. But then I don't have EC (or at least it is not exported via ACPI). This is an old Dell notebook.
Signature · 1 line
Dmitry
Quoted 3 lines · Dmitry Torokhov
For what it worth I finally tried that setleds loop on my laptop. I am not getting any lost keypresses/releases. But then I don't have EC (or at least it is not exported via ACPI). This is an old Dell notebook.
Well, as I said before, I've the "stuck key"/repeated output too (as well as a warping PS/2 mouse), but no blinking led problem, so I believe the two things are totally unrelated.
Greetings,
Indan
Hi!
Quoted 7 lines
Quoted 3 lines
For what it worth I finally tried that setleds loop on my laptop. I am not getting any lost keypresses/releases. But then I don't have EC (or at least it is not exported via ACPI). This is an old Dell notebook.
Well, as I said before, I've the "stuck key"/repeated output too (as well as a warping PS/2 mouse), but no blinking led problem, so I believe the two things are totally unrelated.
Well, after turning off CONFIG_BLINK, my problems went away, and with a fast-blink done from userspace, I can make them way worse. They _are_ related here.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 7 lines · Pavel Machek
Quoted 3 lines
Well, as I said before, I've the "stuck key"/repeated output too (as well as a warping PS/2 mouse), but no blinking led problem, so I believe the two things are totally unrelated.
Well, after turning off
CONFIG_BLINK, my problems went away, and with a fast-blink done from userspace, I can make them way worse. They _are_ related here.
I missed you saying that before, so to me it looked like everyone just assumed that.
So, just for fun, I tried running:
while true; do setleds +num; setleds -num; done
and it totally locked up my keyboard. Even SysRq didn't work. On the bright side, the numlock LED was indeed blinking. Though running the same with a sleep 0.1 added doesn't produce any problems. So maybe my problem is indeed a bit related to this after all, somehow. Anyone any ideas how to debug this problem?
Greetings,
Indan
Quoted 9 lines · Indan Zupancic
Quoted 7 lines · Pavel Machek
Quoted 3 lines
Well, as I said before, I've the "stuck key"/repeated output too (as well as a warping PS/2 mouse), but no blinking led problem, so I believe the two things are totally unrelated.
Well, after turning off
CONFIG_BLINK, my problems went away, and with a fast-blink done from userspace, I can make them way worse. They _are_ related here.
Quoted 8 lines
I missed you saying that before, so to me it looked like everyone just assumed that.
So, just for fun, I tried running:
while true; do setleds +num; setleds -num; done
and it totally locked up my keyboard. Even SysRq didn't work.
Yeah, it does the same on my other laptop (newer HP as opposed to an old Dell).
Quoted 6 lines
On the
bright side, the numlock LED was indeed blinking. Though running the same with a sleep 0.1 added doesn't produce any problems. So maybe my problem is indeed a bit related to this after all, somehow. Anyone any ideas how to debug this problem?
Does the patch below help?
Signature · 104 lines
Dmitry Input: atkbd - throttle LED switching On some boxes keyboard controllers are too slow to withstand continuous flow of requests to turn keyboard LEDs on and off and start losing some keypresses or even all of them. Delay executing of LED switching request if we had another one withing 50 ms thus easing load on the controller. Signed-off-by: Dmitry Torokhov <[email protected]> --- drivers/input/keyboard/atkbd.c | 40 ++++++++++++++++++++++++++-------------- 1 files changed, 26 insertions(+), 14 deletions(-) Index: work/drivers/input/keyboard/atkbd.c =================================================================== --- work.orig/drivers/input/keyboard/atkbd.c +++ work/drivers/input/keyboard/atkbd.c @@ -219,7 +219,8 @@ struct atkbd { unsigned long time; unsigned long err_count; - struct work_struct event_work; + struct delayed_work event_work; + unsigned long event_jiffies; struct mutex event_mutex; unsigned long event_mask; }; @@ -565,7 +566,7 @@ static int atkbd_set_leds(struct atkbd * static void atkbd_event_work(struct work_struct *work) { - struct atkbd *atkbd = container_of(work, struct atkbd, event_work); + struct atkbd *atkbd = container_of(work, struct atkbd, event_work.work); mutex_lock(&atkbd->event_mutex); @@ -579,12 +580,30 @@ static void atkbd_event_work(struct work } /* + * Schedule switch for execution. We need to throttle requests, + * otherwise keyboard may become unresponsive. + */ +static void atkbd_schedule_event_work(struct atkbd *atkbd, int event_bit) +{ + unsigned long delay = msecs_to_jiffies(50); + + if (time_after(jiffies, atkbd->event_jiffies + delay)) + delay = 0; + + atkbd->event_jiffies = jiffies; + set_bit(event_bit, &atkbd->event_mask); + wmb(); + schedule_delayed_work(&atkbd->event_work, delay); +} + +/* * Event callback from the input module. Events that change the state of * the hardware are processed here. If action can not be performed in * interrupt context it is offloaded to atkbd_event_work. */ -static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) +static int atkbd_event(struct input_dev *dev, + unsigned int type, unsigned int code, int value) { struct atkbd *atkbd = input_get_drvdata(dev); @@ -594,19 +613,12 @@ static int atkbd_event(struct input_dev switch (type) { case EV_LED: - set_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask); - wmb(); - schedule_work(&atkbd->event_work); + atkbd_schedule_event_work(atkbd, ATKBD_LED_EVENT_BIT); return 0; case EV_REP: - - if (!atkbd->softrepeat) { - set_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask); - wmb(); - schedule_work(&atkbd->event_work); - } - + if (!atkbd->softrepeat) + atkbd_schedule_event_work(atkbd, ATKBD_REP_EVENT_BIT); return 0; } @@ -940,7 +952,7 @@ static int atkbd_connect(struct serio *s atkbd->dev = dev; ps2_init(&atkbd->ps2dev, serio); - INIT_WORK(&atkbd->event_work, atkbd_event_work); + INIT_DELAYED_WORK(&atkbd->event_work, atkbd_event_work); mutex_init(&atkbd->event_mutex); switch (serio->id.type) {
Quoted 1 line · Dmitry Torokhov
Does the patch below help?
Didn't try it yet, but will tomorrow.
Quoted 47 lines
Input: atkbd - throttle LED switching
On some boxes keyboard controllers are too slow to withstand continuous flow of requests to turn keyboard LEDs on and off and start losing some keypresses or even all of them.
Delay executing of LED switching request if we had another one withing 50 ms thus easing load on the controller.
Signed-off-by Dmitry Torokhov <[email protected]>---
drivers/input/keyboard/atkbd.c | 40 ++++++++++++++++++++++++++-------------- 1 files changed, 26 insertions(+), 14 deletions(-)Index:
work/drivers/input/keyboard/atkbd.c
===================================================================drivers/input/keyboard/atkbd.c +8
-2@@ -219,7 +219,8 @@ struct atkbd {unsigned long time;unsigned long err_count; -struct work_struct event_work; +struct delayed_work event_work; +unsigned long event_jiffies;struct mutex event_mutex;unsigned long event_mask; };@@ -565,7 +566,7 @@ static int atkbd_set_leds(struct atkbd *static void atkbd_event_work (struct work_struct *work) { - struct atkbd *atkbd = container_of(work, struct atkbd, event_work); + struct atkbd *atkbd = container_of(work, struct atkbd, event_work.work);mutex_lock (&atkbd->event_mutex);@@ -579,12 +580,30 @@ static void atkbd_event_work(struct work }/* +* Schedule switch for execution. We need to throttle requests, +* otherwise keyboard may become unresponsive. +*/ +static void atkbd_schedule_event_work (struct atkbd *atkbd,int event_bit) +{
drivers/input/keyboard/atkbd.c static void atkbd_event_work(struct work · line 597
Quoted 10 lines
drivers/input/keyboard/atkbd.c +10
-0+unsigned long delay =msecs_to_jiffies (50 ); + +if (time_after (jiffies, atkbd->event_jiffies + delay)) + delay =0 ; + + atkbd->event_jiffies = jiffies; +set_bit (event_bit, &atkbd->event_mask); +wmb (); +schedule_delayed_work (&atkbd->event_work, delay); +}
I don't know whether schedule_delayed_work() requeues event_work, or if it adds more work, but both seem to give wrong behaviour: In the first case event_work can be postponed forever if atkbd_schedule_event_work() is called repeatedly each time within 50 ms, and for the second case there's a delay added, but the number of times the LED is switched stays the same, so it's not being throttled.
Greetings,
Indan
Quoted 12 lines · Indan Zupancic
Quoted 11 lines · Dmitry Torokhov
/*
+ * Schedule switch for execution. We need to throttle requests,
+ * otherwise keyboard may become unresponsive.
+ */(quoted diff) +7
-0+static void atkbd_schedule_event_work(struct atkbd *atkbd, int event_bit) +{ + unsigned long delay = msecs_to_jiffies(50); + + if (time_after(jiffies, atkbd->event_jiffies + delay)) + delay = 0; +
Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ atkbd->event_jiffies = jiffies; + set_bit(event_bit, &atkbd->event_mask); + wmb(); + schedule_delayed_work(&atkbd->event_work, delay); +}I don't know whether
schedule_delayed_work()requeuesevent_work, or if it adds more work, but both seem to give wrong behaviour:
Well, my advise would be to research the matter before saying that it will not work.
Quoted 6 lines
In the first case
event_workcan be postponed forever ifatkbd_schedule_event_work()is called repeatedly each time within 50 ms, and for the second case there's a delay added, but the number of times the LED is switched stays the same, so it's not being throttled.
No, once work is queued for execution subsequent attempts to queue the same work will be ignored (until work starts executing). Therefore first time work will be scheduled for execution immediately and then execution be spaced by ~50 ms.
Signature · 1 line
Dmitry
Quoted 22 lines · Dmitry Torokhov
Quoted 12 lines · Indan Zupancic
Quoted 11 lines · Dmitry Torokhov
/*
+ * Schedule switch for execution. We need to throttle requests,
+ * otherwise keyboard may become unresponsive.
+ */(quoted diff) +7
-0+static void atkbd_schedule_event_work(struct atkbd *atkbd, int event_bit) +{ + unsigned long delay = msecs_to_jiffies(50); + + if (time_after(jiffies, atkbd->event_jiffies + delay)) + delay = 0; +Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ atkbd->event_jiffies = jiffies; + set_bit(event_bit, &atkbd->event_mask); + wmb(); + schedule_delayed_work(&atkbd->event_work, delay); +}I don't know whether
schedule_delayed_work()requeuesevent_work, or if it adds more work, but both seem to give wrong behaviour:
Quoted 2 lines
Well, my advise would be to research the matter before saying that it will not work.
Good advise. My advise to others is, that if you do research it, then don't do it hastily like I did. ;-)
My quick search didn't find the exact behaviour of schedule_delayed_work(), when looking in LDD, but I should've digged through to the description of queue_delayed_work().
Quoted 11 lines
Quoted 6 lines
In the first case
event_workcan be postponed forever ifatkbd_schedule_event_work()is called repeatedly each time within 50 ms, and for the second case there's a delay added, but the number of times the LED is switched stays the same, so it's not being throttled.No, once work is queued for execution subsequent attempts to queue the same work will be ignored (until work starts executing). Therefore first time work will be scheduled for execution immediately and then execution be spaced by ~50 ms.
Thank you for the explanation.
I applied the patch, and it compiles and runs as expected, can't lockup the keyboard anymore with it applied.
Greetings,
Indan
Quoted 4 lines · Indan Zupancic
I applied the patch, and it compiles and runs as expected, can't lockup the keyboard anymore with it applied.
Thank you for testing.
Signature · 1 line
Dmitry
Quoted 6 lines · Henrique de Moraes Holschuh
And DoS'ing the EC is very high on the Don't Do That list on a laptop. If the X60 is only losing keypresses and producing no bigger fireworks, that's outstanding behavior (as far as I trust ThinkPad firmware, anyway).
So please throttle anything that might access the KDC way too much (as compared to normal keyboard operation by an user).
The io port accesses are already throttled and the blinking are quite slow in computer time (talking about hundreds of milliseconds). It is hard to imagine the EC is that slow.
-Andi
Quoted 2 lines · Jiri Kosina
Are you sure that it's this dummy blink driver that makes the kernel stuck? I can't see how it could be causing any hogs - see commit f038f9.
To make it clear, I'm not using the blink driver and get the stuck key problem too. (And also a warpy PS/2 mouse.)
Wildly guessing: As the problem doesn't seem to be widespread, perhaps it's suspend to ram related. I'll try running a while without suspending and see if it crops up too then.
Greetings,
Indan
Hi!
Quoted 9 lines
Quoted 2 lines
Are you sure that it's this dummy blink driver that makes the kernel stuck? I can't see how it could be causing any hogs - see commit f038f9.
To make it clear, I'm not using the blink driver and get the stuck key problem too. (And also a warpy PS/2 mouse.)
Wildly guessing: As the problem doesn't seem to be widespread, perhaps it's suspend to ram related. I'll try running a while without suspending and see if it crops up too then.
It is not suspend related -- at least on my machine anyway.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html