From: "Indan Zupancic" <indan@nul.nu>
To: "Dmitry Torokhov" <dtor@insightbb.com>
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: Sat, 16 Jun 2007 04:04:33 +0200 (CEST) [thread overview]
Message-ID: <33677.81.207.0.53.1181959473.squirrel@secure.samage.net> (raw)
In-Reply-To: <200706150141.06142.dtor@insightbb.com>
On Fri, June 15, 2007 07:41, Dmitry Torokhov wrote:
> Does the patch below help?
Didn't try it yet, but will tomorrow.
> 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);
> +}
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
next prev parent reply other threads:[~2007-06-16 2:05 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-04 11:24 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
2007-06-16 2:04 ` Indan Zupancic [this message]
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=33677.81.207.0.53.1181959473.squirrel@secure.samage.net \
--to=indan@nul.nu \
--cc=ak@suse.de \
--cc=dtor@insightbb.com \
--cc=hmh@hmh.eng.br \
--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
all inboxes | Powered by JetHome®