linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Zhang Zhen <zhenzhang.zhang@huawei.com>
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	tim.kryger@linaro.org, gregkh@linuxfoundation.org,
	jamie@jamieiles.com, alan@linux.intel.com, arnd@arndb.de,
	shenjiangjiang@huawei.com, long.wanglong@huawei.com
Subject: Re: [RFC] With 8250 Designware UART, if writes to the LCR failed the kernel will hung up
Date: Fri, 06 Mar 2015 11:50:18 -0500	[thread overview]
Message-ID: <54F9DACA.3020103@hurleysoftware.com> (raw)
In-Reply-To: <54F96F5B.2090601@huawei.com>

Hi Zhang,

On 03/06/2015 04:11 AM, Zhang Zhen wrote:
> Hi,
> 
> 	I'm testing 4.0-rc1 kernel on my board with 8250 Designware UART.(ARM Cortex-a15 single core).
> 	
> 	I found if serial is busy and writes to the LCR failed after tried 1000 times.
> 	The kernel will hung up.
> 
> 	The system boot success after changed from:
> 
>  95 static void dw8250_serial_out(struct uart_port *p, int offset, int value)
>  96 {
>  97         struct dw8250_data *d = p->private_data;
>  98
> ...
> ...
> 112                         writeb(value, p->membase + (UART_LCR << p->regshift));
> 113                 }
> 114                 dev_err(p->dev, "Couldn't set LCR to %d\n", value);
> 115         }
> 116 }
> 
> 	to:
> 
>  95 static void dw8250_serial_out(struct uart_port *p, int offset, int value)
>  96 {
>  97         struct dw8250_data *d = p->private_data;
>  98
> ...
> ...
> 112                         writeb(value, p->membase + (UART_LCR << p->regshift));
> 113                 }
> 114                 dev_info(p->dev, "Couldn't set LCR to %d\n", value);            //changed here
> 115         }
> 116 }
> 
> 	The reason is serial8250_console_write can't get port->lock because serial8250_do_set_termios has
> 	got port->lock.
> 	So i think here we should change from dev_err to dev_info ?

That's not really going to help because this will still hang if the
console_loglevel is set to < KERN_INFO.

> 	Any suggestions are welcome.

Check that the port is not the uart_console() before logging the error,
like;

	if (!uart_console(p))
		dev_err(p->dev, "Couldn't .....");

Use a global flag to note the error and check it from other contexts.
Plus, find out why you can't write LCR there.

Also, consider re-designing how the 8250_dw driver implements that
"feature".

Regards,
Peter Hurley

  reply	other threads:[~2015-03-06 16:50 UTC|newest]

Thread overview: 13+ 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 16:50 ` Peter Hurley [this message]
2015-03-07  3:01   ` Tim Kryger
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
2015-03-10 13:25               ` Peter Hurley
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=54F9DACA.3020103@hurleysoftware.com \
    --to=peter@hurleysoftware.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=shenjiangjiang@huawei.com \
    --cc=tim.kryger@linaro.org \
    --cc=zhenzhang.zhang@huawei.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).