From: Peter Hurley <peter@hurleysoftware.com>
To: Taichi Kageyama <t-kageyama@cp.jp.nec.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"tglx@linutronix.de" <tglx@linutronix.de>
Cc: "jiang.liu@linux.intel.com" <jiang.liu@linux.intel.com>,
"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"jslaby@suse.cz" <jslaby@suse.cz>,
"prarit@redhat.com" <prarit@redhat.com>,
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Subject: Re: [RFC PATCH v2 1/3] serial: 8250: Fix autoconfig_irq() to avoid race conditions
Date: Thu, 06 Aug 2015 08:53:36 -0400 [thread overview]
Message-ID: <55C358D0.2090605@hurleysoftware.com> (raw)
In-Reply-To: <1438157443-19447-2-git-send-email-t-kageyama@cp.jp.nec.com>
On 07/29/2015 04:12 AM, Taichi Kageyama wrote:
> The following race conditions can happen when a serial port is used
> as console.
>
> Case1: CPU_B is used to detect an interrupt from a serial port,
> but it can have interrupts disabled during the waiting time.
> Case2: CPU_B clears UART_IER just after CPU_A sets UART_IER and then
> a serial port may not make an interrupt.
> Case3: CPU_A sets UART_IER just after CPU_B clears UART_IER.
> This is an unexpected behavior for serial8250_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,)
>
> Case1 and 2 can make autoconfig_irq() failed.
> In these cases, the console doesn't work in interrupt mode and
> "input overrun" (which can make operation mistakes) can happen
> on some systems. Especially in the Case1, It is known that the
> problem happens with high rate every boot once it occurs
> because the boot sequence is always almost same.
>
> port mutex makes sure that the autoconfig operation is exclusive of
> any other concurrent HW access except by the console operation.
> console lock is required in autoconfig_irq().
>
> Signed-off-by: Taichi Kageyama <t-kageyama@cp.jp.nec.com>
> Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Please resend this one patch to Greg as a non-RFC patch.
Regards,
Peter Hurley
next prev parent reply other threads:[~2015-08-06 12:53 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-29 8:12 [RFC PATCH v2 0/3] genirq, serial: 8250: Workaround to avoid irq=0 for console Taichi Kageyama
2015-07-29 8:12 ` [RFC PATCH v2 1/3] serial: 8250: Fix autoconfig_irq() to avoid race conditions Taichi Kageyama
2015-08-06 12:53 ` Peter Hurley [this message]
2015-07-29 8:12 ` [RFC PATCH v2 2/3] genirq: Add a function to set irq affinity of candidate IRQs Taichi Kageyama
2015-07-29 8:13 ` [RFC PATCH v2 3/3] serial: 8250: Fix autoconfig_irq() to reduce the risk of failure Taichi Kageyama
2015-07-29 10:32 ` [RFC PATCH v2 0/3] genirq, serial: 8250: Workaround to avoid irq=0 for console Thomas Gleixner
2015-07-29 11:51 ` Peter Hurley
2015-07-29 11:53 ` Thomas Gleixner
2015-07-29 13:17 ` Peter Hurley
2015-07-29 13:35 ` Thomas Gleixner
2015-07-30 1:41 ` Taichi Kageyama
2015-07-30 10:12 ` Thomas Gleixner
2015-07-30 13:43 ` Peter Hurley
2015-07-30 22:12 ` Thomas Gleixner
2015-07-30 23:43 ` Peter Hurley
2015-07-31 7:02 ` Taichi Kageyama
2015-07-31 7:02 ` Taichi Kageyama
2015-08-02 9:52 ` Thomas Gleixner
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=55C358D0.2090605@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=gregkh@linuxfoundation.org \
--cc=jiang.liu@linux.intel.com \
--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 \
--cc=tglx@linutronix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.