Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759378AbaJ3Lde (ORCPT ); Thu, 30 Oct 2014 07:33:34 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:37298 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759093AbaJ3Ldd (ORCPT ); Thu, 30 Oct 2014 07:33:33 -0400 Message-ID: <5452204F.9090800@linaro.org> Date: Thu, 30 Oct 2014 11:26:07 +0000 From: Daniel Thompson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Stephen Boyd , Greg Kroah-Hartman CC: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org, Frank Rowand Subject: Re: [PATCH 1/2] tty: serial: msm: Fix sysrq spinlock recursion on non-DM References: <1414606478-13709-1-git-send-email-sboyd@codeaurora.org> <1414606478-13709-2-git-send-email-sboyd@codeaurora.org> In-Reply-To: <1414606478-13709-2-git-send-email-sboyd@codeaurora.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/10/14 18:14, Stephen Boyd wrote: > The handle_rx() path calls uart_handle_sysrq_char() with the port > lock held. This causes a spinlock recursion. Release and > reacquire the lock here to avoid this. > > BUG: spinlock recursion on CPU#0, swapper/0 > lock: msm_uart_ports+0x1e0/0x2d0, .magic: dead4ead, .owner: swapper/0, .owner_cpu: 0 > CPU: 0 PID: 0 Comm: swapper Not tainted 3.17.0-rc7-00012-gb38ee8265941 #69 > [] (unwind_backtrace) from [] (show_stack+0x10/0x14) > [] (show_stack) from [] (do_raw_spin_lock+0x11c/0x13c) > [] (do_raw_spin_lock) from [] (msm_console_write+0x78/0x188) > [] (msm_console_write) from [] (call_console_drivers.constprop.22+0xb4/0x144) > [] (call_console_drivers.constprop.22) from [] (console_unlock+0x27c/0x4ac) > [] (console_unlock) from [] (vprintk_emit+0x1f4/0x5a8) > [] (vprintk_emit) from [] (printk+0x30/0x40) > [] (printk) from [] (__handle_sysrq+0x58/0x1b8) > [] (__handle_sysrq) from [] (msm_irq+0x694/0x6f8) > [] (msm_irq) from [] (handle_irq_event_percpu+0x58/0x270) > [] (handle_irq_event_percpu) from [] (handle_irq_event+0x3c/0x5c) > [] (handle_irq_event) from [] (handle_level_irq+0x9c/0x138) > [] (handle_level_irq) from [] (generic_handle_irq+0x24/0x38) > [] (generic_handle_irq) from [] (handle_IRQ+0x44/0xb0) > [] (handle_IRQ) from [] (msm_vic_handle_irq+0x44/0x64) > [] (msm_vic_handle_irq) from [] (__irq_svc+0x44/0x7c) > Exception stack(0xc0719f68 to 0xc0719fb0) > 9f60: 00000001 00000001 00000000 c0722938 c0718000 c0769acc > 9f80: 00000000 c0720098 c0769305 4117b362 c0769acc 00000000 01000000 c0719fb0 > 9fa0: c004cab0 c000f880 20000013 ffffffff > [] (__irq_svc) from [] (arch_cpu_idle+0x20/0x30) > [] (arch_cpu_idle) from [] (cpu_startup_entry+0xf4/0x23c) > [] (cpu_startup_entry) from [] (start_kernel+0x32c/0x394) > > Cc: Frank Rowand > Cc: Daniel Thompson > Signed-off-by: Stephen Boyd > --- > drivers/tty/serial/msm_serial.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c > index 4b6c78331a64..cedcc36762a2 100644 > --- a/drivers/tty/serial/msm_serial.c > +++ b/drivers/tty/serial/msm_serial.c > @@ -174,6 +174,7 @@ static void handle_rx(struct uart_port *port) > while ((sr = msm_read(port, UART_SR)) & UART_SR_RX_READY) { > unsigned int c; > char flag = TTY_NORMAL; > + int sysrq; > > c = msm_read(port, UART_RF); > > @@ -195,7 +196,10 @@ static void handle_rx(struct uart_port *port) > else if (sr & UART_SR_PAR_FRAME_ERR) > flag = TTY_FRAME; > > - if (!uart_handle_sysrq_char(port, c)) > + spin_unlock(&port->lock); > + sysrq = uart_handle_sysrq_char(port, c); > + spin_lock(&port->lock); > + if (!sysrq) > tty_insert_flip_char(tport, c, flag); Does tty_insert_flip_char() need the port to be locked? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/