From: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
To: William King <William.King@dadaboom.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Bug: 2.4.xx in serial.c
Date: Tue, 18 Feb 2003 00:00:06 +0100 [thread overview]
Message-ID: <20030217230006.GA1797@wohnheim.fh-wedel.de> (raw)
In-Reply-To: <JAEGLIPFMODKGALKJJGNOEJGCAAA.William.King@dadaboom.com>
On Mon, 17 February 2003 12:32:49 -0800, William King wrote:
>
> I've traced what appears to be a bug in the serial driver (serial.c) in
> regards to how the transmit fifo is handled on some uarts.
>
> In the function transmit_chars() around line 6016:
>
> count = info->xmit_fifo_size;
> do {
> serial_out(info, UART_TX, info->xmit.buf[info->xmit.tail]);
> info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1);
> info->state->icount.tx++;
> if (info->xmit.head == info->xmit.tail)
> break;
> } while (--count > 0);
>
> This loop fills the xmit fifo with up to the number of characters which the
> fifo can hold. If we have more characters to send than the fifo can handle,
> we will take an interrupt when the fifo empties and run this loop again.
>
> The assumption is however that the fifo empty interrupt will occur when the
> number of characters in the xmit fifo is 0. This is true on a 16550A uart,
> but is not true on others (such as a ST16C654.) The ST16C654 uart has a 64
> byte fifo, but the interrrupt will occur when the number of characters drops
> below a programmable threshold. The minimum threshold is 8 on this uart
> which causes an overflow of the xmit fifo.
>
> My thought for a patch is to add a field to struct async_struct to indicate
> the maximum number of characters which still may be in the fifo when an
> interrupt occurs. The only other thing I can think of is to poll the fifo
> full bit which every character write, but this seems like a bad idea.
I'd go with the extra field:
+static int threshold = 0;
[...]
-count = info->xmit_fifo_size;
+count = info->xmit_fifo_size - threshold;
[...]
+if (ST16C654) {
+ threshold = 8;
+ ST16C654_set_threshold(threshold);
+}
IO operations are usually quite expensive, so polling should be a last
resort only.
Jörn
--
More computing sins are committed in the name of efficiency (without
necessarily achieving it) than for any other single reason - including
blind stupidity.
-- W. A. Wulf
prev parent reply other threads:[~2003-02-17 22:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-17 20:32 William King
2003-02-17 23:00 ` Jörn Engel [this message]
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=20030217230006.GA1797@wohnheim.fh-wedel.de \
--to=joern@wohnheim.fh-wedel.de \
--cc=William.King@dadaboom.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®