From: Dmitry Torokhov <dtor@insightbb.com>
To: Indan Zupancic <indan@nul.nu>
Cc: Pavel Machek <pavel@ucw.cz>,
Henrique de Moraes Holschuh <hmh@hmh.eng.br>,
Andi Kleen <ak@suse.de>, Jiri Kosina <jikos@jikos.cz>,
kernel list <linux-kernel@vger.kernel.org>
Subject: Re: 2.6.22-rc[23]: blinking capslock led, stuck keys?
Date: Fri, 15 Jun 2007 01:41:05 -0400 [thread overview]
Message-ID: <200706150141.06142.dtor@insightbb.com> (raw)
In-Reply-To: <41219.81.207.0.53.1181743761.squirrel@secure.samage.net>
On Wednesday 13 June 2007 10:09, Indan Zupancic wrote:
> On Wed, June 13, 2007 10:18, Pavel Machek wrote:
> >> 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.
Yeah, it does the same on my other laptop (newer HP as opposed
to an old Dell).
> 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?
--
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 <dtor@mail.ru>
---
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) {
next prev parent reply other threads:[~2007-06-15 5:41 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-04 11:24 2.6.22-rc[23]: blinking capslock led, stuck keys? Pavel Machek
2007-06-04 12:08 ` Éric Piel
2007-06-04 12:35 ` Jiri Kosina
2007-06-04 13:09 ` Pavel Machek
2007-06-04 13:12 ` Jiri Kosina
2007-06-04 13:36 ` Pavel Machek
2007-06-04 13:38 ` Jiri Kosina
2007-06-04 13:43 ` Andi Kleen
2007-06-04 13:54 ` Pavel Machek
2007-06-04 14:02 ` Dmitry Torokhov
2007-06-04 14:13 ` thinkpad testers wanted (was Re: 2.6.22-rc[23]: blinking capslock led, stuck keys?) Pavel Machek
2007-06-04 15:06 ` Björn Steinbrink
2007-06-04 15:10 ` Pavel Machek
2007-06-04 16:20 ` Björn Steinbrink
2007-06-04 15:11 ` Johannes Stezenbach
2007-06-04 15:18 ` Dmitry Torokhov
2007-06-04 20:55 ` Pavel Machek
2007-06-04 16:40 ` Michael Tokarev
2007-06-04 16:34 ` 2.6.22-rc[23]: blinking capslock led, stuck keys? Henrique de Moraes Holschuh
2007-06-04 17:46 ` Dmitry Torokhov
2007-06-04 20:57 ` Pavel Machek
2007-06-12 5:42 ` Dmitry Torokhov
2007-06-12 23:35 ` Indan Zupancic
2007-06-13 8:18 ` Pavel Machek
2007-06-13 14:09 ` Indan Zupancic
2007-06-15 5:41 ` Dmitry Torokhov [this message]
2007-06-16 2:04 ` Indan Zupancic
2007-06-16 3:34 ` Dmitry Torokhov
2007-06-16 11:54 ` Indan Zupancic
2007-06-16 15:58 ` Dmitry Torokhov
2007-06-04 18:04 ` Andi Kleen
2007-06-04 15:10 ` Indan Zupancic
2007-06-04 15:13 ` Pavel Machek
2007-06-04 12:35 ` Indan Zupancic
2007-06-04 12:38 ` Jiri Kosina
2007-06-04 14:43 ` Indan Zupancic
[not found] <8siVc-46n-17@gated-at.bofh.it>
[not found] ` <8sktY-6G7-13@gated-at.bofh.it>
[not found] ` <8skDC-6Su-5@gated-at.bofh.it>
[not found] ` <8sl6G-7uE-9@gated-at.bofh.it>
[not found] ` <8slgk-7Gl-3@gated-at.bofh.it>
[not found] ` <8slq0-89X-9@gated-at.bofh.it>
[not found] ` <8snLc-3ik-29@gated-at.bofh.it>
2007-06-06 11:26 ` Bodo Eggert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200706150141.06142.dtor@insightbb.com \
--to=dtor@insightbb.com \
--cc=ak@suse.de \
--cc=hmh@hmh.eng.br \
--cc=indan@nul.nu \
--cc=jikos@jikos.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox