All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/25] tty: serial: drop uart_port->lock before calling
@ 2013-08-16 11:43 Viresh Kumar
  2013-08-16 11:43 ` [PATCH 01/25] tty: serial: altera_jtag: drop uart_port->lock before calling tty_flip_buffer_push() Viresh Kumar
                   ` (26 more replies)
  0 siblings, 27 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby
  Cc: linaro-kernel, patches, linux-serial, Viresh Kumar,
	Bryan Huntsman, Daniel Walker, David Brown, Stephen Warren,
	Tobias Klauser, Tony Prisk

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

This is neither tested nor compiled. I was working on Samsung's Arndale board
and so was required to samsung serial driver. Then thought why not others :)

Rebased over: v3.11-rc5

Cc: Bryan Huntsman <bryanh@codeaurora.org>
Cc: Daniel Walker <dwalker@fifo99.com>
Cc: David Brown <davidb@codeaurora.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Tobias Klauser <tklauser@distanz.ch>
Cc: Tony Prisk <linux@prisktech.co.nz>

Viresh Kumar (25):
  tty: serial: altera_jtag: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: altera: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: apbuart: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: ar933x: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: arc: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: bcm63xx: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: bfin_sport: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: efm32: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: icom: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: lpc32xx_hs: don't call tty_flip_buffer_push() twice
  tty: serial: lpc32xx_hs: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: m32r_sio: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: mcf: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: mfd: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: mpsc: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: msm: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: netx: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: nwpserial: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: pnx8xxx: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: rp2: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: sa1100: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: samsung: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: tegra: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: sirfsoc: drop uart_port->lock before calling
    tty_flip_buffer_push()
  tty: serial: vt8500: drop uart_port->lock before calling
    tty_flip_buffer_push()

 drivers/tty/serial/altera_jtaguart.c |  2 ++
 drivers/tty/serial/altera_uart.c     |  2 ++
 drivers/tty/serial/apbuart.c         |  2 ++
 drivers/tty/serial/ar933x_uart.c     |  2 ++
 drivers/tty/serial/arc_uart.c        |  2 ++
 drivers/tty/serial/bcm63xx_uart.c    |  2 ++
 drivers/tty/serial/bfin_sport_uart.c |  5 +++--
 drivers/tty/serial/efm32-uart.c      |  4 ++--
 drivers/tty/serial/icom.c            |  3 +++
 drivers/tty/serial/lpc32xx_hs.c      |  7 ++++---
 drivers/tty/serial/m32r_sio.c        |  3 +++
 drivers/tty/serial/mcf.c             |  2 ++
 drivers/tty/serial/mfd.c             | 14 ++++++++++----
 drivers/tty/serial/mpsc.c            | 11 ++++++++---
 drivers/tty/serial/msm_serial.c      |  5 +++++
 drivers/tty/serial/netx-serial.c     |  6 ++++--
 drivers/tty/serial/nwpserial.c       |  3 +++
 drivers/tty/serial/pnx8xxx_uart.c    |  3 +++
 drivers/tty/serial/rp2.c             |  2 ++
 drivers/tty/serial/sa1100.c          |  3 +++
 drivers/tty/serial/samsung.c         |  5 ++++-
 drivers/tty/serial/serial-tegra.c    | 10 ++++++++--
 drivers/tty/serial/sirfsoc_uart.c    |  3 +++
 drivers/tty/serial/vt8500_serial.c   |  2 ++
 24 files changed, 84 insertions(+), 19 deletions(-)

-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 01/25] tty: serial: altera_jtag: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 02/25] tty: serial: altera: " Viresh Kumar
                   ` (25 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby
  Cc: linaro-kernel, patches, linux-serial, Viresh Kumar, Tobias Klauser

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Cc: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/altera_jtaguart.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c
index c6bdb94..46c25ff 100644
--- a/drivers/tty/serial/altera_jtaguart.c
+++ b/drivers/tty/serial/altera_jtaguart.c
@@ -139,7 +139,9 @@ static void altera_jtaguart_rx_chars(struct altera_jtaguart *pp)
 		uart_insert_char(port, 0, 0, ch, flag);
 	}
 
+	spin_unlock(&port->lock);
 	tty_flip_buffer_push(&port->state->port);
+	spin_lock(&port->lock);
 }
 
 static void altera_jtaguart_tx_chars(struct altera_jtaguart *pp)
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 02/25] tty: serial: altera: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
  2013-08-16 11:43 ` [PATCH 01/25] tty: serial: altera_jtag: drop uart_port->lock before calling tty_flip_buffer_push() Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 03/25] tty: serial: apbuart: " Viresh Kumar
                   ` (24 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby
  Cc: linaro-kernel, patches, linux-serial, Viresh Kumar, Tobias Klauser

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Cc: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/altera_uart.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c
index 1d46966..77641e7 100644
--- a/drivers/tty/serial/altera_uart.c
+++ b/drivers/tty/serial/altera_uart.c
@@ -231,7 +231,9 @@ static void altera_uart_rx_chars(struct altera_uart *pp)
 				 flag);
 	}
 
+	spin_unlock(&port->lock);
 	tty_flip_buffer_push(&port->state->port);
+	spin_lock(&port->lock);
 }
 
 static void altera_uart_tx_chars(struct altera_uart *pp)
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 03/25] tty: serial: apbuart: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
  2013-08-16 11:43 ` [PATCH 01/25] tty: serial: altera_jtag: drop uart_port->lock before calling tty_flip_buffer_push() Viresh Kumar
  2013-08-16 11:43 ` [PATCH 02/25] tty: serial: altera: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 04/25] tty: serial: ar933x: " Viresh Kumar
                   ` (23 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/apbuart.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c
index 6331464d..de11ab8 100644
--- a/drivers/tty/serial/apbuart.c
+++ b/drivers/tty/serial/apbuart.c
@@ -125,7 +125,9 @@ static void apbuart_rx_chars(struct uart_port *port)
 		status = UART_GET_STATUS(port);
 	}
 
+	spin_unlock(&port->lock);
 	tty_flip_buffer_push(&port->state->port);
+	spin_lock(&port->lock);
 }
 
 static void apbuart_tx_chars(struct uart_port *port)
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 04/25] tty: serial: ar933x: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (2 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 03/25] tty: serial: apbuart: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 05/25] tty: serial: arc: " Viresh Kumar
                   ` (22 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/ar933x_uart.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c
index 27f20c5..964ca90 100644
--- a/drivers/tty/serial/ar933x_uart.c
+++ b/drivers/tty/serial/ar933x_uart.c
@@ -322,7 +322,9 @@ static void ar933x_uart_rx_chars(struct ar933x_uart_port *up)
 			tty_insert_flip_char(port, ch, TTY_NORMAL);
 	} while (max_count-- > 0);
 
+	spin_unlock(&up->port.lock);
 	tty_flip_buffer_push(port);
+	spin_lock(&up->port.lock);
 }
 
 static void ar933x_uart_tx_chars(struct ar933x_uart_port *up)
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 05/25] tty: serial: arc: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (3 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 04/25] tty: serial: ar933x: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 06/25] tty: serial: bcm63xx: " Viresh Kumar
                   ` (21 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/arc_uart.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index 22f280a..8cf6b30 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -248,7 +248,9 @@ static void arc_serial_rx_chars(struct arc_uart_port *uart)
 		uart_insert_char(&uart->port, status, RXOERR, ch, flg);
 
 done:
+		spin_unlock(&uart->port.lock);
 		tty_flip_buffer_push(&uart->port.state->port);
+		spin_lock(&uart->port.lock);
 	}
 }
 
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 06/25] tty: serial: bcm63xx: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (4 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 05/25] tty: serial: arc: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 07/25] tty: serial: bfin_sport: " Viresh Kumar
                   ` (20 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/bcm63xx_uart.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
index 6fa2ae77..9f0bf4c 100644
--- a/drivers/tty/serial/bcm63xx_uart.c
+++ b/drivers/tty/serial/bcm63xx_uart.c
@@ -302,7 +302,9 @@ static void bcm_uart_do_rx(struct uart_port *port)
 
 	} while (--max_count);
 
+	spin_unlock(&port->lock);
 	tty_flip_buffer_push(tty_port);
+	spin_lock(&port->lock);
 }
 
 /*
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 07/25] tty: serial: bfin_sport: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (5 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 06/25] tty: serial: bcm63xx: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 08/25] tty: serial: efm32: " Viresh Kumar
                   ` (19 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/bfin_sport_uart.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/bfin_sport_uart.c b/drivers/tty/serial/bfin_sport_uart.c
index 487c173..32d3926 100644
--- a/drivers/tty/serial/bfin_sport_uart.c
+++ b/drivers/tty/serial/bfin_sport_uart.c
@@ -161,11 +161,12 @@ static irqreturn_t sport_uart_rx_irq(int irq, void *dev_id)
 		if (!uart_handle_sysrq_char(&up->port, ch))
 			tty_insert_flip_char(port, ch, TTY_NORMAL);
 	}
-	/* XXX this won't deadlock with lowlat? */
-	tty_flip_buffer_push(port);
 
 	spin_unlock(&up->port.lock);
 
+	/* XXX this won't deadlock with lowlat? */
+	tty_flip_buffer_push(port);
+
 	return IRQ_HANDLED;
 }
 
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 08/25] tty: serial: efm32: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (6 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 07/25] tty: serial: bfin_sport: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 09/25] tty: serial: icom: " Viresh Kumar
                   ` (18 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/efm32-uart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/efm32-uart.c b/drivers/tty/serial/efm32-uart.c
index 7d199c8..b4cef79 100644
--- a/drivers/tty/serial/efm32-uart.c
+++ b/drivers/tty/serial/efm32-uart.c
@@ -268,10 +268,10 @@ static irqreturn_t efm32_uart_rxirq(int irq, void *data)
 		handled = IRQ_HANDLED;
 	}
 
-	tty_flip_buffer_push(tport);
-
 	spin_unlock(&port->lock);
 
+	tty_flip_buffer_push(tport);
+
 	return handled;
 }
 
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 09/25] tty: serial: icom: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (7 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 08/25] tty: serial: efm32: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 10/25] tty: serial: lpc32xx_hs: don't call tty_flip_buffer_push() twice Viresh Kumar
                   ` (17 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/icom.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/icom.c b/drivers/tty/serial/icom.c
index 18ed5ae..46cb597 100644
--- a/drivers/tty/serial/icom.c
+++ b/drivers/tty/serial/icom.c
@@ -834,7 +834,10 @@ ignore_char:
 		status = cpu_to_le16(icom_port->statStg->rcv[rcv_buff].flags);
 	}
 	icom_port->next_rcv = rcv_buff;
+
+	spin_unlock(&icom_port->uart_port.lock);
 	tty_flip_buffer_push(port);
+	spin_lock(&icom_port->uart_port.lock);
 }
 
 static void process_interrupt(u16 port_int_reg,
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 10/25] tty: serial: lpc32xx_hs: don't call tty_flip_buffer_push() twice
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (8 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 09/25] tty: serial: icom: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 11/25] tty: serial: lpc32xx_hs: drop uart_port->lock before calling tty_flip_buffer_push() Viresh Kumar
                   ` (16 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

serial_lpc32xx_interrupt() calls __serial_lpc32xx_rx() first and then
tty_flip_buffer_push() immediately after that. But last statement of
__serial_lpc32xx_rx() already called tty_flip_buffer_push()..

So, probably its not required to be called twice. Lets remove one of them.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/lpc32xx_hs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/tty/serial/lpc32xx_hs.c b/drivers/tty/serial/lpc32xx_hs.c
index dffea6b..8fdf6a8 100644
--- a/drivers/tty/serial/lpc32xx_hs.c
+++ b/drivers/tty/serial/lpc32xx_hs.c
@@ -351,10 +351,8 @@ static irqreturn_t serial_lpc32xx_interrupt(int irq, void *dev_id)
 	}
 
 	/* Data received? */
-	if (status & (LPC32XX_HSU_RX_TIMEOUT_INT | LPC32XX_HSU_RX_TRIG_INT)) {
+	if (status & (LPC32XX_HSU_RX_TIMEOUT_INT | LPC32XX_HSU_RX_TRIG_INT))
 		__serial_lpc32xx_rx(port);
-		tty_flip_buffer_push(tport);
-	}
 
 	/* Transmit data request? */
 	if ((status & LPC32XX_HSU_TX_INT) && (!uart_tx_stopped(port))) {
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 11/25] tty: serial: lpc32xx_hs: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (9 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 10/25] tty: serial: lpc32xx_hs: don't call tty_flip_buffer_push() twice Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 12/25] tty: serial: m32r_sio: " Viresh Kumar
                   ` (15 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/lpc32xx_hs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/lpc32xx_hs.c b/drivers/tty/serial/lpc32xx_hs.c
index 8fdf6a8..701644f 100644
--- a/drivers/tty/serial/lpc32xx_hs.c
+++ b/drivers/tty/serial/lpc32xx_hs.c
@@ -279,7 +279,10 @@ static void __serial_lpc32xx_rx(struct uart_port *port)
 
 		tmp = readl(LPC32XX_HSUART_FIFO(port->membase));
 	}
+
+	spin_unlock(&port->lock);
 	tty_flip_buffer_push(tport);
+	spin_lock(&port->lock);
 }
 
 static void __serial_lpc32xx_tx(struct uart_port *port)
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 12/25] tty: serial: m32r_sio: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (10 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 11/25] tty: serial: lpc32xx_hs: drop uart_port->lock before calling tty_flip_buffer_push() Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 13/25] tty: serial: mcf: " Viresh Kumar
                   ` (14 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/m32r_sio.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/m32r_sio.c b/drivers/tty/serial/m32r_sio.c
index bb1afa0..9cd9b4e 100644
--- a/drivers/tty/serial/m32r_sio.c
+++ b/drivers/tty/serial/m32r_sio.c
@@ -368,7 +368,10 @@ static void receive_chars(struct uart_sio_port *up, int *status)
 	ignore_char:
 		*status = serial_in(up, UART_LSR);
 	} while ((*status & UART_LSR_DR) && (max_count-- > 0));
+
+	spin_unlock(&up->port.lock);
 	tty_flip_buffer_push(port);
+	spin_lock(&up->port.lock);
 }
 
 static void transmit_chars(struct uart_sio_port *up)
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 13/25] tty: serial: mcf: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (11 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 12/25] tty: serial: m32r_sio: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 14/25] tty: serial: mfd: " Viresh Kumar
                   ` (13 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/mcf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/mcf.c b/drivers/tty/serial/mcf.c
index 65be0c0..62c8fdf 100644
--- a/drivers/tty/serial/mcf.c
+++ b/drivers/tty/serial/mcf.c
@@ -324,7 +324,9 @@ static void mcf_rx_chars(struct mcf_uart *pp)
 		uart_insert_char(port, status, MCFUART_USR_RXOVERRUN, ch, flag);
 	}
 
+	spin_unlock(&port->lock);
 	tty_flip_buffer_push(&port->state->port);
+	spin_lock(&port->lock);
 }
 
 /****************************************************************************/
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 14/25] tty: serial: mfd: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (12 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 13/25] tty: serial: mcf: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 15/25] tty: serial: mpsc: " Viresh Kumar
                   ` (12 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/mfd.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/mfd.c b/drivers/tty/serial/mfd.c
index 4a82267..d3db042 100644
--- a/drivers/tty/serial/mfd.c
+++ b/drivers/tty/serial/mfd.c
@@ -386,7 +386,7 @@ static void serial_hsu_stop_tx(struct uart_port *port)
 
 /* This is always called in spinlock protected mode, so
  * modify timeout timer is safe here */
-void hsu_dma_rx(struct uart_hsu_port *up, u32 int_sts)
+void hsu_dma_rx(struct uart_hsu_port *up, u32 int_sts, unsigned long *flags)
 {
 	struct hsu_dma_buffer *dbuf = &up->rxbuf;
 	struct hsu_dma_chan *chan = up->rxc;
@@ -438,7 +438,9 @@ void hsu_dma_rx(struct uart_hsu_port *up, u32 int_sts)
 					 | (0x1 << 16)
 					 | (0x1 << 24)	/* timeout bit, see HSU Errata 1 */
 					 );
+	spin_unlock_irqrestore(&up->port.lock, *flags);
 	tty_flip_buffer_push(tport);
+	spin_lock_irqsave(&up->port.lock, *flags);
 
 	chan_writel(chan, HSU_CH_CR, 0x3);
 
@@ -459,7 +461,8 @@ static void serial_hsu_stop_rx(struct uart_port *port)
 	}
 }
 
-static inline void receive_chars(struct uart_hsu_port *up, int *status)
+static inline void receive_chars(struct uart_hsu_port *up, int *status,
+		unsigned long *flags)
 {
 	unsigned int ch, flag;
 	unsigned int max_count = 256;
@@ -519,7 +522,10 @@ static inline void receive_chars(struct uart_hsu_port *up, int *status)
 	ignore_char:
 		*status = serial_in(up, UART_LSR);
 	} while ((*status & UART_LSR_DR) && max_count--);
+
+	spin_unlock_irqrestore(&up->port.lock, *flags);
 	tty_flip_buffer_push(&up->port.state->port);
+	spin_lock_irqsave(&up->port.lock, *flags);
 }
 
 static void transmit_chars(struct uart_hsu_port *up)
@@ -613,7 +619,7 @@ static irqreturn_t port_irq(int irq, void *dev_id)
 
 	lsr = serial_in(up, UART_LSR);
 	if (lsr & UART_LSR_DR)
-		receive_chars(up, &lsr);
+		receive_chars(up, &lsr, &flags);
 	check_modem_status(up);
 
 	/* lsr will be renewed during the receive_chars */
@@ -643,7 +649,7 @@ static inline void dma_chan_irq(struct hsu_dma_chan *chan)
 
 	/* Rx channel */
 	if (chan->dirt == DMA_FROM_DEVICE)
-		hsu_dma_rx(up, int_sts);
+		hsu_dma_rx(up, int_sts, &flags);
 
 	/* Tx channel */
 	if (chan->dirt == DMA_TO_DEVICE) {
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 15/25] tty: serial: mpsc: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (13 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 14/25] tty: serial: mfd: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 16/25] tty: serial: msm: " Viresh Kumar
                   ` (11 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/mpsc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/mpsc.c b/drivers/tty/serial/mpsc.c
index bc24f49..556ff04 100644
--- a/drivers/tty/serial/mpsc.c
+++ b/drivers/tty/serial/mpsc.c
@@ -934,7 +934,7 @@ static int serial_polled;
  ******************************************************************************
  */
 
-static int mpsc_rx_intr(struct mpsc_port_info *pi)
+static int mpsc_rx_intr(struct mpsc_port_info *pi, unsigned long *flags)
 {
 	struct mpsc_rx_desc *rxre;
 	struct tty_port *port = &pi->port.state->port;
@@ -969,8 +969,11 @@ static int mpsc_rx_intr(struct mpsc_port_info *pi)
 #endif
 		/* Following use of tty struct directly is deprecated */
 		if (tty_buffer_request_room(port, bytes_in) < bytes_in) {
-			if (port->low_latency)
+			if (port->low_latency) {
+				spin_unlock_irqrestore(&pi->port.lock, *flags);
 				tty_flip_buffer_push(port);
+				spin_lock_irqsave(&pi->port.lock, *flags);
+			}
 			/*
 			 * If this failed then we will throw away the bytes
 			 * but must do so to clear interrupts.
@@ -1080,7 +1083,9 @@ next_frame:
 	if ((readl(pi->sdma_base + SDMA_SDCM) & SDMA_SDCM_ERD) == 0)
 		mpsc_start_rx(pi);
 
+	spin_unlock_irqrestore(&pi->port.lock, *flags);
 	tty_flip_buffer_push(port);
+	spin_lock_irqsave(&pi->port.lock, *flags);
 	return rc;
 }
 
@@ -1222,7 +1227,7 @@ static irqreturn_t mpsc_sdma_intr(int irq, void *dev_id)
 
 	spin_lock_irqsave(&pi->port.lock, iflags);
 	mpsc_sdma_intr_ack(pi);
-	if (mpsc_rx_intr(pi))
+	if (mpsc_rx_intr(pi, &iflags))
 		rc = IRQ_HANDLED;
 	if (mpsc_tx_intr(pi))
 		rc = IRQ_HANDLED;
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 16/25] tty: serial: msm: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (14 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 15/25] tty: serial: mpsc: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 17/25] tty: serial: netx: " Viresh Kumar
                   ` (10 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby
  Cc: linaro-kernel, patches, linux-serial, Viresh Kumar, David Brown,
	Daniel Walker, Bryan Huntsman

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Cc: David Brown <davidb@codeaurora.org> (maintainer:ARM/QUALCOMM MSM...)
Cc: Daniel Walker <dwalker@fifo99.com> (maintainer:ARM/QUALCOMM MSM...)
Cc: Bryan Huntsman <bryanh@codeaurora.org> (maintainer:ARM/QUALCOMM MSM...)
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/msm_serial.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index 2c6cfb3..daa2837 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -137,7 +137,10 @@ static void handle_rx_dm(struct uart_port *port, unsigned int misr)
 		count -= 4;
 	}
 
+	spin_unlock(&port->lock);
 	tty_flip_buffer_push(tport);
+	spin_lock(&port->lock);
+
 	if (misr & (UART_IMR_RXSTALE))
 		msm_write(port, UART_CR_CMD_RESET_STALE_INT, UART_CR);
 	msm_write(port, 0xFFFFFF, UARTDM_DMRX);
@@ -189,7 +192,9 @@ static void handle_rx(struct uart_port *port)
 			tty_insert_flip_char(tport, c, flag);
 	}
 
+	spin_unlock(&port->lock);
 	tty_flip_buffer_push(tport);
+	spin_lock(&port->lock);
 }
 
 static void reset_dm_count(struct uart_port *port)
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 17/25] tty: serial: netx: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (15 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 16/25] tty: serial: msm: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 18/25] tty: serial: nwpserial: " Viresh Kumar
                   ` (9 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/netx-serial.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/netx-serial.c b/drivers/tty/serial/netx-serial.c
index b9a40ed..4f59c4d 100644
--- a/drivers/tty/serial/netx-serial.c
+++ b/drivers/tty/serial/netx-serial.c
@@ -196,7 +196,7 @@ static void netx_txint(struct uart_port *port)
 		uart_write_wakeup(port);
 }
 
-static void netx_rxint(struct uart_port *port)
+static void netx_rxint(struct uart_port *port, unsigned long *flags)
 {
 	unsigned char rx, flg, status;
 
@@ -236,7 +236,9 @@ static void netx_rxint(struct uart_port *port)
 		uart_insert_char(port, status, SR_OE, rx, flg);
 	}
 
+	spin_unlock_irqrestore(&port->lock, *flags);
 	tty_flip_buffer_push(&port->state->port);
+	spin_lock_irqsave(&port->lock, *flags);
 }
 
 static irqreturn_t netx_int(int irq, void *dev_id)
@@ -250,7 +252,7 @@ static irqreturn_t netx_int(int irq, void *dev_id)
 	status = readl(port->membase + UART_IIR) & IIR_MASK;
 	while (status) {
 		if (status & IIR_RIS)
-			netx_rxint(port);
+			netx_rxint(port, &flags);
 		if (status & IIR_TIS)
 			netx_txint(port);
 		if (status & IIR_MIS) {
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 18/25] tty: serial: nwpserial: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (16 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 17/25] tty: serial: netx: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 19/25] tty: serial: pnx8xxx: " Viresh Kumar
                   ` (8 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/nwpserial.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/nwpserial.c b/drivers/tty/serial/nwpserial.c
index 549c70a..693bc6c 100644
--- a/drivers/tty/serial/nwpserial.c
+++ b/drivers/tty/serial/nwpserial.c
@@ -149,7 +149,10 @@ static irqreturn_t nwpserial_interrupt(int irq, void *dev_id)
 			tty_insert_flip_char(port, ch, TTY_NORMAL);
 	} while (dcr_read(up->dcr_host, UART_LSR) & UART_LSR_DR);
 
+	spin_unlock(&up->port.lock);
 	tty_flip_buffer_push(port);
+	spin_lock(&up->port.lock);
+
 	ret = IRQ_HANDLED;
 
 	/* clear interrupt */
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 19/25] tty: serial: pnx8xxx: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (17 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 18/25] tty: serial: nwpserial: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 20/25] tty: serial: rp2: " Viresh Kumar
                   ` (7 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/pnx8xxx_uart.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/pnx8xxx_uart.c b/drivers/tty/serial/pnx8xxx_uart.c
index 7e277a5..8db7482 100644
--- a/drivers/tty/serial/pnx8xxx_uart.c
+++ b/drivers/tty/serial/pnx8xxx_uart.c
@@ -237,7 +237,10 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
 		status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) |
 			 ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT));
 	}
+
+	spin_unlock(&sport->port.lock);
 	tty_flip_buffer_push(&sport->port.state->port);
+	spin_lock(&sport->port.lock);
 }
 
 static void pnx8xxx_tx_chars(struct pnx8xxx_port *sport)
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 20/25] tty: serial: rp2: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (18 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 19/25] tty: serial: pnx8xxx: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 21/25] tty: serial: sa1100: " Viresh Kumar
                   ` (6 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/rp2.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/rp2.c b/drivers/tty/serial/rp2.c
index a314a94..328d6de 100644
--- a/drivers/tty/serial/rp2.c
+++ b/drivers/tty/serial/rp2.c
@@ -427,7 +427,9 @@ static void rp2_rx_chars(struct rp2_uart_port *up)
 		up->port.icount.rx++;
 	}
 
+	spin_unlock(&up->port.lock);
 	tty_flip_buffer_push(port);
+	spin_lock(&up->port.lock);
 }
 
 static void rp2_tx_chars(struct rp2_uart_port *up)
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 21/25] tty: serial: sa1100: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (19 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 20/25] tty: serial: rp2: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 22/25] tty: serial: samsung: " Viresh Kumar
                   ` (5 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/sa1100.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/sa1100.c b/drivers/tty/serial/sa1100.c
index af6b3e3..28d60ef 100644
--- a/drivers/tty/serial/sa1100.c
+++ b/drivers/tty/serial/sa1100.c
@@ -232,7 +232,10 @@ sa1100_rx_chars(struct sa1100_port *sport)
 		status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) |
 			 UTSR0_TO_SM(UART_GET_UTSR0(sport));
 	}
+
+	spin_unlock(&sport->port.lock);
 	tty_flip_buffer_push(&sport->port.state->port);
+	spin_lock(&sport->port.lock);
 }
 
 static void sa1100_tx_chars(struct sa1100_port *sport)
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 22/25] tty: serial: samsung: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (20 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 21/25] tty: serial: sa1100: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 23/25] tty: serial: tegra: " Viresh Kumar
                   ` (4 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/samsung.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 376079b..275e3e0 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -249,6 +249,8 @@ s3c24xx_serial_rx_chars(int irq, void *dev_id)
 					ufcon |= S3C2410_UFCON_RESETRX;
 					wr_regl(port, S3C2410_UFCON, ufcon);
 					rx_enabled(port) = 1;
+					spin_unlock_irqrestore(&port->lock,
+							flags);
 					goto out;
 				}
 				continue;
@@ -297,10 +299,11 @@ s3c24xx_serial_rx_chars(int irq, void *dev_id)
  ignore_char:
 		continue;
 	}
+
+	spin_unlock_irqrestore(&port->lock, flags);
 	tty_flip_buffer_push(&port->state->port);
 
  out:
-	spin_unlock_irqrestore(&port->lock, flags);
 	return IRQ_HANDLED;
 }
 
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 23/25] tty: serial: tegra: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (21 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 22/25] tty: serial: samsung: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 24/25] tty: serial: sirfsoc: " Viresh Kumar
                   ` (3 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby
  Cc: linaro-kernel, patches, linux-serial, Viresh Kumar, Stephen Warren

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Cc: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/serial-tegra.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
index ee7c812..82846cf 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -571,7 +571,9 @@ static void tegra_uart_rx_dma_complete(void *args)
 
 	tegra_uart_handle_rx_pio(tup, port);
 	if (tty) {
+		spin_unlock_irqrestore(&u->lock, flags);
 		tty_flip_buffer_push(port);
+		spin_lock_irqsave(&u->lock, flags);
 		tty_kref_put(tty);
 	}
 	tegra_uart_start_rx_dma(tup);
@@ -583,11 +585,13 @@ static void tegra_uart_rx_dma_complete(void *args)
 	spin_unlock_irqrestore(&u->lock, flags);
 }
 
-static void tegra_uart_handle_rx_dma(struct tegra_uart_port *tup)
+static void tegra_uart_handle_rx_dma(struct tegra_uart_port *tup,
+		unsigned long *flags)
 {
 	struct dma_tx_state state;
 	struct tty_struct *tty = tty_port_tty_get(&tup->uport.state->port);
 	struct tty_port *port = &tup->uport.state->port;
+	struct uart_port *u = &tup->uport;
 	int count;
 
 	/* Deactivate flow control to stop sender */
@@ -604,7 +608,9 @@ static void tegra_uart_handle_rx_dma(struct tegra_uart_port *tup)
 
 	tegra_uart_handle_rx_pio(tup, port);
 	if (tty) {
+		spin_unlock_irqrestore(&u->lock, *flags);
 		tty_flip_buffer_push(port);
+		spin_lock_irqsave(&u->lock, *flags);
 		tty_kref_put(tty);
 	}
 	tegra_uart_start_rx_dma(tup);
@@ -671,7 +677,7 @@ static irqreturn_t tegra_uart_isr(int irq, void *data)
 		iir = tegra_uart_read(tup, UART_IIR);
 		if (iir & UART_IIR_NO_INT) {
 			if (is_rx_int) {
-				tegra_uart_handle_rx_dma(tup);
+				tegra_uart_handle_rx_dma(tup, &flags);
 				if (tup->rx_in_progress) {
 					ier = tup->ier_shadow;
 					ier |= (UART_IER_RLSI | UART_IER_RTOIE |
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 24/25] tty: serial: sirfsoc: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (22 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 23/25] tty: serial: tegra: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 11:43 ` [PATCH 25/25] tty: serial: vt8500: " Viresh Kumar
                   ` (2 subsequent siblings)
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linaro-kernel, patches, linux-serial, Viresh Kumar

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/sirfsoc_uart.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/sirfsoc_uart.c b/drivers/tty/serial/sirfsoc_uart.c
index 1fd564b..bc289fe 100644
--- a/drivers/tty/serial/sirfsoc_uart.c
+++ b/drivers/tty/serial/sirfsoc_uart.c
@@ -219,7 +219,10 @@ sirfsoc_uart_pio_rx_chars(struct uart_port *port, unsigned int max_rx_count)
 	}
 
 	port->icount.rx += rx_count;
+
+	spin_unlock(&port->lock);
 	tty_flip_buffer_push(&port->state->port);
+	spin_lock(&port->lock);
 
 	return rx_count;
 }
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 25/25] tty: serial: vt8500: drop uart_port->lock before calling tty_flip_buffer_push()
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (23 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 24/25] tty: serial: sirfsoc: " Viresh Kumar
@ 2013-08-16 11:43 ` Viresh Kumar
  2013-08-16 12:06 ` [PATCH 00/25] tty: serial: drop uart_port->lock before calling Peter Hurley
  2013-08-16 12:27 ` Greg KH
  26 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 11:43 UTC (permalink / raw)
  To: gregkh, jslaby
  Cc: linaro-kernel, patches, linux-serial, Viresh Kumar, Tony Prisk

The -rt patch triggers a lockdep warning for serial drivers if
tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
up on UP kernels.

Release the port lock before calling tty_flip_buffer_push() and reacquire it
after the call.

Similar stuff was already done for few other drivers in the past, like:

commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue May 29 21:53:50 2007 +0100

    [ARM] 4417/1: Serial: Fix AMBA drivers locking

Cc: Tony Prisk <linux@prisktech.co.nz>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/tty/serial/vt8500_serial.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c
index 48af43d..b839b98 100644
--- a/drivers/tty/serial/vt8500_serial.c
+++ b/drivers/tty/serial/vt8500_serial.c
@@ -170,7 +170,9 @@ static void handle_rx(struct uart_port *port)
 			tty_insert_flip_char(tport, c, flag);
 	}
 
+	spin_unlock(&port->lock);
 	tty_flip_buffer_push(tport);
+	spin_lock(&port->lock);
 }
 
 static void handle_tx(struct uart_port *port)
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* Re: [PATCH 00/25] tty: serial: drop uart_port->lock before calling
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (24 preceding siblings ...)
  2013-08-16 11:43 ` [PATCH 25/25] tty: serial: vt8500: " Viresh Kumar
@ 2013-08-16 12:06 ` Peter Hurley
  2013-08-16 16:59   ` Viresh Kumar
  2013-08-16 12:27 ` Greg KH
  26 siblings, 1 reply; 33+ messages in thread
From: Peter Hurley @ 2013-08-16 12:06 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: gregkh, jslaby, linaro-kernel, patches, linux-serial,
	Bryan Huntsman, Daniel Walker, David Brown, Stephen Warren,
	Tobias Klauser, Tony Prisk

On 08/16/2013 07:43 AM, Viresh Kumar wrote:
> The -rt patch triggers a lockdep warning for serial drivers if
> tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
> up on UP kernels.

Please include the lockdep warning in the changelog.

Does this happen on linux-next?

Regards,
Peter Hurley


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 00/25] tty: serial: drop uart_port->lock before calling
  2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
                   ` (25 preceding siblings ...)
  2013-08-16 12:06 ` [PATCH 00/25] tty: serial: drop uart_port->lock before calling Peter Hurley
@ 2013-08-16 12:27 ` Greg KH
  2013-08-16 17:44   ` Viresh Kumar
  26 siblings, 1 reply; 33+ messages in thread
From: Greg KH @ 2013-08-16 12:27 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: jslaby, linaro-kernel, patches, linux-serial, Bryan Huntsman,
	Daniel Walker, David Brown, Stephen Warren, Tobias Klauser,
	Tony Prisk

On Fri, Aug 16, 2013 at 05:13:01PM +0530, Viresh Kumar wrote:
> The -rt patch triggers a lockdep warning for serial drivers if
> tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
> up on UP kernels.

What about SMP kernels?  linux-next?

> Release the port lock before calling tty_flip_buffer_push() and reacquire it
> after the call.
> 
> Similar stuff was already done for few other drivers in the past, like:
> 
> commit 2389b272168ceec056ca1d8a870a97fa9c26e11a
> Author: Thomas Gleixner <tglx@linutronix.de>
> Date:   Tue May 29 21:53:50 2007 +0100
> 
>     [ARM] 4417/1: Serial: Fix AMBA drivers locking
> 
> This is neither tested nor compiled.

So I'm guessing you don't want it to be applied, if you can't take the
time to at least test-build it, why should we?

{sigh}

> I was working on Samsung's Arndale board
> and so was required to samsung serial driver. Then thought why not others :)
> 
> Rebased over: v3.11-rc5

Lots of tty and serial changes have happened since -rc5 in linux-next,
can you please rebase, and test, these against that tree and resend them
if they are still needed?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 00/25] tty: serial: drop uart_port->lock before calling
  2013-08-16 12:06 ` [PATCH 00/25] tty: serial: drop uart_port->lock before calling Peter Hurley
@ 2013-08-16 16:59   ` Viresh Kumar
  0 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 16:59 UTC (permalink / raw)
  To: Peter Hurley
  Cc: Greg Kroah-Hartman, jslaby, Lists linaro-kernel, Patch Tracking,
	linux-serial, Bryan Huntsman, Daniel Walker, David Brown,
	Stephen Warren, Tobias Klauser, Tony Prisk

On 16 August 2013 17:36, Peter Hurley <peter@hurleysoftware.com> wrote:
> Please include the lockdep warning in the changelog.

Sure.. For now it is here, will include it in V2..

 ======================================================
 [ INFO: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected ]
 3.10.6-linaro-arndale #1 Not tainted
 ------------------------------------------------------
 swapper/0/1 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire:
 (&(&(&bank->slock)->lock)->wait_lock){+.+...}, at: [<8068ba2c>]
rt_spin_lock_slowlock+0x54/0x2f8

 and this task is already holding:
 (&irq_desc_lock_class){-.....}, at: [<800bbe18>] __setup_irq+0x94/0x4c4
 which would create a new lock dependency:
 (&irq_desc_lock_class){-.....} -> (&(&(&bank->slock)->lock)->wait_lock){+.+...}

 but this new dependency connects a HARDIRQ-irq-safe lock:
 (&irq_desc_lock_class){-.....}
 ... which became HARDIRQ-irq-safe at:
 [<8008ffa0>] mark_lock+0x180/0x808
 [<80092a38>] __lock_acquire+0xb5c/0x1ec0
 [<800943f8>] lock_acquire+0xc4/0x174
 [<8068cbd8>] _raw_spin_lock+0x58/0x68
 [<800bdb10>] handle_fasteoi_irq+0x24/0x15c
 [<800b9c8c>] generic_handle_irq+0x34/0x44
 [<8002007c>] handle_IRQ+0x50/0xa0
 [<800085d8>] gic_handle_irq+0x48/0x78
 [<8001f1c4>] __irq_svc+0x44/0x8c
 [<800204a4>] arch_cpu_idle+0x40/0x4c
 [<800815f8>] cpu_startup_entry+0x1a4/0x2dc
 [<8067b780>] rest_init+0xdc/0xec
 [<80910c34>] start_kernel+0x428/0x434
 [<40008084>] 0x40008084

 to a HARDIRQ-irq-unsafe lock:
 (&(&(&bank->slock)->lock)->wait_lock){+.+...}
 ... which became HARDIRQ-irq-unsafe at:
 ... [<8008ffa0>] mark_lock+0x180/0x808
 [<80092498>] __lock_acquire+0x5bc/0x1ec0
 [<800943f8>] lock_acquire+0xc4/0x174
 [<8068cbd8>] _raw_spin_lock+0x58/0x68
 [<8068ba2c>] rt_spin_lock_slowlock+0x54/0x2f8
 [<8068c42c>] rt_spin_lock+0x3c/0x68
 [<803d0594>] samsung_pinconf_rw+0xc8/0x14c
 [<803d06dc>] samsung_pinconf_group_set+0x70/0x90
 [<803cf864>] pinconf_apply_setting+0x90/0x198
 [<803cc07c>] pinctrl_select_state+0xf0/0x1a8
 [<80436790>] pinctrl_bind_pins+0x7c/0xd4
 [<8041c900>] driver_probe_device+0x68/0x230
 [<8041cbb8>] __driver_attach+0x9c/0xa0
 [<8041aad4>] bus_for_each_dev+0x70/0xa4
 [<8041c430>] driver_attach+0x2c/0x30
 [<8041c048>] bus_add_driver+0x1e0/0x26c
 [<8041d26c>] driver_register+0x88/0x150
 [<8041e620>] platform_driver_register+0x60/0x68
 [<809426e0>] i2c_adap_s3c_init+0x18/0x1c
 [<800087a4>] do_one_initcall+0x128/0x180
 [<80910e40>] kernel_init_freeable+0x200/0x2a0
 [<8067b7b0>] kernel_init+0x20/0x170
 [<8001f758>] ret_from_fork+0x14/0x20

 other info that might help us debug this:

 Possible interrupt unsafe locking scenario:

 CPU0 CPU1
 ---- ----
 lock(&(&(&bank->slock)->lock)->wait_lock);
 local_irq_disable();
 lock(&irq_desc_lock_class);
 lock(&(&(&bank->slock)->lock)->wait_lock);
 <Interrupt>
 lock(&irq_desc_lock_class);

 *** DEADLOCK ***

 2 locks held by swapper/0/1:
 #0: (&__lockdep_no_validate__){......}, at: [<8041cb7c>]
__driver_attach+0x60/0xa0
 #1: (&irq_desc_lock_class){-.....}, at: [<800bbe18>] __setup_irq+0x94/0x4c4

 the dependencies between HARDIRQ-irq-safe lock and the holding lock:
 -> (&irq_desc_lock_class){-.....} ops: 3893 {
 IN-HARDIRQ-W at:
 [<8008ffa0>] mark_lock+0x180/0x808
 [<80092a38>] __lock_acquire+0xb5c/0x1ec0
 [<800943f8>] lock_acquire+0xc4/0x174
 [<8068cbd8>] _raw_spin_lock+0x58/0x68
 [<800bdb10>] handle_fasteoi_irq+0x24/0x15c
 [<800b9c8c>] generic_handle_irq+0x34/0x44
 [<8002007c>] handle_IRQ+0x50/0xa0
 [<800085d8>] gic_handle_irq+0x48/0x78
 [<8001f1c4>] __irq_svc+0x44/0x8c
 [<800204a4>] arch_cpu_idle+0x40/0x4c
 [<800815f8>] cpu_startup_entry+0x1a4/0x2dc
 [<8067b780>] rest_init+0xdc/0xec
 [<80910c34>] start_kernel+0x428/0x434
 [<40008084>] 0x40008084
 INITIAL USE at:
 [<8008ffa0>] mark_lock+0x180/0x808
 [<8009219c>] __lock_acquire+0x2c0/0x1ec0
 [<800943f8>] lock_acquire+0xc4/0x174
 [<8068cd88>] _raw_spin_lock_irqsave+0x68/0x7c
 [<800b9ef0>] __irq_get_desc_lock+0x60/0x9c
 [<800bd024>] irq_modify_status+0x30/0xbc
 [<800b9fe8>] irq_set_percpu_devid+0x74/0x8c
 [<803cb838>] gic_irq_domain_map+0x64/0x90
 [<800bf5d0>] irq_domain_add_legacy+0x114/0x158
 [<8093c2b0>] gic_init_bases+0x224/0x3c4
 [<8093c528>] gic_of_init+0xd8/0x110
 [<809445f0>] of_irq_init+0x184/0x29c
 [<8093be60>] irqchip_init+0x18/0x1c
 [<80919ca8>] exynos5_init_irq+0x10/0x28
 [<80913fb0>] init_IRQ+0x30/0x34
 [<80910a50>] start_kernel+0x244/0x434
 [<40008084>] 0x40008084
 }
 ... key at: [<80f288ac>] irq_desc_lock_class+0x0/0x8
 ... acquired at:
 [<8008fa94>] check_usage+0x464/0x648
 [<8008fcdc>] check_irq_usage+0x64/0xc0
 [<80092e98>] __lock_acquire+0xfbc/0x1ec0
 [<800943f8>] lock_acquire+0xc4/0x174
 [<8068cbd8>] _raw_spin_lock+0x58/0x68
 [<8068ba2c>] rt_spin_lock_slowlock+0x54/0x2f8
 [<8068c42c>] rt_spin_lock+0x3c/0x68
 [<803d2050>] exynos_wkup_irq_set_type+0xec/0x190
 [<800bbcc8>] __irq_set_trigger+0x64/0x120
 [<800bc14c>] __setup_irq+0x3c8/0x4c4
 [<800bc39c>] request_threaded_irq+0xbc/0x13c
 [<800bc478>] request_any_context_irq+0x5c/0x8c
 [<804e2e48>] gpio_keys_probe+0x2cc/0x83c
 [<8041df3c>] platform_drv_probe+0x24/0x28
 [<8041c9b0>] driver_probe_device+0x118/0x230
 [<8041cbb8>] __driver_attach+0x9c/0xa0
 [<8041aad4>] bus_for_each_dev+0x70/0xa4
 [<8041c430>] driver_attach+0x2c/0x30
 [<8041c048>] bus_add_driver+0x1e0/0x26c
 [<8041d26c>] driver_register+0x88/0x150
 [<8041e620>] platform_driver_register+0x60/0x68
 [<80942488>] gpio_keys_init+0x18/0x1c
 [<800087a4>] do_one_initcall+0x128/0x180
 [<80910e40>] kernel_init_freeable+0x200/0x2a0
 [<8067b7b0>] kernel_init+0x20/0x170
 [<8001f758>] ret_from_fork+0x14/0x20


 the dependencies between the lock to be acquired and HARDIRQ-irq-unsafe lock:
 -> (&(&(&bank->slock)->lock)->wait_lock){+.+...} ops: 145 {
 HARDIRQ-ON-W at:
 [<8008ffa0>] mark_lock+0x180/0x808
 [<80092498>] __lock_acquire+0x5bc/0x1ec0
 [<800943f8>] lock_acquire+0xc4/0x174
 [<8068cbd8>] _raw_spin_lock+0x58/0x68
 [<8068ba2c>] rt_spin_lock_slowlock+0x54/0x2f8
 [<8068c42c>] rt_spin_lock+0x3c/0x68
 [<803d0594>] samsung_pinconf_rw+0xc8/0x14c
 [<803d06dc>] samsung_pinconf_group_set+0x70/0x90
 [<803cf864>] pinconf_apply_setting+0x90/0x198
 [<803cc07c>] pinctrl_select_state+0xf0/0x1a8
 [<80436790>] pinctrl_bind_pins+0x7c/0xd4
 [<8041c900>] driver_probe_device+0x68/0x230
 [<8041cbb8>] __driver_attach+0x9c/0xa0
 [<8041aad4>] bus_for_each_dev+0x70/0xa4
 [<8041c430>] driver_attach+0x2c/0x30
 [<8041c048>] bus_add_driver+0x1e0/0x26c
 [<8041d26c>] driver_register+0x88/0x150
 [<8041e620>] platform_driver_register+0x60/0x68
 [<809426e0>] i2c_adap_s3c_init+0x18/0x1c
 [<800087a4>] do_one_initcall+0x128/0x180
 [<80910e40>] kernel_init_freeable+0x200/0x2a0
 [<8067b7b0>] kernel_init+0x20/0x170
 [<8001f758>] ret_from_fork+0x14/0x20
 SOFTIRQ-ON-W at:
 [<8008ffa0>] mark_lock+0x180/0x808
 [<800924c0>] __lock_acquire+0x5e4/0x1ec0
 [<800943f8>] lock_acquire+0xc4/0x174
 [<8068cbd8>] _raw_spin_lock+0x58/0x68
 [<8068ba2c>] rt_spin_lock_slowlock+0x54/0x2f8
 [<8068c42c>] rt_spin_lock+0x3c/0x68
 [<803d0594>] samsung_pinconf_rw+0xc8/0x14c
 [<803d06dc>] samsung_pinconf_group_set+0x70/0x90
 [<803cf864>] pinconf_apply_setting+0x90/0x198
 [<803cc07c>] pinctrl_select_state+0xf0/0x1a8
 [<80436790>] pinctrl_bind_pins+0x7c/0xd4
 [<8041c900>] driver_probe_device+0x68/0x230
 [<8041cbb8>] __driver_attach+0x9c/0xa0
 [<8041aad4>] bus_for_each_dev+0x70/0xa4
 [<8041c430>] driver_attach+0x2c/0x30
 [<8041c048>] bus_add_driver+0x1e0/0x26c
 [<8041d26c>] driver_register+0x88/0x150
 [<8041e620>] platform_driver_register+0x60/0x68
 [<809426e0>] i2c_adap_s3c_init+0x18/0x1c
 [<800087a4>] do_one_initcall+0x128/0x180
 [<80910e40>] kernel_init_freeable+0x200/0x2a0
 [<8067b7b0>] kernel_init+0x20/0x170
 [<8001f758>] ret_from_fork+0x14/0x20
 INITIAL USE at:
 [<8008ffa0>] mark_lock+0x180/0x808
 [<8009219c>] __lock_acquire+0x2c0/0x1ec0
 [<800943f8>] lock_acquire+0xc4/0x174
 [<8068cbd8>] _raw_spin_lock+0x58/0x68
 [<8068ba2c>] rt_spin_lock_slowlock+0x54/0x2f8
 [<8068c42c>] rt_spin_lock+0x3c/0x68
 [<803d0594>] samsung_pinconf_rw+0xc8/0x14c
 [<803d06dc>] samsung_pinconf_group_set+0x70/0x90
 [<803cf864>] pinconf_apply_setting+0x90/0x198
 [<803cc07c>] pinctrl_select_state+0xf0/0x1a8
 [<80436790>] pinctrl_bind_pins+0x7c/0xd4
 [<8041c900>] driver_probe_device+0x68/0x230
 [<8041cbb8>] __driver_attach+0x9c/0xa0
 [<8041aad4>] bus_for_each_dev+0x70/0xa4
 [<8041c430>] driver_attach+0x2c/0x30
 [<8041c048>] bus_add_driver+0x1e0/0x26c
 [<8041d26c>] driver_register+0x88/0x150
 [<8041e620>] platform_driver_register+0x60/0x68
 [<809426e0>] i2c_adap_s3c_init+0x18/0x1c
 [<800087a4>] do_one_initcall+0x128/0x180
 [<80910e40>] kernel_init_freeable+0x200/0x2a0
 [<8067b7b0>] kernel_init+0x20/0x170
 [<8001f758>] ret_from_fork+0x14/0x20
 }
 ... key at: [<80f6f0ec>] __key.15784+0x0/0x8
 ... acquired at:
 [<8008fad0>] check_usage+0x4a0/0x648
 [<8008fcdc>] check_irq_usage+0x64/0xc0
 [<80092e98>] __lock_acquire+0xfbc/0x1ec0
 [<800943f8>] lock_acquire+0xc4/0x174
 [<8068cbd8>] _raw_spin_lock+0x58/0x68
 [<8068ba2c>] rt_spin_lock_slowlock+0x54/0x2f8
 [<8068c42c>] rt_spin_lock+0x3c/0x68
 [<803d2050>] exynos_wkup_irq_set_type+0xec/0x190
 [<800bbcc8>] __irq_set_trigger+0x64/0x120
 [<800bc14c>] __setup_irq+0x3c8/0x4c4
 [<800bc39c>] request_threaded_irq+0xbc/0x13c
 [<800bc478>] request_any_context_irq+0x5c/0x8c
 [<804e2e48>] gpio_keys_probe+0x2cc/0x83c
 [<8041df3c>] platform_drv_probe+0x24/0x28
 [<8041c9b0>] driver_probe_device+0x118/0x230
 [<8041cbb8>] __driver_attach+0x9c/0xa0
 [<8041aad4>] bus_for_each_dev+0x70/0xa4
 [<8041c430>] driver_attach+0x2c/0x30
 [<8041c048>] bus_add_driver+0x1e0/0x26c
 [<8041d26c>] driver_register+0x88/0x150
 [<8041e620>] platform_driver_register+0x60/0x68
 [<80942488>] gpio_keys_init+0x18/0x1c
 [<800087a4>] do_one_initcall+0x128/0x180
 [<80910e40>] kernel_init_freeable+0x200/0x2a0
 [<8067b7b0>] kernel_init+0x20/0x170
 [<8001f758>] ret_from_fork+0x14/0x20


 stack backtrace:
 CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.10.6-linaro-arndale #1
 [<80026578>] (unwind_backtrace+0x0/0x100) from [<80023a90>]
(show_stack+0x20/0x24)
 [<80023a90>] (show_stack+0x20/0x24) from [<80688914>] (dump_stack+0x24/0x28)
 [<80688914>] (dump_stack+0x24/0x28) from [<8008faf4>] (check_usage+0x4c4/0x648)
 [<8008faf4>] (check_usage+0x4c4/0x648) from [<8008fcdc>]
(check_irq_usage+0x64/0xc0)
 [<8008fcdc>] (check_irq_usage+0x64/0xc0) from [<80092e98>]
(__lock_acquire+0xfbc/0x1ec0)
 [<80092e98>] (__lock_acquire+0xfbc/0x1ec0) from [<800943f8>]
(lock_acquire+0xc4/0x174)
 [<800943f8>] (lock_acquire+0xc4/0x174) from [<8068cbd8>]
(_raw_spin_lock+0x58/0x68)
 [<8068cbd8>] (_raw_spin_lock+0x58/0x68) from [<8068ba2c>]
(rt_spin_lock_slowlock+0x54/0x2f8)
 [<8068ba2c>] (rt_spin_lock_slowlock+0x54/0x2f8) from [<8068c42c>]
(rt_spin_lock+0x3c/0x68)
 [<8068c42c>] (rt_spin_lock+0x3c/0x68) from [<803d2050>]
(exynos_wkup_irq_set_type+0xec/0x190)
 [<803d2050>] (exynos_wkup_irq_set_type+0xec/0x190) from [<800bbcc8>]
(__irq_set_trigger+0x64/0x120)
 [<800bbcc8>] (__irq_set_trigger+0x64/0x120) from [<800bc14c>]
(__setup_irq+0x3c8/0x4c4)
 [<800bc14c>] (__setup_irq+0x3c8/0x4c4) from [<800bc39c>]
(request_threaded_irq+0xbc/0x13c)
 [<800bc39c>] (request_threaded_irq+0xbc/0x13c) from [<800bc478>]
(request_any_context_irq+0x5c/0x8c)
 [<800bc478>] (request_any_context_irq+0x5c/0x8c) from [<804e2e48>]
(gpio_keys_probe+0x2cc/0x83c)
 [<804e2e48>] (gpio_keys_probe+0x2cc/0x83c) from [<8041df3c>]
(platform_drv_probe+0x24/0x28)
 [<8041df3c>] (platform_drv_probe+0x24/0x28) from [<8041c9b0>]
(driver_probe_device+0x118/0x230)
 [<8041c9b0>] (driver_probe_device+0x118/0x230) from [<8041cbb8>]
(__driver_attach+0x9c/0xa0)
 [<8041cbb8>] (__driver_attach+0x9c/0xa0) from [<8041aad4>]
(bus_for_each_dev+0x70/0xa4)
 [<8041aad4>] (bus_for_each_dev+0x70/0xa4) from [<8041c430>]
(driver_attach+0x2c/0x30)
 [<8041c430>] (driver_attach+0x2c/0x30) from [<8041c048>]
(bus_add_driver+0x1e0/0x26c)
 [<8041c048>] (bus_add_driver+0x1e0/0x26c) from [<8041d26c>]
(driver_register+0x88/0x150)
 [<8041d26c>] (driver_register+0x88/0x150) from [<8041e620>]
(platform_driver_register+0x60/0x68)
 [<8041e620>] (platform_driver_register+0x60/0x68) from [<80942488>]
(gpio_keys_init+0x18/0x1c)
 [<80942488>] (gpio_keys_init+0x18/0x1c) from [<800087a4>]
(do_one_initcall+0x128/0x180)
 [<800087a4>] (do_one_initcall+0x128/0x180) from [<80910e40>]
(kernel_init_freeable+0x200/0x2a0)
 [<80910e40>] (kernel_init_freeable+0x200/0x2a0) from [<8067b7b0>]
(kernel_init+0x20/0x170)
 [<8067b7b0>] (kernel_init+0x20/0x170) from [<8001f758>]
(ret_from_fork+0x14/0x20)


> Does this happen on linux-next?

Not tried on that, it was tried on 3.10 stable kernel merged with RT patches..

--
viresh

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 00/25] tty: serial: drop uart_port->lock before calling
  2013-08-16 12:27 ` Greg KH
@ 2013-08-16 17:44   ` Viresh Kumar
  2013-08-19 10:43     ` Viresh Kumar
  0 siblings, 1 reply; 33+ messages in thread
From: Viresh Kumar @ 2013-08-16 17:44 UTC (permalink / raw)
  To: Greg KH
  Cc: jslaby, Lists linaro-kernel, Patch Tracking, linux-serial,
	Bryan Huntsman, Daniel Walker, David Brown, Stephen Warren,
	Tobias Klauser, Tony Prisk

On 16 August 2013 17:57, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Fri, Aug 16, 2013 at 05:13:01PM +0530, Viresh Kumar wrote:
>> The -rt patch triggers a lockdep warning for serial drivers if
>> tty_flip_buffer_push() is called with uart_port->lock locked. This never shows
>> up on UP kernels.
>
> What about SMP kernels?  linux-next?

As per Thomas Gleixner initial patch, it must break for SMP too. But we
have tested it only for 3.10 stable merged with RT Kernel patchset..

Haven't tried it on linux-next..

>> This is neither tested nor compiled.
>
> So I'm guessing you don't want it to be applied, if you can't take the
> time to at least test-build it, why should we?
>
> {sigh}

:( ..

Actually I build tested it for few ARM platforms but not for others.. Now
its build tested for all platforms that are modified here..

> Lots of tty and serial changes have happened since -rc5 in linux-next,
> can you please rebase, and test, these against that tree and resend them
> if they are still needed?

I have rebased them over latest linux-next and they applied cleanly..
Haven't tested it though.. Will try that next week.

Sorry for the noise :(

--
viresh

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 00/25] tty: serial: drop uart_port->lock before calling
  2013-08-16 17:44   ` Viresh Kumar
@ 2013-08-19 10:43     ` Viresh Kumar
  2013-08-19 13:15       ` Peter Hurley
  0 siblings, 1 reply; 33+ messages in thread
From: Viresh Kumar @ 2013-08-19 10:43 UTC (permalink / raw)
  To: Greg KH
  Cc: jslaby, Lists linaro-kernel, Patch Tracking, linux-serial,
	Bryan Huntsman, Daniel Walker, David Brown, Stephen Warren,
	Tobias Klauser, Tony Prisk

On 16 August 2013 23:14, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 16 August 2013 17:57, Greg KH <gregkh@linuxfoundation.org> wrote:

>> Lots of tty and serial changes have happened since -rc5 in linux-next,
>> can you please rebase, and test, these against that tree and resend them
>> if they are still needed?
>
> I have rebased them over latest linux-next and they applied cleanly..
> Haven't tested it though.. Will try that next week.

I initially thought that the problem only occurs with a merge to RT
kernel otherwise this would have happened to lots of people..

But when I tried latest linux-next/master (as of today), without
RT patch I was able to reproduce the issue on Samsung's Arndale
board.

[  129.179314] [<c0014d58>] (unwind_backtrace+0x0/0xf8) from
[<c0011908>] (show_stack+0x10/0x14)
[  129.187676] [<c0011908>] (show_stack+0x10/0x14) from [<c035da34>]
(dump_stack+0x6c/0xac)
[  129.195619] [<c035da34>] (dump_stack+0x6c/0xac) from [<c01b59ac>]
(do_raw_spin_unlock+0xc4/0xd8)
[  129.204247] [<c01b59ac>] (do_raw_spin_unlock+0xc4/0xd8) from
[<c03627e4>] (_raw_spin_unlock_irqrestore+0xc/0)
[  129.214241] [<c03627e4>] (_raw_spin_unlock_irqrestore+0xc/0x38)
from [<c020a1a8>] (s3c24xx_serial_rx_chars+0)
[  129.224832] [<c020a1a8>] (s3c24xx_serial_rx_chars+0x12c/0x260) from
[<c020aae8>] (s3c64xx_serial_handle_irq+)
[  129.235336] [<c020aae8>] (s3c64xx_serial_handle_irq+0x48/0x60) from
[<c006aaa0>] (handle_irq_event_percpu+0x)
[  129.245753] [<c006aaa0>] (handle_irq_event_percpu+0x50/0x194) from
[<c006ac20>] (handle_irq_event+0x3c/0x5c)
[  129.255407] [<c006ac20>] (handle_irq_event+0x3c/0x5c) from
[<c006d864>] (handle_fasteoi_irq+0x80/0x13c)
[  129.264636] [<c006d864>] (handle_fasteoi_irq+0x80/0x13c) from
[<c006a4a4>] (generic_handle_irq+0x20/0x30)
[  129.274030] [<c006a4a4>] (generic_handle_irq+0x20/0x30) from
[<c000f454>] (handle_IRQ+0x38/0x94)
[  129.282655] [<c000f454>] (handle_IRQ+0x38/0x94) from [<c0008538>]
(gic_handle_irq+0x34/0x68)
[  129.290938] [<c0008538>] (gic_handle_irq+0x34/0x68) from
[<c00123c0>] (__irq_svc+0x40/0x70)
[  129.299134] Exception stack(0xc04cdf70 to 0xc04cdfb8)
[  129.304084] df60:                                     00000000
00000000 0000166e 00000000
[  129.312117] df80: c04cc000 c050278f c050278f 00000001 c04d444c
410fc0f4 c03649b0 00000000
[  129.320146] dfa0: 00000001 c04cdfb8 c000f758 c000f75c 60070013 ffffffff
[  129.326639] [<c00123c0>] (__irq_svc+0x40/0x70) from [<c000f75c>]
(arch_cpu_idle+0x28/0x30)
[  129.334756] [<c000f75c>] (arch_cpu_idle+0x28/0x30) from
[<c0054888>] (cpu_startup_entry+0x5c/0x148)
[  129.343644] [<c0054888>] (cpu_startup_entry+0x5c/0x148) from
[<c0497aa4>] (start_kernel+0x334/0x38c)
[  133.343767] BUG: spinlock lockup suspected on CPU#0, kworker/0:1/360
[  133.348574]  lock: s3c24xx_serial_ports+0x1d8/0x370, .magic:
dead4ead, .owner: <none>/-1, .owner_cpu: -1
[  133.357885] CPU: 0 PID: 360 Comm: kworker/0:1 Not tainted
3.11.0-rc6-next-20130819-00003-g75485f1 #2
[  133.366858] Workqueue: events flush_to_ldisc
[  133.371034] [<c0014d58>] (unwind_backtrace+0x0/0xf8) from
[<c0011908>] (show_stack+0x10/0x14)
[  133.379413] [<c0011908>] (show_stack+0x10/0x14) from [<c035da34>]
(dump_stack+0x6c/0xac)
[  133.387355] [<c035da34>] (dump_stack+0x6c/0xac) from [<c01b581c>]
(do_raw_spin_lock+0x100/0x17c)
[  133.395982] [<c01b581c>] (do_raw_spin_lock+0x100/0x17c) from
[<c03628a0>] (_raw_spin_lock_irqsave+0x20/0x28)
[  133.405635] [<c03628a0>] (_raw_spin_lock_irqsave+0x20/0x28) from
[<c0203224>] (uart_start+0x18/0x34)
[  133.414602] [<c0203224>] (uart_start+0x18/0x34) from [<c01ef890>]
(__receive_buf+0x4b4/0x738)
[  133.422973] [<c01ef890>] (__receive_buf+0x4b4/0x738) from
[<c01efb44>] (n_tty_receive_buf2+0x30/0x98)
[  133.432026] [<c01efb44>] (n_tty_receive_buf2+0x30/0x98) from
[<c01f2ba8>] (flush_to_ldisc+0xec/0x138)
[  133.441081] [<c01f2ba8>] (flush_to_ldisc+0xec/0x138) from
[<c0031af0>] (process_one_work+0xfc/0x348)
[  133.450048] [<c0031af0>] (process_one_work+0xfc/0x348) from
[<c0032138>] (worker_thread+0x138/0x37c)
[  133.459014] [<c0032138>] (worker_thread+0x138/0x37c) from
[<c0037a7c>] (kthread+0xa4/0xb0)
[  133.467128] [<c0037a7c>] (kthread+0xa4/0xb0) from [<c000e5f8>]
(ret_from_fork+0x14/0x3c)


And so yes they are required over latest linux-next as well..
I will resend V2 soon. Thanks..

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 00/25] tty: serial: drop uart_port->lock before calling
  2013-08-19 10:43     ` Viresh Kumar
@ 2013-08-19 13:15       ` Peter Hurley
  2013-08-19 14:37         ` Viresh Kumar
  0 siblings, 1 reply; 33+ messages in thread
From: Peter Hurley @ 2013-08-19 13:15 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Greg KH, jslaby, Lists linaro-kernel, Patch Tracking,
	linux-serial, Bryan Huntsman, Daniel Walker, David Brown,
	Stephen Warren, Tobias Klauser, Tony Prisk

On 08/19/2013 06:43 AM, Viresh Kumar wrote:
> On 16 August 2013 23:14, Viresh Kumar <viresh.kumar@linaro.org> wrote:
>> On 16 August 2013 17:57, Greg KH <gregkh@linuxfoundation.org> wrote:
>
>>> Lots of tty and serial changes have happened since -rc5 in linux-next,
>>> can you please rebase, and test, these against that tree and resend them
>>> if they are still needed?
>>
>> I have rebased them over latest linux-next and they applied cleanly..
>> Haven't tested it though.. Will try that next week.
>
> I initially thought that the problem only occurs with a merge to RT
> kernel otherwise this would have happened to lots of people..
>
> But when I tried latest linux-next/master (as of today), without
> RT patch I was able to reproduce the issue on Samsung's Arndale
> board.
>
> [  129.179314] [<c0014d58>] (unwind_backtrace+0x0/0xf8) from [<c0011908>] (show_stack+0x10/0x14)
> [  129.187676] [<c0011908>] (show_stack+0x10/0x14) from [<c035da34>] (dump_stack+0x6c/0xac)
> [  129.195619] [<c035da34>] (dump_stack+0x6c/0xac) from [<c01b59ac>] (do_raw_spin_unlock+0xc4/0xd8)
> [  129.204247] [<c01b59ac>] (do_raw_spin_unlock+0xc4/0xd8) from [<c03627e4>] (_raw_spin_unlock_irqrestore+0xc/0)
> [  129.214241] [<c03627e4>] (_raw_spin_unlock_irqrestore+0xc/0x38) from [<c020a1a8>] (s3c24xx_serial_rx_chars+0)
> [  129.224832] [<c020a1a8>] (s3c24xx_serial_rx_chars+0x12c/0x260) from [<c020aae8>] (s3c64xx_serial_handle_irq+)
> [  129.235336] [<c020aae8>] (s3c64xx_serial_handle_irq+0x48/0x60) from [<c006aaa0>] (handle_irq_event_percpu+0x)
> [  129.245753] [<c006aaa0>] (handle_irq_event_percpu+0x50/0x194) from [<c006ac20>] (handle_irq_event+0x3c/0x5c)
> [  129.255407] [<c006ac20>] (handle_irq_event+0x3c/0x5c) from [<c006d864>] (handle_fasteoi_irq+0x80/0x13c)
> [  129.264636] [<c006d864>] (handle_fasteoi_irq+0x80/0x13c) from [<c006a4a4>] (generic_handle_irq+0x20/0x30)
> [  129.274030] [<c006a4a4>] (generic_handle_irq+0x20/0x30) from [<c000f454>] (handle_IRQ+0x38/0x94)
> [  129.282655] [<c000f454>] (handle_IRQ+0x38/0x94) from [<c0008538>] (gic_handle_irq+0x34/0x68)
> [  129.290938] [<c0008538>] (gic_handle_irq+0x34/0x68) from [<c00123c0>] (__irq_svc+0x40/0x70)
> [  129.299134] Exception stack(0xc04cdf70 to 0xc04cdfb8)
> [  129.304084] df60:                                     00000000 00000000 0000166e 00000000
> [  129.312117] df80: c04cc000 c050278f c050278f 00000001 c04d444c 410fc0f4 c03649b0 00000000
> [  129.320146] dfa0: 00000001 c04cdfb8 c000f758 c000f75c 60070013 ffffffff
> [  129.326639] [<c00123c0>] (__irq_svc+0x40/0x70) from [<c000f75c>] (arch_cpu_idle+0x28/0x30)
> [  129.334756] [<c000f75c>] (arch_cpu_idle+0x28/0x30) from [<c0054888>] (cpu_startup_entry+0x5c/0x148)
> [  129.343644] [<c0054888>] (cpu_startup_entry+0x5c/0x148) from [<c0497aa4>] (start_kernel+0x334/0x38c)
> [  133.343767] BUG: spinlock lockup suspected on CPU#0, kworker/0:1/360
> [  133.348574]  lock: s3c24xx_serial_ports+0x1d8/0x370, .magic: dead4ead, .owner: <none>/-1, .owner_cpu: -1
> [  133.357885] CPU: 0 PID: 360 Comm: kworker/0:1 Not tainted 3.11.0-rc6-next-20130819-00003-g75485f1 #2
> [  133.366858] Workqueue: events flush_to_ldisc
> [  133.371034] [<c0014d58>] (unwind_backtrace+0x0/0xf8) from [<c0011908>] (show_stack+0x10/0x14)
> [  133.379413] [<c0011908>] (show_stack+0x10/0x14) from [<c035da34>] (dump_stack+0x6c/0xac)
> [  133.387355] [<c035da34>] (dump_stack+0x6c/0xac) from [<c01b581c>] (do_raw_spin_lock+0x100/0x17c)
> [  133.395982] [<c01b581c>] (do_raw_spin_lock+0x100/0x17c) from [<c03628a0>] (_raw_spin_lock_irqsave+0x20/0x28)
> [  133.405635] [<c03628a0>] (_raw_spin_lock_irqsave+0x20/0x28) from [<c0203224>] (uart_start+0x18/0x34)
> [  133.414602] [<c0203224>] (uart_start+0x18/0x34) from [<c01ef890>] (__receive_buf+0x4b4/0x738)
> [  133.422973] [<c01ef890>] (__receive_buf+0x4b4/0x738) from [<c01efb44>] (n_tty_receive_buf2+0x30/0x98)
> [  133.432026] [<c01efb44>] (n_tty_receive_buf2+0x30/0x98) from [<c01f2ba8>] (flush_to_ldisc+0xec/0x138)
> [  133.441081] [<c01f2ba8>] (flush_to_ldisc+0xec/0x138) from [<c0031af0>] (process_one_work+0xfc/0x348)
> [  133.450048] [<c0031af0>] (process_one_work+0xfc/0x348) from [<c0032138>] (worker_thread+0x138/0x37c)
> [  133.459014] [<c0032138>] (worker_thread+0x138/0x37c) from [<c0037a7c>] (kthread+0xa4/0xb0)
> [  133.467128] [<c0037a7c>] (kthread+0xa4/0xb0) from [<c000e5f8>] (ret_from_fork+0x14/0x3c)
>
>
> And so yes they are required over latest linux-next as well..
> I will resend V2 soon. Thanks..

Umm. How did a worker thread schedule while an IRQ handler was holding a irq-disabling spin lock?

Regards,
Peter Hurley

PS - please paste your stack backtraces with line-wrap disabled


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 00/25] tty: serial: drop uart_port->lock before calling
  2013-08-19 13:15       ` Peter Hurley
@ 2013-08-19 14:37         ` Viresh Kumar
  0 siblings, 0 replies; 33+ messages in thread
From: Viresh Kumar @ 2013-08-19 14:37 UTC (permalink / raw)
  To: Peter Hurley
  Cc: Greg KH, jslaby, Lists linaro-kernel, Patch Tracking,
	linux-serial, Bryan Huntsman, Daniel Walker, David Brown,
	Stephen Warren, Tobias Klauser, Tony Prisk

On 19 August 2013 18:45, Peter Hurley <peter@hurleysoftware.com> wrote:
> Umm. How did a worker thread schedule while an IRQ handler was holding a
> irq-disabling spin lock?

Not sure.. I was just trying to fix a random issue that came to me. Don't really
have much knowledge of serial backend :(

> PS - please paste your stack backtraces with line-wrap disabled

I copied it correctly but its gmail which corrupted it.. If I see the
text in your
reply its fixed automatically :)

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2013-08-19 14:37 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-16 11:43 [PATCH 00/25] tty: serial: drop uart_port->lock before calling Viresh Kumar
2013-08-16 11:43 ` [PATCH 01/25] tty: serial: altera_jtag: drop uart_port->lock before calling tty_flip_buffer_push() Viresh Kumar
2013-08-16 11:43 ` [PATCH 02/25] tty: serial: altera: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 03/25] tty: serial: apbuart: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 04/25] tty: serial: ar933x: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 05/25] tty: serial: arc: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 06/25] tty: serial: bcm63xx: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 07/25] tty: serial: bfin_sport: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 08/25] tty: serial: efm32: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 09/25] tty: serial: icom: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 10/25] tty: serial: lpc32xx_hs: don't call tty_flip_buffer_push() twice Viresh Kumar
2013-08-16 11:43 ` [PATCH 11/25] tty: serial: lpc32xx_hs: drop uart_port->lock before calling tty_flip_buffer_push() Viresh Kumar
2013-08-16 11:43 ` [PATCH 12/25] tty: serial: m32r_sio: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 13/25] tty: serial: mcf: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 14/25] tty: serial: mfd: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 15/25] tty: serial: mpsc: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 16/25] tty: serial: msm: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 17/25] tty: serial: netx: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 18/25] tty: serial: nwpserial: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 19/25] tty: serial: pnx8xxx: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 20/25] tty: serial: rp2: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 21/25] tty: serial: sa1100: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 22/25] tty: serial: samsung: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 23/25] tty: serial: tegra: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 24/25] tty: serial: sirfsoc: " Viresh Kumar
2013-08-16 11:43 ` [PATCH 25/25] tty: serial: vt8500: " Viresh Kumar
2013-08-16 12:06 ` [PATCH 00/25] tty: serial: drop uart_port->lock before calling Peter Hurley
2013-08-16 16:59   ` Viresh Kumar
2013-08-16 12:27 ` Greg KH
2013-08-16 17:44   ` Viresh Kumar
2013-08-19 10:43     ` Viresh Kumar
2013-08-19 13:15       ` Peter Hurley
2013-08-19 14:37         ` Viresh Kumar

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.