diff options
author | Andrew Morton <akpm@osdl.org> | 2006-06-30 05:29:59 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-07-09 16:11:10 -0400 |
commit | 68aa2c0d4a36b43ea9c6d77134c94b4501fd2eb4 (patch) | |
tree | 92d401f58b6b4fdedb86ac973c74c2581b45de2c /drivers/serial/8250.c | |
parent | 3be91ec7388bae3cf1bfb4febcee5ab6c65f409f (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.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/serial/8250.c')
-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 5443fcd38355..0ae9ced00ed4 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -2252,10 +2252,14 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) | |||
2252 | 2252 | ||
2253 | touch_nmi_watchdog(); | 2253 | touch_nmi_watchdog(); |
2254 | 2254 | ||
2255 | if (oops_in_progress) { | 2255 | local_irq_save(flags); |
2256 | locked = spin_trylock_irqsave(&up->port.lock, flags); | 2256 | if (up->port.sysrq) { |
2257 | /* serial8250_handle_port() already took the lock */ | ||
2258 | locked = 0; | ||
2259 | } else if (oops_in_progress) { | ||
2260 | locked = spin_trylock(&up->port.lock); | ||
2257 | } else | 2261 | } else |
2258 | spin_lock_irqsave(&up->port.lock, flags); | 2262 | spin_lock(&up->port.lock); |
2259 | 2263 | ||
2260 | /* | 2264 | /* |
2261 | * First save the IER then disable the interrupts | 2265 | * First save the IER then disable the interrupts |
@@ -2277,7 +2281,8 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) | |||
2277 | serial_out(up, UART_IER, ier); | 2281 | serial_out(up, UART_IER, ier); |
2278 | 2282 | ||
2279 | if (locked) | 2283 | if (locked) |
2280 | spin_unlock_irqrestore(&up->port.lock, flags); | 2284 | spin_unlock(&up->port.lock); |
2285 | local_irq_restore(flags); | ||
2281 | } | 2286 | } |
2282 | 2287 | ||
2283 | static int serial8250_console_setup(struct console *co, char *options) | 2288 | static int serial8250_console_setup(struct console *co, char *options) |