Received: by 10.192.165.148 with SMTP id m20csp5394813imm; Wed, 9 May 2018 04:29:27 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpNSHgP8D5kjx6yrDSU8gLttWK79HhL+2bJkA979gCvfxWBPibBou/ep+8JTZjARiRjHjUO X-Received: by 2002:a63:9911:: with SMTP id d17-v6mr36163660pge.106.1525865367431; Wed, 09 May 2018 04:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525865367; cv=none; d=google.com; s=arc-20160816; b=ejfa55caXYI9N7GMI03SSxL+kiBHMEEwUeF7MxnvUyOpiUDXdpuivE8404di4k2q5B 0FtYMV9/UU77JLvdqcof0wbmd7xclhf5B98t9Ujg3JilFlgiNR0UjRJ/hz+tKcaqCrjQ 3Dt1xr2LRrhAD7p1UsGrmHU5VBX6WRin0OkAxaIUkjQ9zX2wlybxZk2GCtueog1uKvfB pz9jAySNmMQcVH8IXWnAa5BpKdDSARHUh6hmv/ikPfHuCNvnm1+bVxRWzDDImaPkbkTz 2ly73mYTcd1Wb4QQwWJXjTx1YVCjTj+ByKIg4TQsVdIMZNGh8u8T2mwM4oKks4Wxkmn7 JcGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=YGarjxycFhDUyVG9ebzWwxDUlKxKBgihfeWpJLplHVY=; b=BREzeQKWdq6bYMvQC6buZdvEsX5LTVN63+WUMQWkUCmlF2Yhwogr/0TBJyYiJN+EL+ 9yFF6Pp5pcG93JlrPU8AKOrDuA844giPphhvvUGuqDdQWgV99PwTSNX3tNk8OAFnNeQb EkQA0CUdA9LxHyrFYStSY3NNouAKgNNPZDwCKWxpryAzRF5X1wuG3w6xxHI61H4eXVd7 Cyr2q4VgJrWGIAePrvFpkpcHn9UvSHzHy0YDI2dJDY0WFYdpgpaIybfuxujm79SbPnvg Oxie+MEumsxGASlr5YSZ4YG7vtcInJuY5nJ6o2Lg4FA4DTyCvYIq+Aq3hrIMd001zluw RW9Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.co.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s12-v6si16622373pgq.616.2018.05.09.04.29.11; Wed, 09 May 2018 04:29:27 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.co.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756288AbeEIL25 (ORCPT + 99 others); Wed, 9 May 2018 07:28:57 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:54798 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756258AbeEIL2y (ORCPT ); Wed, 9 May 2018 07:28:54 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id 1F159282B40 Date: Wed, 9 May 2018 13:28:50 +0200 From: Sebastian Reichel To: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= Cc: Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, Fabio Estevam , Shawn Guo , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] serial: imx: dma_unmap_sg buffers on shutdown Message-ID: <20180509112850.52amrm7ffxhk2zm2@earth.universe> References: <20180507213610.17330-1-sebastian.reichel@collabora.co.uk> <20180507213610.17330-3-sebastian.reichel@collabora.co.uk> <20180508064351.ioczgw2v4jtryr3x@pengutronix.de> <20180508134047.zocurxwelw3a24ti@earth.universe> <20180508184612.iixr3psap4ik5fdr@pengutronix.de> <20180509102058.6mshag4y7aq4w2n2@earth.universe> <20180509104256.slkzauicnhsktqqf@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="q42juzzebumcprf7" Content-Disposition: inline In-Reply-To: <20180509104256.slkzauicnhsktqqf@pengutronix.de> User-Agent: NeoMutt/20180323 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --q42juzzebumcprf7 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Wed, May 09, 2018 at 12:42:56PM +0200, Uwe Kleine-K=F6nig wrote: > On Wed, May 09, 2018 at 12:20:58PM +0200, Sebastian Reichel wrote: > > Hi, > >=20 > > On Tue, May 08, 2018 at 08:46:12PM +0200, Uwe Kleine-K=F6nig wrote: > > > On Tue, May 08, 2018 at 03:40:47PM +0200, Sebastian Reichel wrote: > > > > On Tue, May 08, 2018 at 08:43:51AM +0200, Uwe Kleine-K=F6nig wrote: > > > > > On Mon, May 07, 2018 at 11:36:10PM +0200, Sebastian Reichel wrote: > > > > > > This properly unmaps DMA SG on device shutdown. > > > > > >=20 > > > > > > Reported-by: Nandor Han > > > > > > Suggested-by: Nandor Han > > > > > > Signed-off-by: Sebastian Reichel > > > > > > --- > > > > > > drivers/tty/serial/imx.c | 12 ++++++++++-- > > > > > > 1 file changed, 10 insertions(+), 2 deletions(-) > > > > > >=20 > > > > > > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c > > > > > > index 3ca767b1162a..6c53e74244ec 100644 > > > > > > --- a/drivers/tty/serial/imx.c > > > > > > +++ b/drivers/tty/serial/imx.c > > > > > > @@ -1425,10 +1425,18 @@ static void imx_uart_shutdown(struct ua= rt_port *port) > > > > > > u32 ucr1, ucr2; > > > > > > =20 > > > > > > if (sport->dma_is_enabled) { > > > > > > - sport->dma_is_rxing =3D 0; > > > > > > - sport->dma_is_txing =3D 0; > > > > > > dmaengine_terminate_sync(sport->dma_chan_tx); > > > > > > + if (sport->dma_is_txing) { > > > > > > + dma_unmap_sg(sport->port.dev, &sport->tx_sgl[0], > > > > > > + sport->dma_tx_nents, DMA_TO_DEVICE); > > > > > > + sport->dma_is_txing =3D 0; > > > > > > + } > > > > >=20 > > > > > did you find this because the kernel crashed or consumed more and= more > > > > > memory, or is this "only" a finding of reading the source code? I= f the > > > > > former it would be great to point out in the commit log, if the l= atter, > > > > > I wonder if this is a real problem that warrants a stable backpor= t. > > > >=20 > > > > A bit of both. One of Collabora's customers had a (scarce) kernel c= rash > > > > in imx-serial and modified multiple things in the driver. The crash= is > > > > gone, but it's not clear which change fixed it. I could not > > > > reproduce the crash so far and I'm currently rebasing and splitting > > > > their changes into upstreamable portions with proper patch > > > > descriptions. From reading the source this looked like a real issue. > > >=20 > > > In which context (kernel version, operating mode (e.g. rs485)) did th= ese > > > happen? What does "crash" mean? The kernel did just hang or produced = an > > > oops? If the latter, can you show it/them? > >=20 > > I pasted the oops, that triggered writing the patches (Linux 4.8, no > > rs485, 4MHz baudrate). I think, that the actual issue has already been > > fixed upstream between 4.13 and current master. > >=20 > > -- Sebastian > >=20 > > ... > > [ 302.516696] Unhandled fault: external abort on non-linefetch (0x1008= ) at 0xf0938000 >=20 > This is usually a missing clk. Alternatively RX is disabled and the > RXDATA register is read. Scrolling through >=20 > git log v4.13..linus/master -- drivers/tty/serial/imx.c >=20 > I didn't find a candidate for fixing that. It happens while the port is being torn apart. I think the following patches from you are very good candidates. Especially since the remaining diff fixing the issue in the customer's old kernel has a smilar change: 76821e222c18 - serial: imx: ensure that RX irqs are off if RX is off (9 wee= ks ago) dedc64e02f5d - serial: imx: Stop to receive in .stop_rx() (9 weeks ago) -- Sebastian --q42juzzebumcprf7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAlry228ACgkQ2O7X88g7 +prf1w//RO3HU/eZRCF7548Kz17+XDcy+upDoVOGyOpul/nboloktn5mpqf04j0L onMEwFMxCfb2Z0VmJCYyVdLacl1tLap1FCou1gIOdPkiwO75366HA6K5IYNVVmKe 5VojtI7pafSVS+S5FeCp6BD0OB2RLte745C1CuO8kdFD4d+eFhiVpL8wtQHg8zBd 9VivfONK2dxdo7fUTMB6b3Ng+mB32NESopD3pg+ntvLNT7InJoOPWgaPVeLmYP4m HkDJLBtvOFfyklk3xK7f6KSk4s4wKIY6hxD51fwQhhraUnnUe9sZpE7b+rw+cQGy ovMdK8qt51rv2S3YOfCOB0/87QhlzF+aUzs+DqDdUh8185wmT2MTyUxwe/6U1DsE GlXD+/v6dozkaaOBBKDxw1kckoYp5RYCnHzpnykkd6I8DFaCIPO3GUaSuJt0Drx9 xEDT46KVl6RTOW+gn8PeiXr3NPPTGMbosL8JRYq0rZOEOhL/almTrwCWsaDxgIb4 0OsfQ9GWIrl5Q+zQ/2iohKNh1XFDMKLngnt92trYYKuTD3cEQ2ZeJJEv6Z3SKVW4 2isspDC4Gcv6yEedaQiYrsx/Dge8t6CSAIDOMxWviPXJF0aBmf8Cl6/zS5vcvo7C QL5mI9uUtQ4vRsNds3j3J4vzYQLuX7u+Ye3gokJzP+jQYbxmggA= =eFu/ -----END PGP SIGNATURE----- --q42juzzebumcprf7--