Re: Announce: ndiswrapper

From: Linus Torvalds
Date: Fri Nov 21 2003 - 02:29:16 EST



On 20 Nov 2003, H. Peter Anvin wrote:
> By author: Bill Davidsen <davidsen@xxxxxxx>
> >
> > I'm curious if the NDIS stuff could be run in ring 1 or 2, being an old
> > MULTICS guy. Not for political reasons, just good tech.
>
> Unfortunately the segmentation and paging were so poorly integrated in
> i386 that rings 1-2 are pretty much totally useless.

That may be the politically sensitive (except to Intel) correct answer,
but in the end I suspect that the _real_ answer is that ring 1/2 are just
fundamentally useless, and it has nothing to do with x86 implementation
semantics or anything else.

Any kind of reasonable performance driver requires direct access to the
buffers it is going to fill in. And not just the actual data contents, but
to the metadata too - the pointers that comprise the skb (or in BSD, mbuf)
lists, etc.

So even if you were to use ring1/2 for the driver, you'd really need to
give write access to a large portion of the data structures that the
"core" kernel networking would use.

Which means that you either put the core kernel in ring1/2 as well (at
which point you don't actually use ring0 for anything interesting at all -
you could put a microkernel there, but hey, there's no real point), or you
map in a _lot_ of ring0 metadata into ring1/2, at which point you lost the
whole point of using a different protection domain.

And quite frankly, if you're willing to actually dynamically map all the
ranges and be careful, why use ring1/2 at all? You might as well use ring3
and make the whole thing be a user-mode wrapper. You'd never perform
really well, but for debugging it is acceptable.

Anyway, whatever way you turn, ring1/2 just don't actually _give_ you
anything. Which is, in the end, the _real_ reason nobody uses them.

(I agree, the fact that the x86 paging hardware makes 1/2/3 be equivalent
makes it an even _less_ useful abstraction, but I think it is a mistake to
think that it would be any more useful even if the page tables wasted
precious bits on unnecessary level information).

Multi-ring was a failure. Let it go. The only reason it is making
something of a comeback (Palladium-whatever-it-is-called-today) has no
good technical reasons, and is purely about other things.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/