linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Taichi Kageyama <t-kageyama@cp.jp.nec.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	"jslaby@suse.cz" <jslaby@suse.cz>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"prarit@redhat.com" <prarit@redhat.com>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Subject: Re: [PATCH 1/2] serial: 8250: Fix autoconfig_irq() to avoid race conditions
Date: Wed, 08 Jul 2015 19:35:26 -0400	[thread overview]
Message-ID: <559DB3BE.5080306@hurleysoftware.com> (raw)
In-Reply-To: <55717294.8020905@cp.jp.nec.com>

On 06/05/2015 05:57 AM, Taichi Kageyama wrote:
> The following race conditions can happen if a serial is used as console.
>   Case1. CPU_B handles an interrupt from a serial
>     autoconfig_irq() fails whether the interrupt is raised or not
>     if CPU_B is disabled to handle interrupts for longer than it expects.
>   Case2. CPU_B clears UART_IER just after CPU_A sets UART_IER
>     A serial may not make an interrupt.
>     autoconfig_irq() can fail if the interrupt is not raised.
>   Case3. CPU_A sets UART_IER just after CPU_B clears UART_IER
>     This is an unexpected behavior for uart_console_write().
> 
>   CPU_A [autoconfig_irq]      CPU_B [serial8250_console_write]
>   -----------------------------------------------------------------
>   probe_irq_on()              spin_lock_irqsave(&port->lock,)
>   serial_outp(,UART_IER,0x0f) serial_out(,UART_IER,0)
>   udelay(20);                 uart_console_write()
>   probe_irq_off()
>                               spin_unlock_irqrestore(&port->lock,)
>   -----------------------------------------------------------------
> 
> If autoconfig_irq() fails, the console doesn't work in interrupt mode,
> the mode cannot be changed anymore, and "input overrun"
> (which can make operation mistakes) happens easily.
> This problem happens with high rate every boot once it occurs
> because the boot sequence is always almost same.

Reviewed-by: Peter Hurley <peter@hurleysoftware.com>

  reply	other threads:[~2015-07-08 23:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-05  9:55 [PATCH 0/2] serial: 8250: Workaround to avoid irq=0 for console Taichi Kageyama
2015-06-05  9:57 ` [PATCH 1/2] serial: 8250: Fix autoconfig_irq() to avoid race conditions Taichi Kageyama
2015-07-08 23:35   ` Peter Hurley [this message]
2015-07-23 22:32   ` gregkh
2015-07-29  8:13     ` Taichi Kageyama
2015-06-05 10:03 ` [PATCH 2/2] serial: 8250: Allow to skip autoconfig_irq() for a console Taichi Kageyama
2015-07-08 11:55   ` Peter Hurley
2015-07-08 12:53     ` Prarit Bhargava
2015-07-08 13:51       ` Peter Hurley
2015-07-08 14:00         ` Prarit Bhargava
2015-07-09  5:32           ` Taichi Kageyama
2015-07-11  0:12             ` Peter Hurley
2015-07-14  1:16               ` Taichi Kageyama
2015-07-14 19:29                 ` Peter Hurley
2015-07-16  9:58                   ` Taichi Kageyama
2015-07-20 16:36                     ` Peter Hurley
2015-07-21  9:44                       ` Taichi Kageyama
2015-07-27 19:44                         ` Peter Hurley
2015-07-29  8:09                           ` Taichi Kageyama
2015-07-07  8:13 ` [PATCH 0/2] serial: 8250: Workaround to avoid irq=0 for console Taichi Kageyama
2015-07-07 22:42   ` gregkh

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=559DB3BE.5080306@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=prarit@redhat.com \
    --cc=t-kageyama@cp.jp.nec.com \
    /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;
as well as URLs for NNTP newsgroup(s).