Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 May 2008 23:15:20 -0700
From:      "Peter Wemm" <peter@wemm.org>
To:        "Poul-Henning Kamp" <phk@phk.freebsd.dk>
Cc:        Ed Schouten <ed@80386.nl>, current@freebsd.org, arch@freebsd.org, Robert Watson <rwatson@freebsd.org>, Ade Lovett <ade@freebsd.org>, net@freebsd.org, "Bruce M. Simpson" <bms@freebsd.org>
Subject:   Re: HEAD UP: non-MPSAFE network drivers to be disabled (was: 8.0 network stack MPsafety goals (fwd))
Message-ID:  <e7db6d980805262315n7313dff4u3c9386a740b9ef3e@mail.gmail.com>
In-Reply-To: <42521.1211829076@critter.freebsd.dk>
References:  <20080526161608.GE64397@hoeg.nl> <42521.1211829076@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, May 26, 2008 at 12:11 PM, Poul-Henning Kamp <phk@phk.freebsd.dk> wrote:
> In message <20080526161608.GE64397@hoeg.nl>, Ed Schouten writes:
>
>>The new TTY layer should still support line disciplines, [...]
>
> Actually...  I think it shouldn't.
>
> Line-disc's were introduced to interface weird-ass hardware like
> digitizing tablets that had very high data rates, but very little
> information (16 bit X, 16 bit Y and a couple of buttons, like modern
> mice) which would cost inordinate amounts of CPU time to support
> in userland on a VAX computer.
>
> If_slip.c happened in the kernel because there was no tun device,
> people cranked the speed up all they could (Hands up: who has changed
> the Xtal on a VAX serial port for faster SLIP ?)
>
> if_ppp happened because that was how if_slip did it.
>
> Today there is no longer a market for line disciplines and in
> practice we have only one: the POSIX mandated "termios", which also
> emulates the older "termio" ioctls.
>
> Anybody who cares to browse the three pages of text that RFC1055
> contains, will see that implementing SLIP in userland using tun(4)
> and the code on the other three pages of RFC1055 is a trivial task
> not even worthy of a SoC student.
>
> PPP over async is already much better handled in ppp(8) thanks
> to Brians valiant effort back in the stoneage of the internet.
>
> We should summarily kill the concept of line disciplines as a
> modular component and decide that TTYs can be used with termios(4)
> or raw mode and leave it at that.

Amen brother!!

I'd like if_sl.c and if_ppp.c/ppp_tty.c to go away simply so that we
don't have to keep the line discipline switch in its current form.
Let the tty layer rewrite have a free hand at doing whatever locking
strategy is most appropriate for ttys, without having to worry about
line disciplines and the lock order problems that come with if_sl.c.

There is a reason why we merged the splnet() and spltty() interrupt
masks back when we had spl()s.  The tty stack cross called into the
network stack via if_sl, and vice versa.  ppp_tty.c had a hack to
create a swi (thread) to partly hack around this where it was most
critical to limit blocking of interrupts.

To make this work is likely going to need a full taskq or thread for
both if_sl.c and ppp_tty.c.  It just isn't worth it.  Especially when
we have a better option in userland for ppp, and slip is a few dozen
lines of code around a if_tun select loop.  I've written 75% of what
it would take to do slip in userland at least two or three times
already, over the last 10 years.

It just isn't worth it.  Let line disciplines die and give Ed a free
hand to do ttys "right".

Line disciplines were there so that we could push processing for
things like serial mice into the kernel and reduce context switches.
We've been doing that in userland for the last 14+ years.

-- 
Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com
"All of this is for nothing if we don't go to the stars" - JMS/B5
"If Java had true garbage collection, most programs would delete
themselves upon execution." -- Robert Sewell



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e7db6d980805262315n7313dff4u3c9386a740b9ef3e>