From: Al Borchers <alborchers@steinerpoint.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-usb-devel <linux-usb-devel@lists.sourceforge.net>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [linux-usb-devel] Re: new locking in change_termios breaks USB serial drivers
Date: Fri, 01 Oct 2004 13:14:46 -0500 [thread overview]
Message-ID: <415D9E96.1030207@steinerpoint.com> (raw)
In-Reply-To: 1096645773.21958.54.camel@localhost.localdomain
Alan Cox wrote:
> In a waiting case the driver will get
>
> ->chars_in_buffer
> until it returns zero
> ->wait_until_sent
> ->change_termios
>
> which serializes with respect to the one writer. If you have a writer
> during a termios change by another well tough luck, you lose and I've
> no intention of changing that behaviour unless someone cites a standard
> requiring it.
Right, of course.
My comments about TCSETAW just muddled the issue. Scratch those.
The problem is that a non-sleeping USB serial set_termios has to
return before it can be sure the termios settings have taken effect.
With USB we can send an urb to the device telling it to change termios
settings, but without waiting for the urb callback we don't know
that the device has received the command and actually changed the
settings.
So data written immediately following the set_termios, in the same
process, might possibly be sent out the serial port before the
termios changes have taken effect.
There are several solutions:
* The tty layer could use a semaphore so the USB serial set_termios could
sleep until the new termios settings have taken effect before returning.
* The USB serial driver could hold off sending data to the device after a
non-sleeping set_termios until it knew the settings had taken effect in
the device.
* Maybe in practice this is not a problem--we can just say "set_termios
for USB serial devices will change the termios settings as soon as
possible, but there is a slight chance data written immediately after
set termios might go out under the previous termios settings".
* Or ... other suggestions?
-- Al
next prev parent reply other threads:[~2004-10-01 18:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-01 10:40 new locking in change_termios breaks USB serial drivers Al Borchers
2004-10-01 11:36 ` Alan Cox
2004-10-01 16:24 ` Al Borchers
2004-10-01 15:49 ` Alan Cox
2004-10-01 18:14 ` Al Borchers [this message]
2004-10-02 15:08 ` [linux-usb-devel] " Alan Cox
2004-10-02 17:19 ` Al Borchers
2004-10-01 20:15 ` Stuart MacDonald
2004-10-01 17:42 ` Greg KH
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=415D9E96.1030207@steinerpoint.com \
--to=alborchers@steinerpoint.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
/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