From patchwork Thu Jul 30 10:42:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 6901251 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9A3AC9F380 for ; Thu, 30 Jul 2015 10:42:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7CF8520569 for ; Thu, 30 Jul 2015 10:42:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 27D3D2054E for ; Thu, 30 Jul 2015 10:42:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755150AbbG3Km2 (ORCPT ); Thu, 30 Jul 2015 06:42:28 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:28075 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755146AbbG3Km0 (ORCPT ); Thu, 30 Jul 2015 06:42:26 -0400 Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie2.idc.renesas.com with ESMTP; 30 Jul 2015 19:42:25 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id 05FED50878; Thu, 30 Jul 2015 19:42:25 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id E40C3480A4; Thu, 30 Jul 2015 19:42:24 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id DB469480A3; Thu, 30 Jul 2015 19:42:24 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac4.idc.renesas.com with ESMTP id VAE14182; Thu, 30 Jul 2015 19:42:24 +0900 X-IronPort-AV: E=Sophos;i="5.15,576,1432566000"; d="scan'";a="191459668" Received: from mail-pu1apc01lp0022.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.22]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 30 Jul 2015 19:42:23 +0900 Authentication-Results: glider.be; dkim=none (message not signed) header.d=none; Received: from [10.166.13.234] (211.11.155.144) by HK2PR06MB0915.apcprd06.prod.outlook.com (10.162.246.30) with Microsoft SMTP Server (TLS) id 15.1.225.19; Thu, 30 Jul 2015 10:42:21 +0000 Message-ID: <55B9FF89.7080902@renesas.com> Date: Thu, 30 Jul 2015 19:42:17 +0900 From: Yoshihiro Shimoda User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Geert Uytterhoeven CC: Magnus Damm , Laurent Pinchart , Nobuhiro Iwamatsu , Yoshihiro Kaneko , Kazuya Mizuguchi , Koji Matsuoka , Wolfram Sang , Guennadi Liakhovetski , Subject: Re: [PATCH/RFC v2 00/29] serial: sh-sci: Miscellaneous and DMA Improvements References: <1437070920-28069-1-git-send-email-geert+renesas@glider.be> <55B735C2.2030905@renesas.com> In-Reply-To: <55B735C2.2030905@renesas.com> X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR01CA0002.jpnprd01.prod.outlook.com (25.161.131.140) To HK2PR06MB0915.apcprd06.prod.outlook.com (25.162.246.30) X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB0915; 2:sywF+nQ1V6U2pX+PZ5KycARJ5h/v5psYlDEp1dWLtL4dJegrEoEFqMu2n1EcZuqIn8Mm9yZaOEtTzj+vV4QUfGM1FvR6b/yJpL6L+bLnOBxEKgEPyD3Xiom7WA1beo/FsoeiN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t0dD+QS32l2gewjNWZyw7q31t2G3E6jp8GEqzGtRemN1XTB/TsqO+tjk4ePPlNr/5X2aVLQV/pe6pIbfOCWW/bdQt5b193ByjxaaBnEI5jfl23PJcWg25JZMqEe6wVYu6+/z1SugRBp1XrwbzRb0UNii0aHme8Zngvmh5hTay02Bd+4uEVIHiPJrOvLiMeQxI3qHWLXuceGZTWHs9u7MMBp0th2rfYmrf2cNYGewmA5ZPrnPHuPblvxsvEa0inxd38zvOZaSlFZasKuS/nYydDjYStQf2sgHW53V2KahBk= HK2PR06MB0915: X-MS-Exchange-Organization-RulesExecuted X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:HK2PR06MB0915; BCL:0; PCL:0; RULEID:; SRVR:HK2PR06MB0915; X-Forefront-PRVS: 06530126A4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6049001)(6009001)(53754006)(24454002)(479174004)(76176999)(65806001)(189998001)(122386002)(36756003)(4001350100001)(62966003)(33656002)(65956001)(77156002)(77096005)(19580395003)(80316001)(66066001)(46102003)(92566002)(2950100001)(110136002)(83506001)(54356999)(23756003)(50986999)(40100003)(19580405001)(50466002)(47776003)(5001960100002)(86362001)(42186005)(7059030); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR06MB0915; H:[10.166.13.234]; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB0915; 23:oeEfBhU0sTT/PoRRiTIyNFhfdWxld6CdCLnNpCNG0o8Dbq5wGYAGadnKOHs2OHkke0HTK8NCYsRUeXDHszDIpx1tWXg69sNUKJZmIbmR5E5QWrj8Bhl5+OI2XqfXzq2X+6PFbR2StFPmRZ2d/BGvJoh4w+Mdeur7hK1Zu3nAyzNiefXIiraMFPZai17+1ZJHxkH0okcP2eUDXpPSxIqqWr3FfIvjGmTwDyxlK/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SwRyYUqTDnzld9YTQ0NwhZtk4yLGIt3YPUlQpUPGjy5ZvmDmadjT4/brJYqPUaCKMBam0O6j2dbYBm/QjKpk+F8f0rkXt7pjppeodzOynNtMavHJ2XosHwZ4+KhpP5RR4i7ok6B7TH9U= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2015 10:42:21.5395 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR06MB0915 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Geert-san again, (2015/07/28 16:56), Yoshihiro Shimoda wrote: > Hi Geert-san, > > Thank you for the patches! > > (2015/07/17 3:21), Geert Uytterhoeven wrote: >> Hi all, >> >> This patch series contains various updates for the Renesas >> (H)SCI(F{,A,B}) driver, incl. DMA support for SCIF on R-Car Gen2. >> Some of these patches have been sent before. (Few) Changes are indicated >> in the individual patches. >> >> This is definitely not a final series, that's why it's marked as RFC and >> sent to a limited audience: >> - There are still some race conditions between e.g. RX DMA >> completion(s) and the worker function, >> - Under high load RX DMA breaks, I investigated this driver more. And then, I found some issues about RX DMA. So, I wrote some patches below. Would you check them? (Or, should I send these patches to the ML using "git send-email"?) --- Subject: [PATCH 1/3] serial: sh-sci: Avoid disable_irq_nosync() twice after sci_er_interrupt() From: Yoshihiro Shimoda This patch fixes an issue that this driver calls disable_irq_nosync() twice wrongly in a specific condition. After that, this driver cannot work correctly: - CONFIG_SERIAL_SH_SCI_DMA=y - SCIFA or SCIFB - After overrun happened Signed-off-by: Yoshihiro Shimoda --- drivers/tty/serial/sh-sci.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index e1ac4c3b..ab1e15a 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -958,7 +958,14 @@ static irqreturn_t sci_rx_interrupt(int irq, void *ptr) /* Disable future Rx interrupts */ if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { - disable_irq_nosync(irq); + /* + * Since this function is called by sci_mpxed_interrupt + * and sci_er_interrupt, this function may call + * disale_irq_nosync() twice wrongly. And then, this + * driver doesn't enable the interrupt anymore. + */ + if (!(scr & SCSCR_RDRQE)) + disable_irq_nosync(irq); scr |= SCSCR_RDRQE; } else { scr &= ~SCSCR_RIE; -- 1.9.1 ---- Subject: [PATCH 2/3] serial: sh-sci: Don't kick tx in sci_er_interrupt() From: Yoshihiro Shimoda If CONFIG_SERIAL_SH_SCI_DMA is enabled, the driver doesn't enable TIE on SCIF or HSCIF. However, this driver may call sci_tx_interrupt() in sci_er_interrupt(). After that, the driver cannot care of the interrupt, and then "irq 109: nobody cared" happens on r8a7791/koelsch board. This patch fixes the issue. Signed-off-by: Yoshihiro Shimoda --- drivers/tty/serial/sh-sci.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index ab1e15a..87ebce7 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1021,9 +1021,6 @@ static irqreturn_t sci_er_interrupt(int irq, void *ptr) sci_clear_SCxSR(port, SCxSR_ERROR_CLEAR(port)); - /* Kick the transmission */ - sci_tx_interrupt(irq, ptr); - return IRQ_HANDLED; } -- 1.9.1 ---- Subject: [PATCH 3/3] serial: sh-sci: return IRQ_HANDLED if detects overrun From: Yoshihiro Shimoda This patch fix an issue that the driver may cause "nobody cared" IRQ when this driver detects the overrun flag only. Signed-off-by: Yoshihiro Shimoda --- drivers/tty/serial/sh-sci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 87ebce7..b896a1c 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1090,8 +1090,10 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) ret = sci_br_interrupt(irq, ptr); /* Overrun Interrupt */ - if (orer_status & s->overrun_mask) + if (orer_status & s->overrun_mask) { sci_handle_fifo_overrun(port); + ret = IRQ_HANDLED; + } return ret; }