Commit ebade5e8 authored by Ingo Molnar's avatar Ingo Molnar Committed by Greg Kroah-Hartman

serial: 8250: Clean up the locking for -rt

In -RT the spin_lock_irqsave() does not spin but sleep if the lock is
taken. Before that, local_irq_save() is invoked which disables
interrupts even on -RT. Therefore local_irq_save() + spin_lock() does not
work.
In the ->sysrq and oops_in_progress case it is save to trylock the lock
i.e. this is what we do now anyway except for ->sysrq where we assume
that the lock is already taken.

The spin_lock_irqsave() grabs the lock and disables the interrupts on
vanilla (the same behavior) and on -RT it won't disable interrupts.
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
[bigeasy: add a patch description]
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 41d3f099
...@@ -2886,14 +2886,10 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) ...@@ -2886,14 +2886,10 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)
touch_nmi_watchdog(); touch_nmi_watchdog();
local_irq_save(flags); if (port->sysrq || oops_in_progress)
if (port->sysrq) { locked = spin_trylock_irqsave(&port->lock, flags);
/* serial8250_handle_irq() already took the lock */ else
locked = 0; spin_lock_irqsave(&port->lock, flags);
} else if (oops_in_progress) {
locked = spin_trylock(&port->lock);
} else
spin_lock(&port->lock);
/* /*
* First save the IER then disable the interrupts * First save the IER then disable the interrupts
...@@ -2925,8 +2921,7 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) ...@@ -2925,8 +2921,7 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)
serial8250_modem_status(up); serial8250_modem_status(up);
if (locked) if (locked)
spin_unlock(&port->lock); spin_unlock_irqrestore(&port->lock, flags);
local_irq_restore(flags);
} }
static int __init serial8250_console_setup(struct console *co, char *options) static int __init serial8250_console_setup(struct console *co, char *options)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment