All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhang Zhen <zhenzhang.zhang@huawei.com>
To: Tim Kryger <tim.kryger@gmail.com>
Cc: Alan Cox <alan@linux.intel.com>,
	"long.wanglong" <long.wanglong@huawei.com>,
	Peter Hurley <peter@hurleysoftware.com>,
	linux-serial@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	gregkh@linuxfoundation.org, Jamie Iles <jamie@jamieiles.com>,
	Arnd Bergmann <arnd@arndb.de>,
	shenjiangjiang@huawei.com, Wang Kai <morgan.wang@huawei.com>
Subject: Re: [RFC] With 8250 Designware UART, if writes to the LCR failed the kernel will hung up
Date: Tue, 10 Mar 2015 11:15:48 +0800	[thread overview]
Message-ID: <54FE61E4.8090605@huawei.com> (raw)
In-Reply-To: <CAD7vxx+WYgOujpTAxXsUmcr8T4zHS9MYfwrWu8hV2t=TudLamQ@mail.gmail.com>

On 2015/3/10 10:47, Tim Kryger wrote:
> On Mon, Mar 9, 2015 at 8:05 AM, Alan Cox <alan@linux.intel.com> wrote:
> 
>> Ah no - I meant what is their official software workaround for existing
>> parts with the bug ? Presumably they have an errata document that
>> discusses this and the correct methods they recommend to avoid the
>> hang ?
> 
> As far as I know, the only advice they provided was rather naive.
> 
> The documentation I saw suggested stashing a copy of the LCR and then
> rewriting it when the special LCR write failed interrupt was raised.
> 
> That approach was not workable as the LCR might be written while the
> interrupt is masked causing the sequence of register writes to occur
> in an order other than what was desired.
> 
> Additionally, when the LCR needed to be re-written but the UART stayed
> busy, the interrupt would keep firing and the driver would starve out
> everything else on the CPU.
> 
> The current workaround of clearing fifos and retrying a fixed number
> of times isn't ideal but I'm not sure what else can be done given the
> way this hardware works.
> 
> Additional background is in c49436b657d0a56a6ad90d14a7c3041add7cf64d
> 
Hi,

If writes to the LCR failed and the dev_err in dw8250_serial_out lead to
the system hung up.
The root cause is that serial8250_console_write try to get port->lock which
has been got by serial8250_do_set_termios.

"Writes to the LCR are used to change the baud rate, parity, stop bit,
or data length so the data that may be lost is likely not important."
The dev_err in dw8250_serial_out must be needed? We can delete dev_err directly ?

Best regards!
> -Tim
> 
> .
> 

WARNING: multiple messages have this Message-ID (diff)
From: Zhang Zhen <zhenzhang.zhang@huawei.com>
To: Tim Kryger <tim.kryger@gmail.com>
Cc: Alan Cox <alan@linux.intel.com>,
	"long.wanglong" <long.wanglong@huawei.com>,
	Peter Hurley <peter@hurleysoftware.com>,
	<linux-serial@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	<gregkh@linuxfoundation.org>, Jamie Iles <jamie@jamieiles.com>,
	Arnd Bergmann <arnd@arndb.de>, <shenjiangjiang@huawei.com>,
	Wang Kai <morgan.wang@huawei.com>
Subject: Re: [RFC] With 8250 Designware UART, if writes to the LCR failed the kernel will hung up
Date: Tue, 10 Mar 2015 11:15:48 +0800	[thread overview]
Message-ID: <54FE61E4.8090605@huawei.com> (raw)
In-Reply-To: <CAD7vxx+WYgOujpTAxXsUmcr8T4zHS9MYfwrWu8hV2t=TudLamQ@mail.gmail.com>

On 2015/3/10 10:47, Tim Kryger wrote:
> On Mon, Mar 9, 2015 at 8:05 AM, Alan Cox <alan@linux.intel.com> wrote:
> 
>> Ah no - I meant what is their official software workaround for existing
>> parts with the bug ? Presumably they have an errata document that
>> discusses this and the correct methods they recommend to avoid the
>> hang ?
> 
> As far as I know, the only advice they provided was rather naive.
> 
> The documentation I saw suggested stashing a copy of the LCR and then
> rewriting it when the special LCR write failed interrupt was raised.
> 
> That approach was not workable as the LCR might be written while the
> interrupt is masked causing the sequence of register writes to occur
> in an order other than what was desired.
> 
> Additionally, when the LCR needed to be re-written but the UART stayed
> busy, the interrupt would keep firing and the driver would starve out
> everything else on the CPU.
> 
> The current workaround of clearing fifos and retrying a fixed number
> of times isn't ideal but I'm not sure what else can be done given the
> way this hardware works.
> 
> Additional background is in c49436b657d0a56a6ad90d14a7c3041add7cf64d
> 
Hi,

If writes to the LCR failed and the dev_err in dw8250_serial_out lead to
the system hung up.
The root cause is that serial8250_console_write try to get port->lock which
has been got by serial8250_do_set_termios.

"Writes to the LCR are used to change the baud rate, parity, stop bit,
or data length so the data that may be lost is likely not important."
The dev_err in dw8250_serial_out must be needed? We can delete dev_err directly ?

Best regards!
> -Tim
> 
> .
> 



  reply	other threads:[~2015-03-10  3:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-06  9:11 [RFC] With 8250 Designware UART, if writes to the LCR failed the kernel will hung up Zhang Zhen
2015-03-06  9:11 ` Zhang Zhen
2015-03-06 16:50 ` Peter Hurley
2015-03-07  3:01   ` Tim Kryger
2015-03-09  7:10     ` long.wanglong
2015-03-09  7:10       ` long.wanglong
2015-03-09 13:32       ` Alan Cox
2015-03-09 14:36         ` Tim Kryger
2015-03-09 15:05           ` Alan Cox
2015-03-10  2:47             ` Tim Kryger
2015-03-10  3:15               ` Zhang Zhen [this message]
2015-03-10  3:15                 ` Zhang Zhen
2015-03-10 13:25               ` Peter Hurley
2015-03-11  1:20                 ` Zhang Zhen
2015-03-11  1:20                   ` Zhang Zhen
2015-03-13 15:36               ` Andy Shevchenko
2015-03-15 14:50                 ` Peter Hurley

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=54FE61E4.8090605@huawei.com \
    --to=zhenzhang.zhang@huawei.com \
    --cc=alan@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jamie@jamieiles.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=long.wanglong@huawei.com \
    --cc=morgan.wang@huawei.com \
    --cc=peter@hurleysoftware.com \
    --cc=shenjiangjiang@huawei.com \
    --cc=tim.kryger@gmail.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 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.