From: Darren Hart <dvhart@linux.intel.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Tomoya MORINAGA <tomoya.rohm@gmail.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Feng Tang <feng.tang@intel.com>,
Alexander Stein <alexander.stein@systec-electronic.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alan Cox <alan@linux.intel.com>,
linux-serial@vger.kernel.org
Subject: Re: [RFC PATCH] pch_uart: Add eg20t_port lock field, avoid recursive spinlocks
Date: Tue, 19 Jun 2012 10:35:15 -0700 [thread overview]
Message-ID: <4FE0B853.5060203@linux.intel.com> (raw)
In-Reply-To: <20120619101447.74cbd9a1@pyramind.ukuu.org.uk>
On 06/19/2012 02:14 AM, Alan Cox wrote:
> On Mon, 18 Jun 2012 14:41:46 -0700
> Darren Hart <dvhart@linux.intel.com> wrote:
>
>>
>>
>> On 06/05/2012 04:48 PM, Tomoya MORINAGA wrote:
>>> On Wed, Jun 6, 2012 at 7:07 AM, Darren Hart <dvhart@linux.intel.com> wrote:
>>>> Are there still concerns about the additional lock? I'll resend V2
>>>> tomorrow with the single whitespace fix if I don't hear anything back today.
>>>
>>> I understand your saying. Looks good.
>>> However, I am not expert of linux-uart core system.
>>> So, I'd like UART maintainer to give us your opinion.
>>
>> Greg, Alan,
>>
>> any concerns with the locking approach I've adopted in the patch?
>
> Only the one I noted in my reply the first time around
Hi Alan,
I've hunted, but I can't seem to find this reply. :-/
> which is that you
> can't permit tty->low_latency=1 unless your tty receive path is not an
> IRQ path. From a locking point of view the change makes sense anyway.
I ran into this on the PREEMPT_RT kernel which always uses
tty->low_latency and converts the interrupt handler into a thread.
There is a follow-on patch for RT only to address a sleeping while
atomic bug in pch_console_write(), but I felt _this_ locking structure
change was appropriate for mainline.
>
> Going back over it your console locking also needs care - an oops or
> printk within the areas the private lock covers will hang the box. That
> should also probably be a trylock style lock as with the other lock on
> that path
I presume you are referring to pch_console_write()?
> static void
> pch_console_write(struct console *co, const char *s, unsigned int count)
> {
> struct eg20t_port *priv;
> unsigned long flags;
> u8 ier;
> int locked = 1;
>
> priv = pch_uart_ports[co->index];
>
> touch_nmi_watchdog();
>
> local_irq_save(flags);
> spin_lock(&priv->lock);
> if (priv->port.sysrq) {
> /* serial8250_handle_port() already took the lock */
> locked = 0;
> } else if (oops_in_progress) {
> locked = spin_trylock(&priv->port.lock);
> } else
> spin_lock(&priv->port.lock);
I see, the oops_in_progress test right? My thinking was that the
oops_in_progress was only relevant to the port.lock as that could be
taken outside of the pch_uart driver, while the priv.lock is only used
within the driver. But, as the oops uses the pch_console_write itself, I
can see the recursive spinlock failure case there.
As for the printk, it seems the 8250 driver would also suffer from that
in the serial8250_console_write function on the port.lock, and it does
not make any allowances for printk.
I would like to hold the priv.lock for a smaller window, but ordering
requires that I take it prior to the port.lock.
So I can test for oops_in_progress on the priv->lock too, but that won't
address the printk issue. Is the oops the bigger concern?
--
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
next prev parent reply other threads:[~2012-06-19 17:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-31 8:54 [RFC PATCH] pch_uart: Add eg20t_port lock field, avoid recursive spinlocks Darren Hart
2012-06-01 8:30 ` Tomoya MORINAGA
2012-06-01 8:30 ` Tomoya MORINAGA
2012-06-01 18:36 ` Darren Hart
2012-06-05 22:07 ` Darren Hart
2012-06-05 23:48 ` Tomoya MORINAGA
2012-06-18 21:41 ` Darren Hart
2012-06-18 22:21 ` Greg Kroah-Hartman
2012-06-19 9:14 ` Alan Cox
2012-06-19 17:35 ` Darren Hart [this message]
2012-06-19 17:54 ` Alan Cox
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=4FE0B853.5060203@linux.intel.com \
--to=dvhart@linux.intel.com \
--cc=alan@linux.intel.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=alexander.stein@systec-electronic.com \
--cc=feng.tang@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=tomoya.rohm@gmail.com \
/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.