Commit d8a5a8d7 authored by Russell King's avatar Russell King Committed by Russell King

[SERIAL] 8250: add locking to console write function

x86 SMP breaks as a result of the previous change, we have no real
option other than to add locking to the 8250 console write function.
If an oops is in progress, try to acquire the lock.  If we fail to
do so, continue anyway.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent a88d75b2
...@@ -2235,10 +2235,17 @@ static void ...@@ -2235,10 +2235,17 @@ static void
serial8250_console_write(struct console *co, const char *s, unsigned int count) serial8250_console_write(struct console *co, const char *s, unsigned int count)
{ {
struct uart_8250_port *up = &serial8250_ports[co->index]; struct uart_8250_port *up = &serial8250_ports[co->index];
unsigned long flags;
unsigned int ier; unsigned int ier;
int locked = 1;
touch_nmi_watchdog(); touch_nmi_watchdog();
if (oops_in_progress) {
locked = spin_trylock_irqsave(&up->port.lock, flags);
} else
spin_lock_irqsave(&up->port.lock, flags);
/* /*
* First save the IER then disable the interrupts * First save the IER then disable the interrupts
*/ */
...@@ -2257,6 +2264,9 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) ...@@ -2257,6 +2264,9 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)
*/ */
wait_for_xmitr(up, BOTH_EMPTY); wait_for_xmitr(up, BOTH_EMPTY);
serial_out(up, UART_IER, ier); serial_out(up, UART_IER, ier);
if (locked)
spin_unlock_irqrestore(&up->port.lock, flags);
} }
static int serial8250_console_setup(struct console *co, char *options) static int 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