Re: new locking in change_termios breaks USB serial drivers

From: Al Borchers
Date: Fri Oct 01 2004 - 11:32:49 EST


Alan Cox wrote:
How much of a problem is this, would it make more sense to make the
termios locking also include a semaphore to serialize driver side events
and not the spin lock ?

Its a design decision for the tty layer. You should choose whatever is
best there and the drivers will have to adapt.

I don't know how many tty drivers have assumed that set_termios can sleep,
like the USB serial drivers have. If that is an implicit part of tty API
that other drivers depend on, then, if possible, it seems much better to keep
the API the same and continue to allow set_termios to sleep.

I think the USB serial drivers can just queue up urbs to the device
with commands to set the termios settings and return without waiting
for those urbs to complete. There are potential synchronization issues,
however. The termios settings might go into different USB queues than
the data, and so it is possible that data sent immediately after a
set_termios might get to the device before the new termios settings.

To correctly support TCSETAW/TCSETSW the USB serial drivers would have to
have two different versions of set_termios--a non sleeping one to be called
through the tty API and a sleeping one to use with TCSETAW/TCSETSW ioctls
so the ioctl would not return until the settings were guaranteed to have
taken effect. Not many USB serial drivers support TCSETAW/TCSETSW now.

-- Al


-
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/