Re: [lockdep warning] INFO: inconsistent lock state, serial8250_interrupt(), &port_lock_key

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Borislav Petkov
Date: Wednesday, July 23, 2008 - 11:53 pm

On Wed, Jul 23, 2008 at 11:36:04AM +0200, Ingo Molnar wrote:

Hi,

i hit the same warning here. How about the following fix (this is at least what
i think happens):
--

serial8250_startup() might unconditionally enable irqs after releasing
&up->port.lock while we're still servicing an interrupt.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>

--
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 27f34a9..55eca08 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1874,7 +1874,7 @@ static int serial8250_startup(struct uart_port *port)
 		 * the interrupt is enabled.  Delays are necessary to
 		 * allow register changes to become visible.
 		 */
-		spin_lock(&up->port.lock);
+		spin_lock_irqsave(&up->port.lock, flags);
 		if (up->port.flags & UPF_SHARE_IRQ)
 			disable_irq_nosync(up->port.irq);
 
@@ -1890,7 +1890,7 @@ static int serial8250_startup(struct uart_port *port)
 
 		if (up->port.flags & UPF_SHARE_IRQ)
 			enable_irq(up->port.irq);
-		spin_unlock(&up->port.lock);
+		spin_unlock_irqrestore(&up->port.lock, flags);
 
 		/*
 		 * If the interrupt is not reasserted, setup a timer to

-- 
Regards/Gruß,
    Boris.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [lockdep warning] INFO: inconsistent lock state, seria ..., Borislav Petkov, (Wed Jul 23, 11:53 pm)