From: Huang Shijie <b32955@freescale.com>
To: dean_jenkins@mentor.com
Cc: dirk.behme@de.bosch.com, gregkh@linuxfoundation.org,
s.hauer@pengutronix.de, linux-arm-kernel@lists.infradead.org,
linux-serial@vger.kernel.org, shawn.guo@freescale.com
Subject: Re: [PATCH 3/5] serial: imx: avoid spinlock recursion deadlock
Date: Mon, 12 May 2014 11:12:15 +0800 [thread overview]
Message-ID: <53703C0F.20504@freescale.com> (raw)
In-Reply-To: <1399648788-26061-4-git-send-email-dean_jenkins@mentor.com>
于 2014年05月09日 23:19, dean_jenkins@mentor.com 写道:
> From: Andy Lowe<andy_lowe@mentor.com>
>
> The following deadlock has been observed:
>
> imx_int() {
> imx_txint() {
> spin_lock_irqsave(&sport->port.lock,flags);
> /* ^^^uart_port spinlock taken in imx_txint */
> imx_transmit_buffer() {
> uart_write_wakeup(&sport->port) {
> tty_wakeup() {
> hci_uart_tty_wakeup() {
> hci_uart_tx_wakeup() {
> uart_write() {
> spin_lock_irqsave(&port->lock, flags);
> /* ^^^deadlock here when spinlock is taken again */
> .
> .
> .
> spin_unlock_irqrestore(&port->lock, flags);
> }
> }
> }
> }
> }
> }
> spin_unlock_irqrestore(&sport->port.lock,flags);
> }
> }
>
> To correct this call uart_write_wakeup() at the end of imx_txint() after
> the uart_port spinlock is unlocked.
>
> Signed-off-by: Andy Lowe<andy_lowe@mentor.com>
> Signed-off-by: Dirk Behme<dirk.behme@de.bosch.com>
> ---
> drivers/tty/serial/imx.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index abe31ad..cc79706 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -636,8 +636,13 @@ static irqreturn_t imx_txint(int irq, void *dev_id)
>
> imx_transmit_buffer(sport);
>
> - if (uart_circ_chars_pending(xmit)< WAKEUP_CHARS)
> + if (uart_circ_chars_pending(xmit)< WAKEUP_CHARS) {
> + spin_unlock_irqrestore(&sport->port.lock, flags);
> uart_write_wakeup(&sport->port);
> + } else
> + spin_unlock_irqrestore(&sport->port.lock, flags);
> +
> + return IRQ_HANDLED;
>
> out:
> spin_unlock_irqrestore(&sport->port.lock, flags);
I think this patch :
https://lkml.org/lkml/2014/3/20/623
has fixed this deadlock.
We can ignore this patch now.
thanks
Huang Shijie
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2014-05-12 3:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-09 15:19 [PATCH 0/5] serial: imx: fixes dean_jenkins
2014-05-09 15:19 ` [PATCH 1/5] serial: imx: remove unneeded imx_transmit_buffer() from imx_start_tx() dean_jenkins
2014-05-12 3:40 ` Huang Shijie
2014-05-12 5:45 ` Dirk Behme
2014-05-12 6:30 ` Huang Shijie
2014-05-12 6:40 ` Dirk Behme
2014-05-12 6:53 ` Huang Shijie
2014-05-12 8:03 ` Dean Jenkins
2014-05-12 8:17 ` Huang Shijie
2014-05-09 15:19 ` [PATCH 2/5] serial: imx: remove uart_write_wakeup() from imx_transmit_buffer() dean_jenkins
2014-05-09 15:19 ` [PATCH 3/5] serial: imx: avoid spinlock recursion deadlock dean_jenkins
2014-05-12 3:12 ` Huang Shijie [this message]
2014-05-14 16:24 ` Dean Jenkins
2014-05-09 15:19 ` [PATCH 4/5] serial: imx: move imx_transmit_buffer() into imx_txint() dean_jenkins
2014-05-09 15:19 ` [PATCH 5/5] serial: imx: clean up imx_poll_get_char() dean_jenkins
2014-05-28 19:34 ` [PATCH 0/5] serial: imx: fixes Greg KH
2014-05-29 4:58 ` Dirk Behme
2014-05-29 4:14 ` Huang Shijie
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=53703C0F.20504@freescale.com \
--to=b32955@freescale.com \
--cc=dean_jenkins@mentor.com \
--cc=dirk.behme@de.bosch.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-serial@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawn.guo@freescale.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).