From patchwork Thu Feb 15 12:02:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 10220979 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 119F960467 for ; Thu, 15 Feb 2018 12:02:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 025A92880D for ; Thu, 15 Feb 2018 12:02:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB0512882C; Thu, 15 Feb 2018 12:02: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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 642382880D for ; Thu, 15 Feb 2018 12:02:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967959AbeBOMCg (ORCPT ); Thu, 15 Feb 2018 07:02:36 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:33188 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967843AbeBOMCd (ORCPT ); Thu, 15 Feb 2018 07:02:33 -0500 Received: by mail-wr0-f194.google.com with SMTP id s5so3107113wra.0; Thu, 15 Feb 2018 04:02:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=qB50K+U2QcQc34WCXRNIFukNuloPsQapF2GOs5TbIxM=; b=UMjdG2uERAML/caZNy3n/L0DMMNRe7SjgP0Ri35+BY0Ug1Tt+P9yQdNP/aZKrdhSOZ zYUoYq0WvtAbCPcr131NFbKg05u9GguMQDqVVWBNcVbMIDzN9vfrajBAZ72+GgK9UbdH 8xlByNrVJYYs83ar50n6IG2qIwpO3dhgXXTSWJdjWyguhqQ581licVqX1MTlJHM1VJdp BRSThjIoJPXb22F5exwNUUsKgfM0CJrQziK9KRjCRj1AFwgyFiUSDbQLsKQeqYbmcG2G bo32cEVlsrWEkSfJ0nLe7iqLtFWVCXwNXBMRa5nGpCWBto0uhHIr/Gvyhpa6YGT0N1Q7 x+1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=qB50K+U2QcQc34WCXRNIFukNuloPsQapF2GOs5TbIxM=; b=mIQFe4beLx82KCVaCpEvgWEtJ5p/FEPz1n7UWzVfeswUyjP3EnT5k7lAdgpve6exZh qiAFK7U63yGZ7Q2Wp+3rqql6cKxiljtxX5S2/8s0mA1VEu6mhqJcff37jNH/nPk2VSSo VQQuqp9vyZUoyOQw9zj1geQLaManUpcdRg9yJGDe8ihrbpc70huX5jkF/LuShmP1hBeq UEjA2sENi3N69oiMQnh0GlyXMnbKqAL4x/4Gw0hpZP2PLX9MDio1Qe9Z3yEL4QIIvDdm VvNrhC5kVLzOIjYXxMrmIGGo96mzd+5tnq5VpnnyPJ4Ohc75Z0iS5tBgSDtScb/uo/qX cAtA== X-Gm-Message-State: APf1xPCl5jXBl7DceeEKm//Ovbt8be6pTqa/PhAFBqT4o9BHUgunBVqz /zIIWwBGXXVCckg2Jd6IK4zvZso= X-Google-Smtp-Source: AH8x224lje0Dlc+HP5RuGVbK9Ij0n1CT3Qyd8kQ5fyIQL0mQbECB2QA2g7Vi8NQlatbGVTOIwzRiLw== X-Received: by 10.223.166.171 with SMTP id t40mr1021161wrc.49.1518696151771; Thu, 15 Feb 2018 04:02:31 -0800 (PST) Received: from groucho.site (ipbcc3b860.dynamic.kabel-deutschland.de. [188.195.184.96]) by smtp.gmail.com with ESMTPSA id d27sm11024946wrd.60.2018.02.15.04.02.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Feb 2018 04:02:31 -0800 (PST) From: Ulrich Hecht To: linux-renesas-soc@vger.kernel.org, linux-serial@vger.kernel.org Cc: wsa@the-dreams.de, geert@linux-m68k.org, yoshihiro.shimoda.uh@renesas.com, Ulrich Hecht Subject: [PATCH] serial: sh-sci: prevent lockup on full TTY buffers Date: Thu, 15 Feb 2018 13:02:27 +0100 Message-Id: <1518696147-23790-1-git-send-email-ulrich.hecht+renesas@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When the TTY buffers fill up to the configured maximum, a system lockup occurs: [ 598.820128] INFO: rcu_preempt detected stalls on CPUs/tasks: [ 598.825796] 0-...!: (1 GPs behind) idle=5a6/2/0 softirq=1974/1974 fqs=1 [ 598.832577] (detected by 3, t=62517 jiffies, g=296, c=295, q=126) [ 598.838755] Task dump for CPU 0: [ 598.841977] swapper/0 R running task 0 0 0 0x00000022 [ 598.849023] Call trace: [ 598.851476] __switch_to+0x98/0xb0 [ 598.854870] (null) This can be prevented by doing a dummy read of the RX data register. This issue affects both HSCIF and SCIF ports. Reported for R-Car H3 ES2.0; reproduced and fixed on H3 ES1.1. Probably affects other R-Car platforms as well. Reported-by: Yoshihiro Shimoda Signed-off-by: Ulrich Hecht Reviewed-by: Geert Uytterhoeven Tested-by: Nguyen Viet Dung --- drivers/tty/serial/sh-sci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index d9f399c..db2ebec 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -885,6 +885,8 @@ static void sci_receive_chars(struct uart_port *port) /* Tell the rest of the system the news. New characters! */ tty_flip_buffer_push(tport); } else { + /* TTY buffers full; read from RX reg to prevent lockup */ + serial_port_in(port, SCxRDR); serial_port_in(port, SCxSR); /* dummy read */ sci_clear_SCxSR(port, SCxSR_RDxF_CLEAR(port)); }