From: Sergei Organov <osv@javad.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Andrew Morton <akpm@osdl.org>,
gregkh@suse.de, linux-kernel@vger.kernel.org,
linux-usb-devel@lists.sourceforge.net
Subject: Re: [PATCH] Airprime driver improvements to allow full speed EvDO transfers
Date: Mon, 10 Jul 2006 14:36:55 +0400 [thread overview]
Message-ID: <87d5cdg308.fsf@javad.com> (raw)
In-Reply-To: <1152302831.20883.63.camel@localhost.localdomain> (Alan Cox's message of "Fri, 07 Jul 2006 21:07:11 +0100")
Alan Cox <alan@lxorguk.ukuu.org.uk> writes:
> Ar Gwe, 2006-07-07 am 21:23 +0400, ysgrifennodd Sergei Organov:
>> It seems that there is much worse problem here. The amount of data that
>> has been inserted by the tty_insert_flip_string() could be up to
>> URB_TRANSFER_BUFFER_SIZE (=4096 bytes) and may easily exceed
>> TTY_THRESHOLD_THROTTLE (=128 bytes) defined in the
>> char/n_tty.c.
>
> You may throttle late but that is always true as there is an implicit
> race between the hardware signals and the chip FIFO on all UART
> devices.
I don't talk about races here. What I see is simple logical software
problem arose due to poor interface between ldisc and tty. One can't
easily reproduce it with UART drivers unless UART FIFO is larger than
128 bytes, and even if such an UART exists, I think the RS232 is too
slow anyway so that in practice tty never tries to flip more than 128
bytes when ldisc buffer is almost full. I.e., it's hardware
characteristics of UARTs/RS232 that prevent the problem from being
triggered.
However, the problem is easily seen for USB-to-tty drivers where there
are no UARTS anywhere and speeds are rather high so that more than 4096
bytes (the line discipline buffer size) could be received before a task
has a chance to read from the line discipline buffer, and single flip
size is not limited by the hardware.
> The buffering should be taking care of it, and the tty layer taking care
> not to over stuff the ldisc
Well, it should, but it doesn't seem to, -- that's the problem :(
Moreover, looking into the source code I don't see how tty can take care
not to over-stuff the ldisc. ldisc`s receive_buf() routine doesn't tell
the caller how many chars it actually consumed and silently throws away
whatever doesn't fit into its buffer. After it threw away unknown (to
the caller) amount of bytes, it calls throttle(), but first it's too
late and second tty flip code doesn't handle throttle() itself
anyway. So once again how this "tty layer taking care not to over stuff
the ldisc" is supposed to work?
Overall, the definition of the problem is: one can't reliably flip more
than 128 bytes at once without danger of missing of bytes. [This in turn
implies that with tty->low_latency set to 0 one can't reliably flip any
bytes at all(!) as N flips of M bytes each may be effectively converted
into delayed flip of M*N bytes.]
> which I thought Paul had fixed while doing the locking wizardry
I don't think locking has anything to do about it, but if it's indeed
fixed, where can I take the patch(es) as it doesn't seem to be fixed in
2.17.4?
--
Sergei.
next prev parent reply other threads:[~2006-07-10 10:37 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-30 5:48 [PATCH] Airprime driver improvements to allow full speed EvDO transfers Andy Gay
2006-06-30 7:10 ` Andrew Morton
2006-06-30 8:52 ` Pete Zaitcev
2006-06-30 16:59 ` Andy Gay
2006-06-30 10:51 ` Sergei Organov
2006-06-30 12:13 ` [linux-usb-devel] " Alan Cox
2006-06-30 12:02 ` Arjan van de Ven
2006-06-30 13:34 ` Alan Cox
2006-06-30 16:35 ` Andy Gay
2006-07-07 17:23 ` Sergei Organov
2006-07-07 20:07 ` Alan Cox
2006-07-10 10:36 ` Sergei Organov [this message]
2006-07-10 11:10 ` Alan Cox
2006-07-10 15:54 ` Sergei Organov
2006-07-10 17:31 ` Alan Cox
2006-07-10 17:24 ` Sergei Organov
2006-07-13 14:17 ` Sergei Organov
2006-07-13 15:40 ` Alan Cox
2006-07-13 18:20 ` Sergei Organov
2006-07-13 19:08 ` Greg KH
2006-07-14 10:13 ` Sergei Organov
2006-06-30 20:04 ` Roland Dreier
2006-06-30 20:13 ` Andy Gay
2006-07-02 18:48 ` Roland Dreier
2006-07-02 20:29 ` Andy Gay
2006-07-02 20:47 ` Roland Dreier
2006-07-03 7:00 ` Jeremy Fitzhardinge
2006-07-03 14:21 ` Andy Gay
2006-07-03 16:28 ` Jeremy Fitzhardinge
2006-07-03 17:00 ` Andy Gay
2006-07-03 17:00 ` Greg KH
2006-07-03 17:55 ` Andy Gay
2006-07-03 18:08 ` Jeremy Fitzhardinge
2006-07-03 18:16 ` Greg KH
2006-07-03 22:43 ` Andy Gay
2006-07-03 15:43 ` [linux-usb-devel] " Ken Brush
2006-07-03 16:19 ` Andy Gay
2006-07-11 18:31 ` Sergei Organov
2006-07-11 18:55 ` Andy Gay
2006-07-12 9:20 ` Sergei Organov
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=87d5cdg308.fsf@javad.com \
--to=osv@javad.com \
--cc=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=gregkh@suse.de \
--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