[yocto] [PATCH 2/2] [RT] pch_uart: Correct spin_lock and irqsave usage in pch_console_write

Darren Hart dvhart at linux.intel.com
Thu May 31 11:04:59 PDT 2012


pch_console_write was calling:

    local_irq_save()
        spin_lock(a)
	spin_lock(b)
        ...
        spin_unlock(b)
        spin_unlock(a)
    local_irq_restore()

Which trips the rtmutex debug code:

BUG: sleeping function called from invalid context at kernel/rtmutex.c:646

Update the function to use the _nort versions of local_irq* (thanks Peterz for
the suggestion).

    local_irq_save_nort()
        spin_lock(a)
	spin_lock(b)
        ...
        spin_unlock(b)
        spin_unlock(a)
    local_irq_restore_nort()

Signed-off-by: Darren Hart <dvhart at linux.intel.com>
CC: Tomoya MORINAGA <tomoya.rohm at gmail.com>
CC: Feng Tang <feng.tang at intel.com>
CC: Alexander Stein <alexander.stein at systec-electronic.com>
CC: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
CC: Alan Cox <alan at linux.intel.com>
CC: Steven Rostedt <rostedt at goodmis.org>
CC: Peter Zijlstra <peterz at infradead.org>
CC: linux-serial at vger.kernel.org
---
 drivers/tty/serial/pch_uart.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index db61d00..9164cef 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -1489,7 +1489,7 @@ pch_console_write(struct console *co, const char *s, unsigned int count)
 
 	touch_nmi_watchdog();
 
-	local_irq_save(flags);
+	local_irq_save_nort(flags);
 	spin_lock(&priv->lock);
 	if (priv->port.sysrq) {
 		/* serial8250_handle_port() already took the lock */
@@ -1519,7 +1519,7 @@ pch_console_write(struct console *co, const char *s, unsigned int count)
 	if (locked)
 		spin_unlock(&priv->port.lock);
 	spin_unlock(&priv->lock);
-	local_irq_restore(flags);
+	local_irq_restore_nort(flags);
 
 }
 
-- 
1.7.5.4




More information about the yocto mailing list