From patchwork Tue Oct 30 22:11:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10661681 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3DA0713A4 for ; Tue, 30 Oct 2018 22:11:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DE792AA6A for ; Tue, 30 Oct 2018 22:11:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 21F532AA7D; Tue, 30 Oct 2018 22:11:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C445C2AA6A for ; Tue, 30 Oct 2018 22:11:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4fEITU6oyciI6Xv1Lx3wW/azWrk+2DqMfurLeRg7G/w=; b=BX3CHab3p59DmC JXvxdzrbeVwRPNeQgHTVU3QtH9XTt1oNKHbMQd5KV1Wm6hEBinzHPncPPBg5mc+VFw1d0kYd3foKh QXGfoG7eP3SVJ3s/of3eIqw98UiKCDvLZakCxLPoLUqbBlhbO+7lUC/SD+jgVw43Y1ZriuuCx2z45 i8MgSRVBHNH94QdFHDQ0K2uhpjcgb81RA9pRWU4KDO+becThaVA+DkjISSEn+Tzla4GC9kzDmCTyA Tf3r0NpDDlkLYwTsVmhuG+g7HEaUUZ0/4NeMIIE2m4UJQLceU4C1FLsK/66pY8pHJOQ7K0H3rXfC/ 4if/EmEkyDqALMqMstQg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHcEs-00079g-WC; Tue, 30 Oct 2018 22:11:55 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHcEq-00078D-GM for linux-arm-kernel@lists.infradead.org; Tue, 30 Oct 2018 22:11:53 +0000 Received: by mail-pl1-x643.google.com with SMTP id b5-v6so5615728pla.6 for ; Tue, 30 Oct 2018 15:11:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=456uG5PlWBnfGUDyET8jKISVXeQZt6ggTh3gygckLP0=; b=BOyMZrSf0rDdTl6nQ87KKVm4mipKJOEpXnTSeLRqAacNT8A+mGPuzJT5RlQ5KEma86 vCK7u5ZxaOWf+wT+U99ktUD7wkcogFKmkbQizZ5GSvhJOG8ld1pAAT0a1u6T1wPrdvpu TK9gy3tPlJKCKO6mY0nvyBrhY4xHwsECJABTw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=456uG5PlWBnfGUDyET8jKISVXeQZt6ggTh3gygckLP0=; b=OmyyDSJoNEjFSugAXwapw4UaIMIfuzkgT7f8p0sF4ZFhKdDLWRNplJiLhuSe6R6buo JosidjhFDda6hktM7IaSJ4HWpc3sQWwBuAy/v9ThiEFmbOxvkhgjb4mmVj86WR+2TeBK 1//pekzUe5CxiZJFy6uPS31XzheIb7CgJPQ5UNrP/veoFYzI3ldxViDyTIYjTHhFXvwq PcVS28vttgl4CQJjx1jOmB7GmSmn3iXKQ7ZZpJw9GKLhRnH8cNnql8xk9Hkwr0ByxRIK lcUG03CoQYSQ2XsOVAWMpZeOBjAi/ULOqwXfbQ9tpHZDE9ibaq234Cxzb54Hmg5zzHId DXVQ== X-Gm-Message-State: AGRZ1gJpN13yp17ciJYwV2R4wD14oQDq+t44VE+yRezYOnBGK9+D4uYw gEM2ntldIRXiAZWzlAq3OJrlng== X-Google-Smtp-Source: AJdET5dNw5dl4KoW1C3gIRAymO5X3IH4UK1BUJscMzsym9F+sRJkSiHYwKcLxq0iCeAQ8NRIcQ6Sqw== X-Received: by 2002:a17:902:47:: with SMTP id 65-v6mr545840pla.112.1540937502633; Tue, 30 Oct 2018 15:11:42 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:c8e0:70d7:4be7:a36]) by smtp.gmail.com with ESMTPSA id b11-v6sm12844491pgi.10.2018.10.30.15.11.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Oct 2018 15:11:41 -0700 (PDT) From: Douglas Anderson To: Greg Kroah-Hartman , Jiri Slaby Subject: [PATCH v2 1/5] serial: qcom_geni_serial: Finish supporting sysrq Date: Tue, 30 Oct 2018 15:11:03 -0700 Message-Id: <20181030221107.79758-2-dianders@chromium.org> X-Mailer: git-send-email 2.19.1.568.g152ad8e336-goog In-Reply-To: <20181030221107.79758-1-dianders@chromium.org> References: <20181030221107.79758-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181030_151152_561577_5FF8113B X-CRM114-Status: GOOD ( 12.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dan.carpenter@oracle.com, vigneshr@ti.com, linux-aspeed@lists.ozlabs.org, andrew@aj.id.au, linux-arm-msm@vger.kernel.org, Douglas Anderson , tony@atomide.com, joel@jms.id.au, linux-serial@vger.kernel.org, andriy.shevchenko@linux.intel.com, linux-arm-kernel@lists.infradead.org, jk@ozlabs.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The geni serial driver already had some sysrq code in it, but since SUPPORT_SYSRQ wasn't defined the code didn't do anything useful. Let's make it useful by adding that define using the same formula found in other serial drivers. In order to prevent deadlock, we'll take a page from the 'msm_serial.c' where the spinlock is released around uart_handle_sysrq_char(). This seemed better than copying from '8250_port.c' where we skip locking in the console_write function since the '8250_port.c' method can cause lockdep warnings when dropping into kgdb. Signed-off-by: Douglas Anderson --- drivers/tty/serial/qcom_geni_serial.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 1515074e18fb..b83e3554bced 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1,6 +1,10 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2017-2018, The Linux foundation. All rights reserved. +#if defined(CONFIG_SERIAL_QCOM_GENI_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) +# define SUPPORT_SYSRQ +#endif + #include #include #include @@ -495,7 +499,10 @@ static int handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) continue; } + spin_unlock(&uport->lock); sysrq = uart_handle_sysrq_char(uport, buf[c]); + spin_lock(&uport->lock); + if (!sysrq) tty_insert_flip_char(tport, buf[c], TTY_NORMAL); } From patchwork Tue Oct 30 22:11:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10661685 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8263A1751 for ; Tue, 30 Oct 2018 22:12:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 720762A89E for ; Tue, 30 Oct 2018 22:12:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 636C12AA78; Tue, 30 Oct 2018 22:12:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D46892A89E for ; Tue, 30 Oct 2018 22:12:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5cDSDAlBBLscf8DpOT9wNZuopRoS/fhyUsbrWt6Blqo=; b=ArZq8iEpc8KfCV gAoEoi1MEnjLHtY1qC19mkWyRYIOdRbR15nq0jBVyhiSzSX1crFfYV5MnJFgmdnlqT7DbgtxXboB8 RzjGWp075SEQj0lyTUwpQn1mnT3lI//v+sVmzgvYTDrrTEE96SqpYaiRyFO1Dr7sJOk4BLSqtnXhb NKYhbB2Fs+Ii8MlP4YO44JO5DLCxfabvYyvHbPFiCokXkNCNpei8vSs4Eu4kEaUAQM5Hg2hPWlMhq aXhBcdY+cdL/GtKUa51aP2tATVKSiZ/XDjAnKPUE37TBqaDk5ux5tHgPlmTE0V13qXWa/Az3StmdX ayzdX3uIQ45GQ7hWQ6zQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHcFN-0007h0-KF; Tue, 30 Oct 2018 22:12:25 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHcEs-00078H-Rm for linux-arm-kernel@lists.infradead.org; Tue, 30 Oct 2018 22:11:58 +0000 Received: by mail-pl1-x641.google.com with SMTP id bb7-v6so6221608plb.13 for ; Tue, 30 Oct 2018 15:11:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bspTmsO922c2ahVBjIPUGFrdX2Jss9sHKADxEgLE8Zg=; b=fXrkSqJb02IXYc9OaPtpE8lukq5eiftMgaB1hlPx0vqODF6bT9VcXBRt4g9hiDHRMU JKR240rzzYMjLgN14UurlmJEjHE3KhP1u+z4ogtnhyLALwSmcw6cJbRzW8/SVwdQpZS3 Osnt6c+YhFoHSKHMgD7J0HVl/zna8h2Us3tL4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bspTmsO922c2ahVBjIPUGFrdX2Jss9sHKADxEgLE8Zg=; b=MmE/lQZ/jNVGv3TmMVFKRJSQLGK3MzR0nLCj7NYJEO0zJwo+MUPRVKt1vguzeKYkFX LBuu3h4KB6LrVZLa0EaYUDWMCijjY9L0Ur0nyp9TsmrEYVP1BUyHJHR8OU26RIIbgkoh WWAwhyBlGRyZ8KnhoZnY3ve0rr2aTPXWfQ0aRNyYSisShcRdApjXL+siT5/GtI73yTxw ScA0fcxGs6DOX4z/sH18P23ESzFyzC7m7lrsIZmrGnmrE4HTA5OHiCkQkk+w3piMM7I3 FlFT4+mOccZ+LbMtnpu7zXX6ZUzoTPZO0D4by8fPmRr6RjRfuM1CTPxWtuuJhVkl7ScJ UJ9w== X-Gm-Message-State: AGRZ1gLga9XAe5zxWYt+WzyLqrGu3KeoLiHXheiJQpfOm9uNfUDAUUmn TwuM+00bLnc/tQq+VW5vdRZa+A== X-Google-Smtp-Source: AJdET5e0EgLWFkrFaDzyWDjr7tELzbl7ptVfBIkX9G8E0uwGHrGEl3sb848cXEq/Khpz1LFEs46ASw== X-Received: by 2002:a17:902:7c94:: with SMTP id y20-v6mr525436pll.218.1540937504215; Tue, 30 Oct 2018 15:11:44 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:c8e0:70d7:4be7:a36]) by smtp.gmail.com with ESMTPSA id b11-v6sm12844491pgi.10.2018.10.30.15.11.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Oct 2018 15:11:43 -0700 (PDT) From: Douglas Anderson To: Greg Kroah-Hartman , Jiri Slaby Subject: [PATCH v2 2/5] serial: core: Allow processing sysrq at port unlock time Date: Tue, 30 Oct 2018 15:11:04 -0700 Message-Id: <20181030221107.79758-3-dianders@chromium.org> X-Mailer: git-send-email 2.19.1.568.g152ad8e336-goog In-Reply-To: <20181030221107.79758-1-dianders@chromium.org> References: <20181030221107.79758-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181030_151154_988169_601B4AB9 X-CRM114-Status: GOOD ( 21.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dan.carpenter@oracle.com, vigneshr@ti.com, linux-aspeed@lists.ozlabs.org, andrew@aj.id.au, linux-arm-msm@vger.kernel.org, Douglas Anderson , tony@atomide.com, joel@jms.id.au, linux-serial@vger.kernel.org, andriy.shevchenko@linux.intel.com, linux-arm-kernel@lists.infradead.org, jk@ozlabs.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Right now serial drivers process sysrq keys deep in their character receiving code. This means that they've already grabbed their port->lock spinlock. This can end up getting in the way if we've go to do serial stuff (especially kgdb) in response to the sysrq. Serial drivers have various hacks in them to handle this. Looking at '8250_port.c' you can see that the console_write() skips locking if we're in the sysrq handler. Looking at 'msm_serial.c' you can see that the port lock is dropped around uart_handle_sysrq_char(). It turns out that these hacks aren't exactly perfect. If you have lockdep turned on and use something like the 8250_port hack you'll get a splat that looks like: WARNING: possible circular locking dependency detected [...] is trying to acquire lock: ... (console_owner){-.-.}, at: console_unlock+0x2e0/0x5e4 but task is already holding lock: ... (&port_lock_key){-.-.}, at: serial8250_handle_irq+0x30/0xe4 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&port_lock_key){-.-.}: _raw_spin_lock_irqsave+0x58/0x70 serial8250_console_write+0xa8/0x250 univ8250_console_write+0x40/0x4c console_unlock+0x528/0x5e4 register_console+0x2c4/0x3b0 uart_add_one_port+0x350/0x478 serial8250_register_8250_port+0x350/0x3a8 dw8250_probe+0x67c/0x754 platform_drv_probe+0x58/0xa4 really_probe+0x150/0x294 driver_probe_device+0xac/0xe8 __driver_attach+0x98/0xd0 bus_for_each_dev+0x84/0xc8 driver_attach+0x2c/0x34 bus_add_driver+0xf0/0x1ec driver_register+0xb4/0x100 __platform_driver_register+0x60/0x6c dw8250_platform_driver_init+0x20/0x28 ... -> #0 (console_owner){-.-.}: lock_acquire+0x1e8/0x214 console_unlock+0x35c/0x5e4 vprintk_emit+0x230/0x274 vprintk_default+0x7c/0x84 vprintk_func+0x190/0x1bc printk+0x80/0xa0 __handle_sysrq+0x104/0x21c handle_sysrq+0x30/0x3c serial8250_read_char+0x15c/0x18c serial8250_rx_chars+0x34/0x74 serial8250_handle_irq+0x9c/0xe4 dw8250_handle_irq+0x98/0xcc serial8250_interrupt+0x50/0xe8 ... other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&port_lock_key); lock(console_owner); lock(&port_lock_key); lock(console_owner); *** DEADLOCK *** The hack used in 'msm_serial.c' doesn't cause the above splats but it seems a bit ugly to unlock / lock our spinlock deep in our irq handler. It seems like we could defer processing the sysrq until the end of the interrupt handler right after we've unlocked the port. With this scheme if a whole batch of sysrq characters comes in one irq then we won't handle them all, but that seems like it should be a fine compromise. Signed-off-by: Douglas Anderson --- include/linux/serial_core.h | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 406edae44ca3..3460b15a2607 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -173,6 +173,7 @@ struct uart_port { struct console *cons; /* struct console, if any */ #if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(SUPPORT_SYSRQ) unsigned long sysrq; /* sysrq timeout */ + unsigned int sysrq_ch; /* char for sysrq */ #endif /* flags must be updated while holding port mutex */ @@ -482,8 +483,42 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) } return 0; } +static inline int +uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch) +{ + if (port->sysrq) { + if (ch && time_before(jiffies, port->sysrq)) { + port->sysrq_ch = ch; + port->sysrq = 0; + return 1; + } + port->sysrq = 0; + } + return 0; +} +static inline void +uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags) +{ + int sysrq_ch; + + sysrq_ch = port->sysrq_ch; + port->sysrq_ch = 0; + + spin_unlock_irqrestore(&port->lock, irqflags); + + if (sysrq_ch) + handle_sysrq(sysrq_ch); +} #else -#define uart_handle_sysrq_char(port,ch) ({ (void)port; 0; }) +static inline int +uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) { return 0; } +static inline int +uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch) { return 0; } +static inline void +uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags) +{ + spin_unlock_irqrestore(&port->lock, irqflags); +} #endif /* From patchwork Tue Oct 30 22:11:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10661687 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C857813A4 for ; Tue, 30 Oct 2018 22:12:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B85452A89E for ; Tue, 30 Oct 2018 22:12:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ABFB42AA78; Tue, 30 Oct 2018 22:12:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 536DE2A89E for ; Tue, 30 Oct 2018 22:12:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=For6jqTSE7fMQOAPvy/kwgGFW4RXMo+HfDGVM1fJ5Q4=; b=PQsV+vs/GVfWF1 f/euSViHFq/NT3MdsJtDjwFqb0mhmp2+rMN7w4nO2pBTsAkS9z3HjW+XSNSQvt1+gI0P9844+iW+G cGkY8I0Icy7aGHA3Kw3rxg5loydfdsFWwsSY339LVJMUOxWRICVyx/cIZ90Wl3j2yn2vgD6L5j0Ic ko9dhu9fwIoQgW6NGxx2qfUiEJex07xyE3vMGB53O6m+pgXxrgHRNM+H2Ju3ZmHjRJAxQpZInLkpn BvkHq0pjCtZveHFZr6a6s/FkOMvn/Dn9CAOItzq5ArzyTJ3WEYyZpdhFHsysyGrwYP7ZAcwHm4BWZ F2TNSrqXLiIDUnHW+RyQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHcFW-0007rD-VN; Tue, 30 Oct 2018 22:12:34 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHcEu-00078e-Fd for linux-arm-kernel@lists.infradead.org; Tue, 30 Oct 2018 22:11:59 +0000 Received: by mail-pg1-x543.google.com with SMTP id c10-v6so6348518pgq.4 for ; Tue, 30 Oct 2018 15:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=94psJMyqz8IkfzVie06Fc1uYcJtaXinZcw3VnGuFFDk=; b=lsehY/L8EcTjAHcVmYw2kWgDuy0jhwcjzWfAnRWkA1CmkV/5uEz9tqmfB0zrJWi1DW vh3FZSEO5NcuNadT0CJX0Cm75uPCxo6Sr5VuKxcjrbY3v7GXEPEGlhAWiaT4ClOoneQp AFfyw0ZLvuSPYC/YzXRURJ377ViUey6Q3tyds= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=94psJMyqz8IkfzVie06Fc1uYcJtaXinZcw3VnGuFFDk=; b=Gaulrt5KHB+OXSfe0Io4IE8sxciIg+WxjS5Z94O+05lBqoDLOiZV5c4FgwsZoxi9ye WHn5XdYBMK3KfGiUiVotxznqGPahKHPIxbSjFyxG9axoBTyFnP0wXNnG2L6wZwOIXOc4 FeQxIbF6HAaTP7jOX76nQ081doU8+T0nRt2uN2kwQNVxNrEIFJ1QxKVn5gLM301U4tnJ C46lP7TskFsNrZp9KRN9B9C5YM4AOUN3cCVUEceYxS9j77z2ZmJ0DwhAJXsee1xM4dJw ajeNX0niAb1dwxTcoAqIIhWqyI602tHIDSFpr9noxLqD4vbRxd687WqLA5monHR1d1WQ dUhQ== X-Gm-Message-State: AGRZ1gLaA3GM84PTdi4DK2uEKqNMPZE/2mWfOO0wMUJcTrpetUBpk2Dg kkX+dhu9rbGI4WE5XDYMM3kIyQ== X-Google-Smtp-Source: AJdET5cgkvKnnP49uNC3FnivblVrxS6bINQFRUrAXaVXsY2Awh35LGm4zeqSp5GDOSBvVhqwYWyOzA== X-Received: by 2002:a63:a612:: with SMTP id t18-v6mr503544pge.338.1540937505696; Tue, 30 Oct 2018 15:11:45 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:c8e0:70d7:4be7:a36]) by smtp.gmail.com with ESMTPSA id b11-v6sm12844491pgi.10.2018.10.30.15.11.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Oct 2018 15:11:44 -0700 (PDT) From: Douglas Anderson To: Greg Kroah-Hartman , Jiri Slaby Subject: [PATCH v2 3/5] serial: qcom_geni_serial: Process sysrq at port unlock time Date: Tue, 30 Oct 2018 15:11:05 -0700 Message-Id: <20181030221107.79758-4-dianders@chromium.org> X-Mailer: git-send-email 2.19.1.568.g152ad8e336-goog In-Reply-To: <20181030221107.79758-1-dianders@chromium.org> References: <20181030221107.79758-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181030_151156_735829_B53A2602 X-CRM114-Status: GOOD ( 11.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dan.carpenter@oracle.com, vigneshr@ti.com, linux-aspeed@lists.ozlabs.org, andrew@aj.id.au, linux-arm-msm@vger.kernel.org, Douglas Anderson , tony@atomide.com, joel@jms.id.au, linux-serial@vger.kernel.org, andriy.shevchenko@linux.intel.com, linux-arm-kernel@lists.infradead.org, jk@ozlabs.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Let's take advantage of the new ("serial: core: Allow processing sysrq at port unlock time") to handle sysrqs more cleanly. Signed-off-by: Douglas Anderson --- drivers/tty/serial/qcom_geni_serial.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index b83e3554bced..29ddc1fc65f8 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -499,9 +499,7 @@ static int handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) continue; } - spin_unlock(&uport->lock); - sysrq = uart_handle_sysrq_char(uport, buf[c]); - spin_lock(&uport->lock); + sysrq = uart_prepare_sysrq_char(uport, buf[c]); if (!sysrq) tty_insert_flip_char(tport, buf[c], TTY_NORMAL); @@ -811,7 +809,8 @@ static irqreturn_t qcom_geni_serial_isr(int isr, void *dev) qcom_geni_serial_handle_rx(uport, drop_rx); out_unlock: - spin_unlock_irqrestore(&uport->lock, flags); + uart_unlock_and_check_sysrq(uport, flags); + return IRQ_HANDLED; } From patchwork Tue Oct 30 22:11:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10661737 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BC96A14DE for ; Tue, 30 Oct 2018 22:28:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB7162A9C0 for ; Tue, 30 Oct 2018 22:28:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D9DA2AA8D; Tue, 30 Oct 2018 22:28:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0F8772A9C0 for ; Tue, 30 Oct 2018 22:28:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9Yl3wxLMMFhZFqyYALCoxdlEw8U03YhZ/dM+TRCUuWA=; b=Bn0fY8hkJ9EdFv /yxKX8shMlX1ChN92AS8Fsq4ngvSSW/sHozA84EpLFpPhX69uMjO5DEOhI2+u5lortT3Xdl8xVWM7 Q8Gv6NeVGk2ltvaeOtHh+hkHgvvjHnOLtFs1n1ZCN4MZ2Ub/PFaj/26SH967RPqyX7t+tolwxhY9+ dRzNohCNNrOZRPiYHtq9KzTOotpwKHJ74QeuRYfE7fBf5bfrxFgWJpD24BaUlpiwuK1X/i9B/3CYT riALnqP+agU8ZlaeQqyQjPnXuEW01zGSEJeVT5HXHrYdt5/XWiQBXWJlAnTEmnGT+6Maug09akxbX hs/A4nut5nMuSIwzhX9Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHcUR-0006vN-BN; Tue, 30 Oct 2018 22:27:59 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHcEw-00078g-3Q for linux-arm-kernel@lists.infradead.org; Tue, 30 Oct 2018 22:12:02 +0000 Received: by mail-pf1-x441.google.com with SMTP id e22-v6so3523989pfn.8 for ; Tue, 30 Oct 2018 15:11:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=G4It3xDRhjbwJBDZhyOLMXPJlT41mX/wrMU8U1COu/w=; b=J7kpoqW4nCOMflV/GPpFHw3wbowwLlSw5cHb8BwCL0tjDKLS2pX+uBdYNdhSv5qJeR YIFqcoisweNYAEye7pDR4UbDTnN4qdVcG62oRk25fXvCZc6XVhIDzWTdT2NTPgeOBPqs 46XOtbWk86TJzDnegELyy5ty0b8CDo42RpUt8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G4It3xDRhjbwJBDZhyOLMXPJlT41mX/wrMU8U1COu/w=; b=cJipnbqnWtpeEGAtbiHKMDBcMlYJxWAc47FiYnQ24TLE6VEZtgLDS5i5tjuiiy/2WU TkXqsa4F2cPDyG8qV8ekWHI/ZVcQprrXTzLF96fhl8aJXOWxryksuebycKjxZbM19KQN qmIoGHHS2VwHyK0c3FRD4+6QOfMSXIFRa/zRCj08Z/4ITrZSFidLJUWuySEm0IpzZjpR zGlxOjZjaGkt9yQGd2ZE+B9RIwLRBlEuhZ55QfmOuqmZfF7ezbMqVAMxidk5OCwOhrVn TR0nNlHFz17bf50grYhFPIuTzCAAt/AdmRbeW+p/1qe/tn7zwIuf3edJlOdcbJUzS+Xo CDCA== X-Gm-Message-State: AGRZ1gLtl2mySgZqwCRRaZj6NijHlKbYgAIucXxpu2SrnXyZ5skjhXkI X3/sxR5aGImiFB9lP1hAKAYrGw== X-Google-Smtp-Source: AJdET5dD/X8oQn38qFkhnjnryX1IEDPvPKRA/R7wBL1aiw2Hj0b6uuIZql51K1rGVa5QRIGGqc0Iiw== X-Received: by 2002:a65:40c5:: with SMTP id u5mr516665pgp.46.1540937507248; Tue, 30 Oct 2018 15:11:47 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:c8e0:70d7:4be7:a36]) by smtp.gmail.com with ESMTPSA id b11-v6sm12844491pgi.10.2018.10.30.15.11.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Oct 2018 15:11:46 -0700 (PDT) From: Douglas Anderson To: Greg Kroah-Hartman , Jiri Slaby Subject: [PATCH v2 4/5] serial: core: Include console.h from serial_core.h Date: Tue, 30 Oct 2018 15:11:06 -0700 Message-Id: <20181030221107.79758-5-dianders@chromium.org> X-Mailer: git-send-email 2.19.1.568.g152ad8e336-goog In-Reply-To: <20181030221107.79758-1-dianders@chromium.org> References: <20181030221107.79758-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181030_151158_577349_B8F19196 X-CRM114-Status: GOOD ( 12.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dan.carpenter@oracle.com, vigneshr@ti.com, linux-aspeed@lists.ozlabs.org, andrew@aj.id.au, linux-arm-msm@vger.kernel.org, Douglas Anderson , tony@atomide.com, joel@jms.id.au, linux-serial@vger.kernel.org, andriy.shevchenko@linux.intel.com, linux-arm-kernel@lists.infradead.org, jk@ozlabs.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP In the static inline function uart_handle_break() in serial_core.h we dereference port->cons. That gives an error unless console.h is also included. This error hasn't shown up till now because everyone who has defined SUPPORT_SYSRQ has also included console.h, but it's a bit ugly to make this requirement. Let's make the include explicit. Signed-off-by: Douglas Anderson --- include/linux/serial_core.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 3460b15a2607..ff9d0ee32f11 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -22,6 +22,7 @@ #include #include +#include #include #include #include From patchwork Tue Oct 30 22:11:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10661689 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AF1861751 for ; Tue, 30 Oct 2018 22:12:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B35A2A89E for ; Tue, 30 Oct 2018 22:12:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D5C02AA78; Tue, 30 Oct 2018 22:12:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 273C62A89E for ; Tue, 30 Oct 2018 22:12:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yHz8vC0txKcw1DPcqcTHIPrHdfvsQRNOMPGwHjqnMps=; b=sOJLHkiq+teSW/ hM0GD7Vls/TM9F9sPVq9uplapkvKJ2QsjG9R3x5FdgkvKmfuQ7RISBUr07f1/kOAH7Ig7+qLp5kcW s5dxsIjj2qAkUd/+OItrunlasBLbw8CZNzTVmFW+Qd+ggVRZIE4zojCo9tokghvyG7Pfrk2RjnIkW WVbEgPDmWWXpNlE+74Vpm03UPJUFhWsWq1bVHy7a5XWZwX+9tDKg39GGgjuSuhYavRo+eIMl/oT4m +Z9A02QeY8f6eUUWAttK94EfYt12Z7dXRQaKqgSUm846FhUgTVebLHDeBJxqK4j+4jRhWvuQ6pvau 0nSrpXfBrT2ghXIiBNLQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHcFs-0008Ky-E2; Tue, 30 Oct 2018 22:12:56 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHcEw-00078r-3V for linux-arm-kernel@lists.infradead.org; Tue, 30 Oct 2018 22:12:06 +0000 Received: by mail-pf1-x441.google.com with SMTP id f78-v6so6564476pfe.1 for ; Tue, 30 Oct 2018 15:11:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D/srr377gx/CBcW4oZq1iML+JVouTiEFf8QM91L4b9s=; b=ZfjylPUkbrAU9ZCiHNybarzU65qDjhAFwDP3RzRjBghrI4CeZ7SIV3uBhEYAL7P89f fW5KvIe1ai7z7nfOafdMIkFgIJv4i6H4IZAxDNAmNt5YR6wLuNXvh4ekSkOt2PjjEYJw lFovj5f90vpadHtLoXpjsGzKDwZAOQjL4u3/E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D/srr377gx/CBcW4oZq1iML+JVouTiEFf8QM91L4b9s=; b=csYtnoIRx/XZO22w/L1N+QF6GCV9n6oYfP5dHGcmp8N2mVfGimQxfXRg5tbEWinx7x JJuNoK/vwKpex+4bhcpodKF17xPJ4GtO4H4kxWqfGrgQYzYVOwEId28GpCi6VYjbp1uw CFSqoSiVHbswxhtK7iCuSEeW+09xbPYHaYNvCGiR7m0F1WHpnv1Ds/UAdLLjT30K9cIB LMPUqIolJjtsCsoGVFQFFQ5W2+/WtFSeq8jzGpC11BD3lzONn5LJfa0pA6Uhn+PoyLJz Jy4N12tCbyFd8X4SonILixdQch9Nla4QVOU4HiEdxRuCVIxr4+SBZBceTXN9rkR2su1X goxg== X-Gm-Message-State: AGRZ1gKZKlBWQdiDWla07uZDmckSUJdYUnh7JeQW9GrhtSlsIJfOgy+2 IluXGRdP7NJU6cvT9fMLEGWAiw== X-Google-Smtp-Source: AJdET5e8YEAm+0QPBnqsugqh9po5N6wj7KwtW7ZMCVO+9U9bzZpimy/iwrK+kU8blQuptyANu3r/+g== X-Received: by 2002:a63:9a09:: with SMTP id o9mr504845pge.94.1540937508885; Tue, 30 Oct 2018 15:11:48 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:c8e0:70d7:4be7:a36]) by smtp.gmail.com with ESMTPSA id b11-v6sm12844491pgi.10.2018.10.30.15.11.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Oct 2018 15:11:48 -0700 (PDT) From: Douglas Anderson To: Greg Kroah-Hartman , Jiri Slaby Subject: [PATCH v2 5/5] serial: 8250: Process sysrq at port unlock time Date: Tue, 30 Oct 2018 15:11:07 -0700 Message-Id: <20181030221107.79758-6-dianders@chromium.org> X-Mailer: git-send-email 2.19.1.568.g152ad8e336-goog In-Reply-To: <20181030221107.79758-1-dianders@chromium.org> References: <20181030221107.79758-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181030_151158_628348_D59F1943 X-CRM114-Status: GOOD ( 13.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dan.carpenter@oracle.com, vigneshr@ti.com, linux-aspeed@lists.ozlabs.org, andrew@aj.id.au, linux-arm-msm@vger.kernel.org, Douglas Anderson , tony@atomide.com, joel@jms.id.au, linux-serial@vger.kernel.org, andriy.shevchenko@linux.intel.com, linux-arm-kernel@lists.infradead.org, jk@ozlabs.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Let's take advantage of the new ("serial: core: Allow processing sysrq at port unlock time") to handle sysrqs more cleanly. Signed-off-by: Douglas Anderson --- I don't have a great way to test all 8250 variants, but I've at least tested rk3288 / rk3399 and they seem to work. Hopefully I got the aspeed_vuart / fsl / omap variants right (I only compile tested those). drivers/tty/serial/8250/8250_aspeed_vuart.c | 6 +++++- drivers/tty/serial/8250/8250_fsl.c | 6 +++++- drivers/tty/serial/8250/8250_omap.c | 6 +++++- drivers/tty/serial/8250/8250_port.c | 8 +++----- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c index 435bec40dee6..0438d9a905ce 100644 --- a/drivers/tty/serial/8250/8250_aspeed_vuart.c +++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c @@ -5,6 +5,10 @@ * Copyright (C) 2016 Jeremy Kerr , IBM Corp. * Copyright (C) 2006 Arnd Bergmann , IBM Corp. */ +#if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) +#define SUPPORT_SYSRQ +#endif + #include #include #include @@ -293,7 +297,7 @@ static int aspeed_vuart_handle_irq(struct uart_port *port) if (lsr & UART_LSR_THRE) serial8250_tx_chars(up); - spin_unlock_irqrestore(&port->lock, flags); + uart_unlock_and_check_sysrq(port, flags); return 1; } diff --git a/drivers/tty/serial/8250/8250_fsl.c b/drivers/tty/serial/8250/8250_fsl.c index 6640a4c7ddd1..ff3dcaea5d93 100644 --- a/drivers/tty/serial/8250/8250_fsl.c +++ b/drivers/tty/serial/8250/8250_fsl.c @@ -1,4 +1,8 @@ // SPDX-License-Identifier: GPL-2.0 +#if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) +#define SUPPORT_SYSRQ +#endif + #include #include @@ -54,7 +58,7 @@ int fsl8250_handle_irq(struct uart_port *port) serial8250_tx_chars(up); up->lsr_saved_flags = orig_lsr; - spin_unlock_irqrestore(&up->port.lock, flags); + uart_unlock_and_check_sysrq(&up->port, flags); return 1; } EXPORT_SYMBOL_GPL(fsl8250_handle_irq); diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c index a019286f8bb6..ad7ba7d0f28d 100644 --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c @@ -8,6 +8,10 @@ * */ +#if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) +#define SUPPORT_SYSRQ +#endif + #include #include #include @@ -1085,7 +1089,7 @@ static int omap_8250_dma_handle_irq(struct uart_port *port) } } - spin_unlock_irqrestore(&port->lock, flags); + uart_unlock_and_check_sysrq(port, flags); serial8250_rpm_put(up); return 1; } diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 3f779d25ec0c..d2f3310abe54 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1736,7 +1736,7 @@ void serial8250_read_char(struct uart_8250_port *up, unsigned char lsr) else if (lsr & UART_LSR_FE) flag = TTY_FRAME; } - if (uart_handle_sysrq_char(port, ch)) + if (uart_prepare_sysrq_char(port, ch)) return; uart_insert_char(port, lsr, UART_LSR_OE, ch, flag); @@ -1878,7 +1878,7 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir) if ((!up->dma || up->dma->tx_err) && (status & UART_LSR_THRE)) serial8250_tx_chars(up); - spin_unlock_irqrestore(&port->lock, flags); + uart_unlock_and_check_sysrq(port, flags); return 1; } EXPORT_SYMBOL_GPL(serial8250_handle_irq); @@ -3239,9 +3239,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, serial8250_rpm_get(up); - if (port->sysrq) - locked = 0; - else if (oops_in_progress) + if (oops_in_progress) locked = spin_trylock_irqsave(&port->lock, flags); else spin_lock_irqsave(&port->lock, flags);