From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: PATCH (RFC): Rework the 8250 console fix
Date: Tue, 2 May 2006 16:06:53 +0100 [thread overview]
Message-ID: <20060502150653.GA1736@flint.arm.linux.org.uk> (raw)
In-Reply-To: <1146578983.3519.49.camel@localhost.localdomain>
On Tue, May 02, 2006 at 03:09:43PM +0100, Alan Cox wrote:
> Russell got various bits of mail showing the 8250 console fix broke some
> setups with the assumptions it made. Based on this suggestion that we
> actually need to just do the locking I've prepared an alternative
> patch.
I had merged your suggestion this morning, though I've just redone it
to fix a bug.
> There are two questions that I think make this an RFC not a final patch
>
> 1. Should this be pushed up into serial/serial_core.c for all chips.
No - uart_console_write doesn't know enough about the hardware to be
able to take the spinlock itself.
> 2. Is the use of local_irq_save/spin_trylock spin_unlock_irqrestore
> going to break any platforms that do weird stuff or do we need a
> spin_trylock_irqsave ?
We do have a spin_trylock_irqsave(), so we don't need to worry about this.
b41d859ea4471c8784c500b97cdf82c7529c19ee
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2235,10 +2235,17 @@ static void
serial8250_console_write(struct console *co, const char *s, unsigned int count)
{
struct uart_8250_port *up = &serial8250_ports[co->index];
+ unsigned long flags;
unsigned int ier;
+ int locked = 1;
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
*/
@@ -2257,6 +2265,9 @@ serial8250_console_write(struct console
*/
wait_for_xmitr(up, BOTH_EMPTY);
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)
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
prev parent reply other threads:[~2006-05-02 15:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-02 14:09 PATCH (RFC): Rework the 8250 console fix Alan Cox
2006-05-02 14:05 ` David Woodhouse
2006-05-02 15:13 ` Russell King
2006-05-02 15:06 ` Russell King [this message]
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=20060502150653.GA1736@flint.arm.linux.org.uk \
--to=rmk+lkml@arm.linux.org.uk \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.