Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2249519imm; Thu, 7 Jun 2018 07:41:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJx6w7pcw4vqosrk6oZiFq+D0j3VSX8AQZI9eU+YPzvRHVA883K0BvU/r87SaxVpHK2Bd0l X-Received: by 2002:a62:660a:: with SMTP id a10-v6mr2067051pfc.156.1528382515814; Thu, 07 Jun 2018 07:41:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528382515; cv=none; d=google.com; s=arc-20160816; b=PZKI+/u+bqETpwfC7k1mGk4aUwHQOnXoBba1Znyy/zNrB6681g5+PK3JVrFxok7GHe uvq9Mgkj0IBt7tBPFE2s60pKt7bp87kgW436bum/sQL30J0GWXfZVGzykKldEUO9aj1P vQ6D+XYfjGcRghgHZtUZgs3T5gLUB60hcXnTnFJNCt+md/T4Dp1b/iCOigZ/kYFsyi0V b+6oPqcEmVVT8Ato7McZplWwE+Do2pf1RG/edQIn+B/kWgul2BlC7I/R/+ydOquacmAp 3qPDm+k1xUiHqWiEGIpvgG8lK0p3PBlZLf0BnbpzJ9ME9uHOoSKvVMmJh0JhirgjRdjJ CloQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=OL752lf9U0fRiAIxmjQOyLFCITdbVGu5SfG1O1dM08A=; b=HwskZzdp+OhVIGcysODNa9Dx/r0rTzSLBXYl2bzfkYFbCDaec10uO//3xRpexkJ6UO t3FWnlpdtrJdkvB2boTbHqFfZAXA4GOqnR3Y7zKpxZBvOzlV3RRQZySaikopDfKoKkVp CEoaRqtvQE5P2CPCV6b4o4Z7LktN0yTh+jE7GlNIz4SINro5rAVpClkrTBYtGsS6zGhj 6myslWZSzW2NCRvtuTmv9wKPFVSwcHOxr4uE1pppFZpF7NV5Fbar0okv0F1zQ9vQ45lJ abTMDfR0zoyjbo3EcMgJxYuITsJqjTQk/lbiPzRs4rxYzIAwlLLPwoJ4RZuUVg9uVRtC q6Gw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s186-v6si6811627pfb.39.2018.06.07.07.41.41; Thu, 07 Jun 2018 07:41:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934470AbeFGOkY (ORCPT + 99 others); Thu, 7 Jun 2018 10:40:24 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:40543 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932912AbeFGOkS (ORCPT ); Thu, 7 Jun 2018 10:40:18 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvbX-0005Zl-Cl; Thu, 07 Jun 2018 15:09:31 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvbA-0003AK-P0; Thu, 07 Jun 2018 15:09:08 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Geert Uytterhoeven" , "Greg Kroah-Hartman" , "Ulrich Hecht" , "Nguyen Viet Dung" , "Yoshihiro Shimoda" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 308/410] serial: sh-sci: prevent lockup on full TTY buffers In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Ulrich Hecht commit 7842055bfce4bf0170d0f61df8b2add8399697be upstream. 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 Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings --- drivers/tty/serial/sh-sci.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -734,6 +734,8 @@ static void sci_receive_chars(struct uar /* 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 */ serial_port_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); }