public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesse Pollard <pollard@admin.navo.hpc.mil>
To: Larry McVoy <lm@bitmover.com>, venom@sns.it
Cc: Matthias Andree <matthias.andree@gmx.de>,
	linux-kernel@vger.kernel.org, andre@linux-ide.org
Subject: Re: Honest does not pay here ...
Date: Wed, 8 Jan 2003 08:59:07 -0600	[thread overview]
Message-ID: <200301080859.07911.pollard@admin.navo.hpc.mil> (raw)
In-Reply-To: <20030108003050.GF17310@work.bitmover.com>

On Tuesday 07 January 2003 06:30 pm, Larry McVoy wrote:
> > In very semplicistic words:
> > In 2.5/2.6 kernels, non GPL modules have a big
> > penalty, because they cannot create their own queue, but have to use a
> > default one.
>
> I may be showing my ignorance here (won't be the first time) but this makes
> me wonder if Linux could provide a way to do "user level drivers".  I.e.,
> drivers which ran in kernel mode but in the context of a process and had
> to talk to the real kernel via pipes or whatever.  It's a fair amount of
> plumbing but could have the advantage of being a more stable interface
> for the drivers.
>
> If you think about it, drivers are more or less
> open/close/read/write/ioctl. They need kernel privileges to do their thing
> but don't need (and shouldn't have) access to all the guts of the kernel.
>
> Can any well traveled driver people see this working or is it nuts?

The big problem is overhead.

The last successful user mode driver I used was in the old RSX-11
systems - all drivers were user mode.

The other place user mode drivers are used is in microkernel structures.

The problem is context switching time. If the hardware isn't designed to
support 10-20 simultaneous contexts, you must save/restore register sets
on each interrupt for the device.

If you split the driver into a kernel interface driver (the 
open/close/read/write/ioctl style) then you have a VERY limited time
for doing certain types of processing - consider the time delays that
would get imposed on audio synthesis - each segment must be encoded
by the driver before being sent to the kernel interface driver. The 
application then has to switch:
	appuser mode ->kernel->user mode driver->kernel mode
		interface->user mode driver->kernel->appuser mode
Before the application being able to resynchronize with the video.. which
would go through the same type of interface.

What Linux is using is more like a real time system. The tasklets/task queues
are more like a full featured RT system with priority queues. This allows a
fair amount of processing to be done by the driver without requiring heavy
handed context switching loads. What it appears to lack for a RT system is
a guaranteed interrupt latency.

In a microkernel envionment (where it can work) there need to be enough 
resources available to minimize the context switching - The Cray T3 used
basic Alpha processors (a LOT of them). The UNICOS kernel on top of the
microkernel distributed the load by puting only one or two drivers per
processor.

These drivers appear (I didn't get to see the source) to perform full context
switches for each interrupt/read/write/open/close/ioctl. The key here is that
the processor really doesn't have to do anything else. Cache memory remains
hot, and nothing is delayed.

User applications run on totally different CPUs (out of 1048 processors, 40
of them might be OS processors, out of the 40 there might be 20 that are 
filesystem/device drivers, the others handle user batch scheduling 
scheduling, resource allocation and  system calls. 8 to 10 additional ones
are used for "command" processors (not handling batch jobs) used for
complers, interactive access, and non-parallel utilties. The rest are
 "application processors" and are dedicated to batch and/or parallel programs.

I have never really seen a generic processor that could run user mode
drivers very well - even the PDP-11s could not do that well for certain
devices, and they only had 8 registers to save/restore.

I would think that user mode drivers would need (ideally):

1. multiple user register sets in hardware - at least (5 to 10).
2. near zero context switching - calling for the MMU to support (5 to 10) 
	simultaneous contexts.
3. use one control register to switch between user register sets and MMU
	contexts.
4. multiple cache memory modules ... 10 desirable, one per register set.
5. multiple processing levels (almost every processor has 2, Intel has 4)

The 5-10 register sets/MMU sets is based on:

1. disk driver
1. filesystem driver
1. video driver
1. keyboard driver
1. system call/user process

If more drivers are loaded/active then you would want more or you get into
scheduling collisions with context save/restore overhead. It would also
be desirable to have one for the system call/scheduler to eliminate that
overhead too, but IMHO that one can be shared with the user process.

Context switching time should be very nearly equivalent to a subroutine call
then - select the context, select the entry point, switch. Any parameter
passing could be almost the same as a subroutine parameter + a cache miss.
-- 
-------------------------------------------------------------------------
Jesse I Pollard, II
Email: pollard@navo.hpc.mil

Any opinions expressed are solely my own.

  parent reply	other threads:[~2003-01-08 14:53 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-04 18:09 Honest does not pay here Adam J. Richter
2003-01-05 22:03 ` Henning P. Schmiedehausen
2003-01-05 22:53   ` David van Hoose
2003-01-05 23:14     ` Henning P. Schmiedehausen
2003-01-06  0:22       ` David van Hoose
2003-01-06  9:31         ` Henning Schmiedehausen
2003-01-06 23:41         ` Matthias Andree
2003-01-06 23:59           ` Andre Hedrick
2003-01-07  0:07           ` Andrew Walrond
2003-01-07  0:51             ` Steven Barnhart
2003-01-07  9:57               ` Henning P. Schmiedehausen
2003-01-07 11:21                 ` Alexander Kellett
2003-01-07 23:04                 ` Daniel Egger
2003-01-07  1:24             ` Matthias Andree
2003-01-07 10:07               ` Henning P. Schmiedehausen
2003-01-07 12:44                 ` Alan Cox
2003-01-12 23:36                 ` Matthias Andree
2003-01-07 16:32               ` Bill Davidsen
2003-01-07 17:21                 ` Ryan Anderson
2003-01-07 18:33                 ` Jesse Pollard
2003-01-07 19:24                   ` Bill Davidsen
2003-01-07 20:58                   ` Andre Hedrick
2003-01-07 23:09                     ` Jesse Pollard
2003-01-08  0:24                       ` Andre Hedrick
2003-01-07 23:35                   ` Matthias Andree
2003-01-07 23:33                 ` Matthias Andree
2003-01-07 14:24           ` Dana Lacoste
2003-01-07 23:28             ` Matthias Andree
2003-01-08  0:24               ` venom
2003-01-08  0:30                 ` Larry McVoy
2003-01-08  0:54                   ` venom
2003-01-08  1:10                     ` Andre Hedrick
2003-01-08 10:08                       ` venom
2003-01-08 11:05                         ` Andre Hedrick
     [not found]                         ` <Pine.LNX.4.10.10301080249330.421-100000@master.linux-ide.o rg>
2003-01-08 15:25                           ` Stephen Satchell
2003-01-08  1:10                   ` Matthias Andree
2003-01-08  1:41                   ` Alan Cox
2003-01-08 14:59                   ` Jesse Pollard [this message]
2003-01-10 14:30                   ` Pavel Machek
     [not found]                 ` <mailman.1041987068.25081.linux-kernel2news@redhat.com>
2003-01-08  4:19                   ` User mode drivers (Honest does not pay here ...) Pete Zaitcev
2003-01-08  6:17                     ` Dmitry A. Fedorov
  -- strict thread matches above, loose matches on Subject: below --
2003-01-13  0:18 Honest does not pay here Adam J. Richter
2003-01-12  9:27 Adam J. Richter
2003-01-12 10:25 ` Andrew McGregor
2003-01-12 13:52 ` Paul Jakma
2003-01-08  7:29 Hell.Surfers
2003-01-08 20:59 ` Philip Dodd
2003-01-09 23:27   ` Bill Davidsen
     [not found] <Pine.LNX.3.96.1030107112017.15952A-100000@gatekeeper.tmr.com>
2003-01-07 20:04 ` Steven Barnhart
2003-01-06  2:08 Adam J. Richter
2003-01-05 20:21 Adam J. Richter
2003-01-05 20:29 ` Andre Hedrick
2003-01-05 22:28   ` Trever L. Adams
2003-01-06  0:01     ` Andrew McGregor
2003-01-06  0:15       ` Trever L. Adams
2003-01-06  1:43         ` Stephen Satchell
2003-01-06  7:40           ` Trever L. Adams
2003-01-06  8:37             ` Andre Hedrick
2003-01-06  2:03         ` Ian Molton
2003-01-06  3:14         ` Andrew McGregor
2003-01-06  2:18   ` jw schultz
2003-01-06  1:03 ` Larry McVoy
2003-01-05 12:34 Adam J. Richter
2003-01-05 19:31 ` William Lee Irwin III
2003-01-05 12:26 Adam J. Richter
2003-01-05 14:51 ` Larry McVoy
2003-01-05 15:33 ` Alan Cox
2003-01-05 20:07   ` Andre Hedrick
2003-01-05 15:45 ` Andre Hedrick
2003-01-05  0:25 Adam J. Richter
2003-01-05  3:21 ` Paul Jakma
2003-01-05 11:24   ` Andrew McGregor
2003-01-05 15:53   ` Matthew Zahorik
2003-01-05 18:16     ` Mike Galbraith
2003-01-05 19:47       ` Bruce Harada
2003-01-05 20:06         ` Mike Galbraith
2003-01-05 22:54         ` Andre Hedrick
2003-01-04 17:05 Billy Rose
2003-01-04 14:12 Andre Hedrick
2003-01-04 14:22 ` Murray J. Root
2003-01-04 14:28 ` William Lee Irwin III
2003-01-04 14:49 ` Andrew McGregor
2003-01-04 15:28 ` Rik van Riel
2003-01-04 20:48   ` Andre Hedrick
2003-01-04 20:56     ` Mark Rutherford
2003-01-04 17:06 ` Steve Lee
2003-01-04 18:38 ` Andrew Walrond
2003-01-04 21:50 ` brian

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=200301080859.07911.pollard@admin.navo.hpc.mil \
    --to=pollard@admin.navo.hpc.mil \
    --cc=andre@linux-ide.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm@bitmover.com \
    --cc=matthias.andree@gmx.de \
    --cc=venom@sns.it \
    /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