public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vojtech Pavlik <vojtech@suse.cz>
To: Sau Dan Lee <danlee@informatik.uni-freiburg.de>
Cc: Giuseppe Bilotta <bilotta78@hotpop.com>,
	linux-kernel@vger.kernel.org,
	Tuukka Toivonen <tuukkat@ee.oulu.fi>
Subject: Re: keyboard problem with 2.6.6
Date: Sun, 30 May 2004 14:16:06 +0200	[thread overview]
Message-ID: <20040530121606.GA1496@ucw.cz> (raw)
In-Reply-To: <xb765aeb1i3.fsf@savona.informatik.uni-freiburg.de>

On Sun, May 30, 2004 at 01:25:24PM +0200, Sau Dan Lee wrote:

>     Vojtech> Well, keyboard support was always in the kernel
> 
> Once in kernel space, forever in kernel space?  What's the logic?
> 
> Where  it is  now possible  to  move it  out of  kernel space  WITHOUT
> performance problems, why not move it out?

Because it just works.

1) Upgrading the kernel will make your keyboard stop working. Noone has
installed your userspace daemons on the system.

2) The keyboard (and other input devices, so that you don't complain
about limiting this to the keyboard) should work without requiring
userspace to be running.

And, it works just fine in the kernel, doesn't take up any more space
than as a program, so why to move it out?

>     Vojtech>  - you need it there, because you need the keyboard
>     Vojtech> always to work
> 
> Then, why make 'i8042' and  'atkbd' modules?  I still remember reading
> web pages  that early  pioneers who migrated  from 2.4  to 2.6.0-test*
> encountered a problem: they didn't compile-in these modules, and hence
> the system boot  up without a responding keyboard.   Despite that, the
> system does work and daemons are running!
> 
> So, why is a the keyboard need to always work?

This is getting really annoying. Let me rephrase it again:

I don't have a keyboard on every of my systems. But when I have it and I
have the driver running, I expect it to work. Regardless of what
happened to the system. Regardless of userspace programs dying. Just
work.

> I've  been  testing  'i8042'  module  and my  atkbd  driver  (and  the
> SERIO_USERDEV  patch) through  the  network.  I've  been doing  'rmmod
> i8042' many many times.  The system DOES work without that module (and
> keyboard  functionality).   Why are  you  saying  that  "you need  the
> keyboard  always  to  work"?   Again,   is  that  the  limit  of  your
> imagination?

Yes. The system doesn't need the keyboard drivers to function. The user
does.

> Are you aware of the i8042_shutdown bug, which I discovered and fixed?
> How could I have found such a bug, if "keyboard has to always work"?

Thanks for the fix.

> And  how about  mouse  drivers?  They  used  to be  in userland  (gpm,
> XFree86 3.x -- 4.x, etc.)  Why move it into the kernel?

You wanted to use a mouse click to dump registers?

>     Vojtech> I meant that keyboard handling was never done in
>     Vojtech> userspace. 
> 
> OK.  Then, it's time to consider moving it to userspace.

I'm not interested.

I'd have an interesting idea for you, though: If you want moving stuff
to userspace, move the whole console there. The font handling, the
keymap handling, colors, resolution, all that.

Just a simple program that uses the evdev interface to get the keyboard
data for input, the fbdev interface for output, and the pty interface to
communicate with the system.

Now *that* would be a great project moving stuff to userspace.

>     Vojtech> Of course it is modular now, but that still counts as 'in
>     Vojtech> the kernel'.
> 
> How about my atkbd.c?

It's in userspace. It's not running in the kernel space. It's subject to
the scheduler and swapping. It doesn't react to interrupts immediately.
I think that's quite clear.

>     Vojtech> ;) On embedded systems, or when you have an USB
>     Vojtech> keyboard, you can leave the whole PS/2 stuff out.
> 
> Is  it impossible  to run  daemons driving  the keyboard  (my atkbd.c,
> should  be invoked  from inittab)  and mouse  (e.g.  gpm)  on embedded
> systems?  I mean, why MUST the keyboard and mouse drivers be in kernel
> space?

Of course it's possible. There is not much that'd be impossible in
operating systems. It's not convenient, that's all. 

>     Vojtech> But still, if you have a working keyboard, the handling
>     Vojtech> is done in the kernel, and you can do a register dump,
>     Vojtech> process listing, etc, even when the system is
>     Vojtech> crashed.
> 
> Why just  the keyboard?  For that  purpose, we can  use mouse buttons,
> the  power button,  a joystick  button, or  even a  home-brewed button
> connected to the RS232 port or parallel port.  Why *limit* that to the
> keyboard?

Use whatever device you wish. I don't restrict you to just the keyboard.
The above argument works for a mouse, for a joystick, for an infrared
remote all the same.

>     Vojtech> You wouldn't be able to do that if the processing of the
>     Vojtech> byte stream was done in an userspace program.
> 
> Isn't it  possible to monitor  the kernel via  a tty connected  to the
> serial line?

It is. Surprise, the SAK and SysRq handling for that is done
_in_the_kernel_, because it doesn't want to depend on userspace.

>     Vojtech> - even in the case of a crash, when all userspace
>     Vojtech> programs may already be dead.
>     >>  There are still RS232 ports and the network.
> 
>     Vojtech> Sure. How convenient it is to have to find an RS232
>     Vojtech> cable, when your keyboard is just next to you on the
>     Vojtech> table?
> 
> The keyboard should be made an *option*, not a *requirement* for that.
> As an optional feature, yo shouldn't assume it for granted.

It IS an option, not a requirement. But I WANT THE OPTION. If the
keyboard handling is in userspace, I don't have the option of pressing a
key combination and getting a register dump, because the daemon doing
the processing may be dead already.

>     Vojtech> It can. But if your userspace is dead, you cannot run
>     Vojtech> that program. And that's usually when you need sysrq.
> 
> So, why limit that to the  keyboard only?  Why can't my LED lid switch
> do it?

Go ahead. It's just a matter of adding a few lines to the ACPI drivers,
registering the lid switch as an input device.

>     >>  Is that "improvement" significant for 1200 baud devices?  Even
>     >> on a 386DX-33?
> 
>     Vojtech> Yes. Very much significant. Exactly because they're
>     Vojtech> running at 1200 baud, you need get most of that little
>     Vojtech> data they're sending to you. 
> 
> I don't  understand this.  The slower  a device is, the  lesser is the
> need to handle the incoming  data in kernel space.  I can't understand
> how 1200baud is  fast enough to cause significant  delays.  Maybe, you
> can enlighten me on that?

> Yeah.  At  what rate  are they arriving?   1200baud.  Let's  say that'
> 9600bps.   So,   1200  bytes  per   second.   1  byte  in   every  833
> microseconds.  How  come a processor at 33MHz  (0.030 microseconds per
> clock cycle) cannot  cope with that?  Assuming that  the processing of
> the  data  plus  context  switching  plus  other  overhead  taks  1000
> microseconds, that still shouldn't be felt by a HUMAN user.  Who has a
> reaction time of less than 100 _milli_seconds?

Can you say swap?

>     Vojtech> Yes, it does. Because it uses the _kernel_ input system
>     Vojtech> to do the interfacing work. But I don't see any benefit
>     Vojtech> of having to go to userspace and back again into the
>     Vojtech> kernel.
> 
> Flexibility.  The  keyboard driver can  talk to another machine  via a
> TCP  connection, for  instance.   The keyboard  driver  can be  easily
> modified  and debugged --  all in  user space  -- without  hanging the
> kernel due to  stupid bugs (e.g. NULL pointers).   The keyboard driver
> could be prototyped  in Perl, C++, or any  other high-level languages.
> (It'd be possible  to design a specific language to  make it easier to
> describe the state machine, than in a general purpose language like C,
> making it possible to  less programming-proficient users to change the
> keyboard behaviours.)

Go play with microkernel systems. You'll meet people with similar views
there. Linux is not a microkernel, though.

>     Vojtech> Care to name any? Everything from raw SCSI handling to
>     Vojtech> presenting files to processes is done in the
>     Vojtech> kernel. 
> 
> So,  raw access  is  still available,  just  in case  the kernel  code
> developers' imaginations are exceeded in some applications.

Yes, and it's good. And I don't object to having raw access available. I
really don't. I just want to have it done in a sane way that doesn't
conflict with the kernel drivers. Like in SCSI.

>     Vojtech> Good argument. There are limits of what makes sense to do
>     Vojtech> in the kernel.  Ghostscript is easier to do in userspace,
>     Vojtech> because it needs access to fonts, has a nontrivial
>     Vojtech> configuration, isn't time critical, etc. Good candidate
>     Vojtech> for userspace.
> 
> Keyboard and mouse drivers are also easier to do in userspace, because
> that  makes access to  keymaps, mouse  protocol modules,  etc. easier.
> Neither do I think keyboard/mouse  drivers are time critical enough to
> be absolutely  placed in  kernel space.  Human  beings do not  work in
> units of milliseconds.

The keyboard and mouse drivers don't handle keymaps. Those are handled
in the console. The keyboard/mouse drivers are not necessarily _time_
critical, but they're critical. When your keyboard stops working, this
often means your system is dead. (Think a laptop on an airplane.)

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

  parent reply	other threads:[~2004-05-30 12:15 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-07 20:55 [PATCH] SERIO_USERDEV: direct userspace access to mouse/keyboard psaux serial ports Tuukka Toivonen
2004-05-08  2:35 ` Andrew Morton
2004-05-25 20:16   ` keyboard problem with 2.6.6 Chris Osicki
2004-05-26  7:54     ` Sau Dan Lee
2004-05-28 13:33       ` Giuseppe Bilotta
2004-05-28 17:37       ` Sau Dan Lee
2004-05-29 13:12         ` Vojtech Pavlik
2004-05-30  9:45           ` Sau Dan Lee
2004-05-30 10:19             ` Vojtech Pavlik
2004-05-30 11:25               ` Sau Dan Lee
2004-05-30 11:40                 ` Brad Campbell
2004-05-30 12:01                 ` Oliver Neukum
2004-05-30 12:22                   ` Sau Dan Lee
2004-05-30 12:32                     ` Oliver Neukum
2004-05-30 12:16                 ` Vojtech Pavlik [this message]
2004-05-30 12:40                   ` Sau Dan Lee
2004-05-30 12:52                     ` Vojtech Pavlik
2004-05-30 16:09                     ` Stefan Seyfried
2004-05-30 17:26                     ` Dmitry Torokhov
2004-06-04 13:58                 ` Pavel Machek
2004-06-04 18:17                   ` Horst von Brand
2004-06-04 18:37                     ` Valdis.Kletnieks
2004-06-04 19:33                       ` Denis Vlasenko
2004-06-04 19:50                         ` Valdis.Kletnieks
2004-06-04 20:48                           ` Denis Vlasenko
2004-06-04 18:39                     ` Pavel Machek
2004-06-04 18:46                       ` Sau Dan Lee
2004-06-04 19:09                         ` Pavel Machek
2004-06-06  9:01                           ` Sau Dan Lee
2004-06-06 16:40                             ` Pavel Machek
2004-05-28 19:39       ` 2.6.* useland replacements of the atkbd and psmouse modules Sau Dan Lee
2004-05-28 19:57       ` keyboard problem with 2.6.6 Andries Brouwer
2004-06-01  8:21       ` BUG: atkbd.c keyboard driver bug [Was: keyboard problem with 2.6.6] Sau Dan Lee
2004-06-01  9:13       ` BUG FIX: " Sau Dan Lee
     [not found]       ` <200406010904.i5194pSo010367@fire-2.osdl.org>
2004-06-01  9:44         ` Sau Dan Lee
2004-06-01  9:55           ` Vojtech Pavlik
2004-06-01 10:03             ` Sau Dan Lee
2004-06-01 12:42             ` Giuseppe Bilotta
2004-05-28 19:41     ` keyboard problem with 2.6.6 Andries Brouwer
2004-05-28 20:10       ` Andries Brouwer
     [not found]       ` <20040528214620.GA2352@gucio>
2004-05-29 13:23         ` Andries Brouwer
2004-05-29 13:46           ` Vojtech Pavlik
2004-05-29 14:30             ` Andries Brouwer
2004-05-29 14:41               ` Vojtech Pavlik
2004-05-29 15:12             ` Giuseppe Bilotta
     [not found] <xb7oenxyqly.fsf@savona.informatik.uni-freiburg.de>
     [not found] ` <200406071551.i57Fpl89023562@turing-police.cc.vt.edu>
     [not found]   ` <xb7zn7fwdia.fsf@savona.informatik.uni-freiburg.de>
     [not found]     ` <200406071636.i57Gafh7024942@turing-police.cc.vt.edu>
     [not found]       ` <xb7r7sqwncc.fsf@savona.informatik.uni-freiburg.de>
     [not found]         ` <200406081502.i58F2gF3013622@turing-police.cc.vt.edu>
2004-06-09  8:17           ` Sau Dan Lee
2004-06-09 16:56             ` Valdis.Kletnieks
2004-06-09 17:12               ` Sau Dan Lee
2004-06-09 17:29                 ` Valdis.Kletnieks
  -- strict thread matches above, loose matches on Subject: below --
2004-06-06  9:43 Sau Dan Lee
2004-06-06  9:37 Sau Dan Lee
2004-06-06 11:29 ` Martin Schlemmer
2004-06-06 12:07 ` Vojtech Pavlik
2004-06-06 15:09 ` Dmitry Torokhov
2004-06-06 16:13   ` Sau Dan Lee
     [not found]   ` <200406061929.45169.vda@port.imtp.ilyichevsk.odessa.ua>
     [not found]     ` <200406061140.35929.dtor_core@ameritech.net>
2004-06-06 16:51       ` Sau Dan Lee
     [not found] <xb7ekp2b34y.fsf@savona.informatik.uni-freiburg.de>
     [not found] ` <20040530112138.GC1377@ucw.cz>
2004-05-30 11:43   ` Sau Dan Lee
2004-05-30 12:45     ` Vojtech Pavlik
2004-05-30 13:25       ` Sau Dan Lee
2004-05-30 10:57 Sau Dan Lee
2004-06-01 11:31 ` Pavel Machek
2004-06-01 14:06   ` John Bradford
2004-05-30 10:45 Sau Dan Lee
2004-05-30 11:20 ` Vojtech Pavlik
2004-05-30 10:39 Sau Dan Lee
2004-05-30 11:18 ` Vojtech Pavlik
2004-05-30 11:40   ` Sau Dan Lee
2004-05-30 11:53     ` Russell King
2004-05-30 12:43     ` Vojtech Pavlik
2004-05-30 13:25       ` Sau Dan Lee
2004-06-01 21:01         ` jsimmons
2004-06-01 21:12           ` Valdis.Kletnieks
2004-05-30 13:54       ` Eduard Bloch
2004-05-30 14:03         ` Vojtech Pavlik
2004-06-01 21:03           ` jsimmons
2004-06-04 14:11     ` Pavel Machek
2004-05-28 13:59 Tuukka Toivonen
2004-05-29 13:14 ` Vojtech Pavlik
2004-06-04 14:54   ` Tuukka Toivonen
2004-06-04 16:06     ` Vojtech Pavlik
     [not found] <MPG.1b2111558bc2d299896a2@news.gmane.org.suse.lists.linux.kernel>
     [not found] ` <20040525201616.GE6512@gucio.suse.lists.linux.kernel>
     [not found]   ` <xb7hdu3fwsj.fsf@savona.informatik.uni-freiburg.de.suse.lists.linux.kernel>
     [not found]     ` <xb7aczscv0q.fsf@savona.informatik.uni-freiburg.de.suse.lists.linux.kernel>
     [not found]       ` <20040529131233.GA6185@ucw.cz.suse.lists.linux.kernel>
     [not found]         ` <xb7y8nab65d.fsf@savona.informatik.uni-freiburg.de.suse.lists.linux.kernel>
     [not found]           ` <20040530101914.GA1226@ucw.cz.suse.lists.linux.kernel>
     [not found]             ` <xb765aeb1i3.fsf@savona.informatik.uni-freiburg.de.suse.lists.linux.kernel>
     [not found]               ` <20040530121606.GA1496@ucw.cz.suse.lists.linux.kernel>

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=20040530121606.GA1496@ucw.cz \
    --to=vojtech@suse.cz \
    --cc=bilotta78@hotpop.com \
    --cc=danlee@informatik.uni-freiburg.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tuukkat@ee.oulu.fi \
    /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