Re: calling context when writing to tty_driver

From: Paul Mackerras (paulus@samba.org)
Date: Thu Oct 03 2002 - 04:51:10 EST


Greg KH writes:

> On Tue, Oct 01, 2002 at 11:10:34PM +0200, Martin Diehl wrote:
> > If we agree serial drivers shouldn't sleep in write_room()/write() my
> > impression is this needs to be addressed somehow, regardless whether
> > usbserial uses the new serial core or not. Anybody tried this with a
> > bluetooth dongle over usbserial?
>
> I don't know, do we agree that you can't sleep in those functions? If
> so, I'll look into fixing the usbserial drivers up.

I really think that write and write_room shouldn't be allowed to
sleep. If they can sleep it will cause much grief for PPP, since the
PPP start_xmit function does get called in softirq context, and in the
common case where you are doing PPP over a serial port, that will
ultimately end up in a call to the serial port's write routine. If we
can't call the write routine from softirq context, that will mean we
will have to have some sort of helper thread (whether that is keventd
or something else), and that will introduce extra unnecessary latency
when you are using a serial port where the write routine doesn't ever
block (which is all of them except usbserial, at the moment).

I would have thought that the normal tty line discipline would impose
the same requirement. You type a character, it gets put in a flip
buffer and processed later in softirq context. That processing says
"we're supposed to echo this character" so it will call the serial
port's write routine - in softirq context, if I am not mistaken.

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



This archive was generated by hypermail 2b29 : Mon Oct 07 2002 - 22:00:38 EST