Received: by 10.192.165.148 with SMTP id m20csp5351382imm; Wed, 9 May 2018 03:43:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqlYqZDG6DkCn3iyw3NKzvIrphPxBDTtvmhbOlvRhaa6/5msRE1Jtflq4CdGHForAze+wyE X-Received: by 2002:a17:902:a717:: with SMTP id w23-v6mr11982378plq.130.1525862623228; Wed, 09 May 2018 03:43:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525862623; cv=none; d=google.com; s=arc-20160816; b=YxaBtI8Ovz/vx5G6uChJxcJKgFVSNPqQhL9kkWJLDq6ceOAAE6Dfq2vXcpLQoGx87k 3RhIs9UzB3A8bMBZj3t89O+MvXKI7ce19oHZX8ZFfpKI2V/Wb2uFRdVzv0G94HhhA2lK 1QWhILhAZRDQSiOzxzyU/jPf8JlK+9vSIvV4rSBQOO2wuwt/17Q7/CO83U6zKYWLonxx HlzPvk5FVYTV6LGNhw/9gLjYp8/aVRw+eTUmvD51LoP8Dnp7YM1stDYDzyaUAOdHasFI RynHLiv0GuVrTCbxsGx4DibnLKWxrhHWu9IBJ5XX09YRWT1rHEk5yPUYJyGgU0LmaABr bymA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=N/FUktpkU6MYmEajLANw5grEDXEkHomPxaIwlJ5Olng=; b=dk2LysOSuJfuo+sDqoja4mqETuLKTZgcKlCyP2lo2odDgTwzcTN4s2IgtMmM9GqmrW RzTbycILdjq6A8Ln7RlTY9caG5pj/3QnUB4yG2fGdsPBssZNHxj9Hrxr5aEq/yV70CC8 sslukE8ZBWw/1ZrcXO/f8iksFWzHym6+bS3u7lp+T9XYPLyZtdz4Cu40QbFABprVVifF ArrkWG9B7EHctygoLbqDeTr5qZjPULP6r3Kmjj/7LZuzz5p9LpK6cPPS6ZwALAxIlX8G A7bmipcOBP1912dRkue0jC7KZqdAbdUURCapIARocfI8ZgXWyfyw+0U2QRlHk2cBmxCh dAaA== 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 j5-v6si21428675pgn.117.2018.05.09.03.43.28; Wed, 09 May 2018 03:43:43 -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 S934595AbeEIKnK (ORCPT + 99 others); Wed, 9 May 2018 06:43:10 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:53473 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932570AbeEIKnJ (ORCPT ); Wed, 9 May 2018 06:43:09 -0400 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fGMYl-0004B9-MX; Wed, 09 May 2018 12:42:59 +0200 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1fGMYi-0004q6-7B; Wed, 09 May 2018 12:42:56 +0200 Date: Wed, 9 May 2018 12:42:56 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Sebastian Reichel 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: <20180509104256.slkzauicnhsktqqf@pengutronix.de> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180509102058.6mshag4y7aq4w2n2@earth.universe> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 09, 2018 at 12:20:58PM +0200, Sebastian Reichel wrote: > Hi, > > On Tue, May 08, 2018 at 08:46:12PM +0200, Uwe Kleine-K?nig 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?nig wrote: > > > > On Mon, May 07, 2018 at 11:36:10PM +0200, Sebastian Reichel wrote: > > > > > This properly unmaps DMA SG on device shutdown. > > > > > > > > > > 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(-) > > > > > > > > > > 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 uart_port *port) > > > > > u32 ucr1, ucr2; > > > > > > > > > > if (sport->dma_is_enabled) { > > > > > - sport->dma_is_rxing = 0; > > > > > - sport->dma_is_txing = 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 = 0; > > > > > + } > > > > > > > > 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? If the > > > > former it would be great to point out in the commit log, if the latter, > > > > I wonder if this is a real problem that warrants a stable backport. > > > > > > A bit of both. One of Collabora's customers had a (scarce) kernel crash > > > 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. > > > > In which context (kernel version, operating mode (e.g. rs485)) did these > > happen? What does "crash" mean? The kernel did just hang or produced an > > oops? If the latter, can you show it/them? > > 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. > > -- Sebastian > > ... > [ 302.516696] Unhandled fault: external abort on non-linefetch (0x1008) at 0xf0938000 This is usually a missing clk. Alternatively RX is disabled and the RXDATA register is read. Scrolling through git log v4.13..linus/master -- drivers/tty/serial/imx.c I didn't find a candidate for fixing that. > [ 302.524394] pgd = 80004000 > [ 302.527111] [f0938000] *pgd=de81a811, *pte=53fc0653, *ppte=53fc0453 > [ 302.533451] Internal error: : 1008 [#1] SMP ARM > [ 302.537994] Modules linked in: smsc95xx usbnet atmel_mxt_ts > [ 302.543651] CPU: 0 PID: 357 Comm: _ACFRead Not tainted 4.8.0 #1 > [ 302.549578] Hardware name: Freescale i.MX53 (Device Tree Support) > [ 302.555679] task: edbf1f00 task.stack: ed5ce000 > [ 302.560228] PC is at imx_rxint+0x5c/0x228 > [ 302.564261] LR is at lock_acquired+0x494/0x57c If you still have this kernel, disabling imx_rxint would be helpful. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |