public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Ingo van Lil <inguin@gmx.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Serial: UART_BUG_TXEN race conditions
Date: Mon, 26 Jun 2006 21:25:36 +0100	[thread overview]
Message-ID: <20060626202536.GJ21272@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20060626220747.zmkyd4smqs0o044s@mail.tu-chemnitz.de>

On Mon, Jun 26, 2006 at 10:07:47PM +0200, Ingo van Lil wrote:
> Correct me if I'm mistaken, but I see two possible race conditions with 
> that piece of code:
> 
> 1. What if the IIR actually equals UART_IIR_THRI at that point? The
>    read access will clear the interrupt condition and the workaround
>    will effect the actual opposite of its intention: Neither
>    serial8250_start_tx() nor the interrupt handler will start
>    transmitting characters for the ring buffer.

Gah, looks like you're right - reading the IIR will clear the transmit
pending interrupt, so we should probably just load the transmitter up
with characters anyway if the TEMT bit is set.

> 2. What if an interrupt is triggered shortly after reading the IIR?
>    Both serial8250_start_tx() and the interrupt handler will start
>    a transmission simultaneously.

This function is run under the port spinlock, so the interrupt handler
will be held off until it completes.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

  reply	other threads:[~2006-06-26 20:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-26 20:07 Serial: UART_BUG_TXEN race conditions Ingo van Lil
2006-06-26 20:25 ` Russell King [this message]
2006-06-26 20:52   ` Ingo van Lil
2006-06-28  8:00   ` [PATCH] " Ingo van Lil
2006-06-27 13:05 ` linux-os (Dick Johnson)
2006-06-27 19:19   ` Ingo van Lil
2006-06-27 19:59     ` linux-os (Dick Johnson)
2006-06-27 20:47   ` H. Peter Anvin

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=20060626202536.GJ21272@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=inguin@gmx.de \
    --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