diff options
author | Andrew Morton <akpm@osdl.org> | 2006-07-06 23:59:50 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-07-24 20:35:28 -0700 |
commit | 44896b17f1c2d8824250e06bd07d7b5a4b7e6be4 (patch) | |
tree | eea808b600226a062aad4f59ba8bb416fd7ad1c1 | |
parent | 7eb990848664564593c96c5d1cf148ce23b34732 (diff) |
serial 8250: sysrq deadlock fix
Fix http://bugzilla.kernel.org/show_bug.cgi?id=6716
Doing a sysrq over a serial line into an SMP machine presently deadlocks.
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/serial/8250.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index bbf78aaf9e0..3863eba6798 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c @@ -2241,10 +2241,14 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) touch_nmi_watchdog(); - if (oops_in_progress) { - locked = spin_trylock_irqsave(&up->port.lock, flags); + local_irq_save(flags); + if (up->port.sysrq) { + /* serial8250_handle_port() already took the lock */ + locked = 0; + } else if (oops_in_progress) { + locked = spin_trylock(&up->port.lock); } else - spin_lock_irqsave(&up->port.lock, flags); + spin_lock(&up->port.lock); /* * First save the IER then disable the interrupts @@ -2266,7 +2270,8 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) serial_out(up, UART_IER, ier); if (locked) - spin_unlock_irqrestore(&up->port.lock, flags); + spin_unlock(&up->port.lock); + local_irq_restore(flags); } static int serial8250_console_setup(struct console *co, char *options) |