From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762063AbcALBmE (ORCPT ); Mon, 11 Jan 2016 20:42:04 -0500 Received: from mail-sn1nam02on0067.outbound.protection.outlook.com ([104.47.36.67]:22208 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1760002AbcALBl7 (ORCPT ); Mon, 11 Jan 2016 20:41:59 -0500 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; hurleysoftware.com; dkim=none (message not signed) header.d=none;hurleysoftware.com; dmarc=bestguesspass action=none header.from=xilinx.com; From: Soren Brinkmann To: Greg Kroah-Hartman , Jiri Slaby CC: Michal Simek , , , , "Peter Hurley" , Soren Brinkmann Subject: [PATCH LINUX 4/6] tty: xuartps: Improve sysrq handling Date: Mon, 11 Jan 2016 17:41:39 -0800 Message-ID: <1452562901-17848-5-git-send-email-soren.brinkmann@xilinx.com> X-Mailer: git-send-email 2.7.0.3.g497ea1e In-Reply-To: <1452562901-17848-1-git-send-email-soren.brinkmann@xilinx.com> References: <1452562901-17848-1-git-send-email-soren.brinkmann@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-22058.006 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:149.199.60.83;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(50986999)(4001430100002)(5008740100001)(2950100001)(33646002)(4326007)(50466002)(47776003)(5003940100001)(189998001)(92566002)(86362001)(77096005)(11100500001)(48376002)(81156007)(5001960100002)(229853001)(2906002)(19580405001)(107886002)(50226001)(76506005)(1096002)(36386004)(36756003)(57986006)(5001770100001)(19580395003)(1220700001)(6806005)(87936001)(76176999)(63266004)(106466001)(586003)(107986001)(217873001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1NAM02HT218;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;PTR:unknown-60-83.xilinx.com;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 021eab4a-bad7-4c6a-2585-08d31af18ec8 X-Exchange-Antispam-Report-Test: UriScan:;BCL:0;PCL:0;RULEID:(8251501002);SRVR:SN1NAM02HT218;UriScan:(192813158149592); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(13015025)(8121501046)(13018025)(13017025)(5005006)(520078)(3002001)(10201501046);SRVR:SN1NAM02HT218;BCL:0;PCL:0;RULEID:;SRVR:SN1NAM02HT218; X-Forefront-PRVS: 081904387B X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2016 01:41:57.1637 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1NAM02HT218 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Handling magic sysrq included dropping a lock to avoid a deadlock that happened when cdns_uart_console_write tried to acquire a lock in the from the sysrq code path. By making the acquisition of the lock in cdns_uart_console_write depending on port->sysrq, cdns_uart_handle_rx can be simplified to simply call uart_handle_sysrq. Suggested-by: Peter Hurley Signed-off-by: Soren Brinkmann --- v4: - added this patch --- drivers/tty/serial/xilinx_uartps.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 8014dd3c6d55..0eecba88298f 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -220,20 +220,8 @@ static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus) continue; } -#ifdef SUPPORT_SYSRQ - /* - * uart_handle_sysrq_char() doesn't work if - * spinlocked, for some reason - */ - if (port->sysrq) { - spin_unlock(&port->lock); - if (uart_handle_sysrq_char(port, data)) { - spin_lock(&port->lock); - continue; - } - spin_lock(&port->lock); - } -#endif + if (uart_handle_sysrq_char(port, data)) + continue; port->icount.rx++; @@ -1128,7 +1116,9 @@ static void cdns_uart_console_write(struct console *co, const char *s, unsigned int imr, ctrl; int locked = 1; - if (oops_in_progress) + if (port->sysrq) + locked = 0; + else if (oops_in_progress) locked = spin_trylock_irqsave(&port->lock, flags); else spin_lock_irqsave(&port->lock, flags); -- 2.7.0.3.g497ea1e From mboxrd@z Thu Jan 1 00:00:00 1970 From: Soren Brinkmann Subject: [PATCH LINUX 4/6] tty: xuartps: Improve sysrq handling Date: Mon, 11 Jan 2016 17:41:39 -0800 Message-ID: <1452562901-17848-5-git-send-email-soren.brinkmann@xilinx.com> References: <1452562901-17848-1-git-send-email-soren.brinkmann@xilinx.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1452562901-17848-1-git-send-email-soren.brinkmann@xilinx.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Greg Kroah-Hartman , Jiri Slaby Cc: Peter Hurley , Michal Simek , linux-kernel@vger.kernel.org, Soren Brinkmann , linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org List-Id: linux-serial@vger.kernel.org Handling magic sysrq included dropping a lock to avoid a deadlock that happened when cdns_uart_console_write tried to acquire a lock in the from the sysrq code path. By making the acquisition of the lock in cdns_uart_console_write depending on port->sysrq, cdns_uart_handle_rx can be simplified to simply call uart_handle_sysrq. Suggested-by: Peter Hurley Signed-off-by: Soren Brinkmann --- v4: - added this patch --- drivers/tty/serial/xilinx_uartps.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 8014dd3c6d55..0eecba88298f 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -220,20 +220,8 @@ static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus) continue; } -#ifdef SUPPORT_SYSRQ - /* - * uart_handle_sysrq_char() doesn't work if - * spinlocked, for some reason - */ - if (port->sysrq) { - spin_unlock(&port->lock); - if (uart_handle_sysrq_char(port, data)) { - spin_lock(&port->lock); - continue; - } - spin_lock(&port->lock); - } -#endif + if (uart_handle_sysrq_char(port, data)) + continue; port->icount.rx++; @@ -1128,7 +1116,9 @@ static void cdns_uart_console_write(struct console *co, const char *s, unsigned int imr, ctrl; int locked = 1; - if (oops_in_progress) + if (port->sysrq) + locked = 0; + else if (oops_in_progress) locked = spin_trylock_irqsave(&port->lock, flags); else spin_lock_irqsave(&port->lock, flags); -- 2.7.0.3.g497ea1e From mboxrd@z Thu Jan 1 00:00:00 1970 From: soren.brinkmann@xilinx.com (Soren Brinkmann) Date: Mon, 11 Jan 2016 17:41:39 -0800 Subject: [PATCH LINUX 4/6] tty: xuartps: Improve sysrq handling In-Reply-To: <1452562901-17848-1-git-send-email-soren.brinkmann@xilinx.com> References: <1452562901-17848-1-git-send-email-soren.brinkmann@xilinx.com> Message-ID: <1452562901-17848-5-git-send-email-soren.brinkmann@xilinx.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Handling magic sysrq included dropping a lock to avoid a deadlock that happened when cdns_uart_console_write tried to acquire a lock in the from the sysrq code path. By making the acquisition of the lock in cdns_uart_console_write depending on port->sysrq, cdns_uart_handle_rx can be simplified to simply call uart_handle_sysrq. Suggested-by: Peter Hurley Signed-off-by: Soren Brinkmann --- v4: - added this patch --- drivers/tty/serial/xilinx_uartps.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 8014dd3c6d55..0eecba88298f 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -220,20 +220,8 @@ static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus) continue; } -#ifdef SUPPORT_SYSRQ - /* - * uart_handle_sysrq_char() doesn't work if - * spinlocked, for some reason - */ - if (port->sysrq) { - spin_unlock(&port->lock); - if (uart_handle_sysrq_char(port, data)) { - spin_lock(&port->lock); - continue; - } - spin_lock(&port->lock); - } -#endif + if (uart_handle_sysrq_char(port, data)) + continue; port->icount.rx++; @@ -1128,7 +1116,9 @@ static void cdns_uart_console_write(struct console *co, const char *s, unsigned int imr, ctrl; int locked = 1; - if (oops_in_progress) + if (port->sysrq) + locked = 0; + else if (oops_in_progress) locked = spin_trylock_irqsave(&port->lock, flags); else spin_lock_irqsave(&port->lock, flags); -- 2.7.0.3.g497ea1e