From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: PATCH: Minimal fix for sysrq on serial console hang
Date: Wed, 12 Jul 2006 14:47:49 +0100 [thread overview]
Message-ID: <20060712134749.GA11047@flint.arm.linux.org.uk> (raw)
In-Reply-To: <1152712461.22943.58.camel@localhost.localdomain>
On Wed, Jul 12, 2006 at 02:54:21PM +0100, Alan Cox wrote:
> When I originally did this change I used oops_in_progress as a locking
> guide. However it turns out there is one other place that turns all the
> locking on its head and that is sysrq.
Well, akpm's had a fix in his tree for some time, which he's been
pestering me with, so I committed that a few days ago:
# Author: Andrew Morton (Fri Jun 30 10:29:59 BST 2006)
# Committer: Russell King (Sun Jul 9 21:11:10 BST 2006)
#
# [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
# Signed-off-by: Russell King
#
# 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 0995430..0ae9ced 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2240,10 +2252,14 @@ serial8250_console_write(struct console
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
@@ -2265,7 +2281,8 @@ serial8250_console_write(struct console
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)
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
next prev parent reply other threads:[~2006-07-12 13:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-12 13:54 PATCH: Minimal fix for sysrq on serial console hang Alan Cox
2006-07-12 13:47 ` Russell King [this message]
2006-07-12 14:11 ` Alan Cox
2006-07-12 14:01 ` Russell King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060712134749.GA11047@flint.arm.linux.org.uk \
--to=rmk+lkml@arm.linux.org.uk \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox