From: Paul Fulghum <paulkf@microgate.com>
To: "Roland Caßebohm" <roland.cassebohm@VisionSystems.de>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Serial driver hangs
Date: Tue, 28 Sep 2004 16:10:31 -0500 [thread overview]
Message-ID: <1096405831.2513.37.camel@deimos.microgate.com> (raw)
In-Reply-To: <200409281734.38781.roland.cassebohm@visionsystems.de>
On Tue, 2004-09-28 at 10:34, Roland Caßebohm wrote:
> As I can see, the bit TTY_DONT_FLIP in tty->flags is set, so
> the receive-buffer can't be flipped. In receive_chars() all
> ports are checked for received bytes, but if the buffer is
> full and can't be flipped, no byte are read from the UART and
> the interrupt will never go inactive.
Definately a bug.
It is the same in 2.6 kernels (serial/8250.c).
One way or another, the interrupt must be cleared.
(serviced or deactivated)
> I have tried just to read all byte left in the FIFO of the
> UART in that case and throw them away.
In my opinion, this is the correct way to handle the problem.
This is what I do in the SyncLink drivers.
> This is working but would probably not the best way, because
> there could be enough place in the other flip buffer. Maybe
> it is possible to disable the receive interrupt of the UART
> till the receive routine read_chan(), which sets
> TTY_DONT_FLIP, releases the buffer.
The flip buffer and N_TTY line disciplines are
generic facilities for all tty drivers. They can't
directly perform device specific tasks like
enabling/disabling UART interrupts.
Adding notification to the driver to do these
tasks does not seem like a win either.
On a receive IRQ, the UART Rx FIFO
is already running out of space. If you
disable the rx IRQ, you will likely still lose
data shortly after.
That said, the flip buffer code could be improved
to provide better buffering to prevent lost data.
There may also be synchronization problems:
The driver usually calls tty_flip_buffer_push at
hard IRQ context to queue a task (flush_to_ldisc)
to feed the data to the line discipline. In the case
of a full flip buffer, the driver calls flush_to_ldisc
directly (via tty->flip.tqueue.routine) at hard IRQ context.
I don't see any locking in the flip buffer code
to synchronize this.
--
Paul Fulghum
paulkf@microgate.com
next prev parent reply other threads:[~2004-09-28 21:11 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-28 15:34 Serial driver hangs Roland Caßebohm
2004-09-28 21:10 ` Paul Fulghum [this message]
2004-09-28 21:16 ` Russell King
2004-09-28 23:03 ` Paul Fulghum
2004-09-28 22:12 ` Alan Cox
2004-09-29 1:12 ` Paul Fulghum
2004-09-29 13:09 ` Roland Caßebohm
2004-09-29 13:17 ` Paul Fulghum
2004-09-29 14:07 ` Roland Caßebohm
2004-09-29 14:25 ` Paul Fulghum
2004-09-30 16:16 ` Roland Caßebohm
2004-09-30 19:09 ` Paul Fulghum
2004-09-30 18:34 ` Alan Cox
2004-09-30 19:51 ` Paul Fulghum
2004-09-30 19:59 ` Russell King
2004-09-30 20:05 ` Paul Fulghum
2004-09-30 20:30 ` Paul Fulghum
2004-09-30 20:10 ` Alan Cox
2004-09-30 21:25 ` Paul Fulghum
2004-10-01 0:47 ` Paul Fulghum
2004-10-01 15:22 ` Roland Caßebohm
2004-10-01 16:06 ` Paul Fulghum
2004-10-01 20:13 ` Stuart MacDonald
2004-10-01 20:36 ` Paul Fulghum
2004-09-29 14:13 ` Paul Fulghum
2004-10-01 15:25 ` Roland Caßebohm
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=1096405831.2513.37.camel@deimos.microgate.com \
--to=paulkf@microgate.com \
--cc=linux-kernel@vger.kernel.org \
--cc=roland.cassebohm@VisionSystems.de \
/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