Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp633795ybf; Fri, 28 Feb 2020 04:53:25 -0800 (PST) X-Google-Smtp-Source: APXvYqxjG6wFfSZ1c7eag2VSXwHHcXObTE99a660NoVB0oD4P5nYkFKSsDbmZLv0ww9wwdkbproI X-Received: by 2002:a54:4510:: with SMTP id l16mr3000071oil.70.1582894405140; Fri, 28 Feb 2020 04:53:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582894405; cv=none; d=google.com; s=arc-20160816; b=Eh0lHdYTZzLYAYFhxQ8sMvgHGUjbyFd/9n89Jqc6AUvd5zb0pR8opsdKP+HxRyi51B 0B+lhKAcOw6x8aMYBpOHJHXoXU3NdmszyIg+NkmrZqCMXMG1TOey1agt8VMXpyAKKY5N ZUlinCVfq1XfGu8o+KJbz3Atwd/0Lcsb/lBvg0CMSGjSK7jil3t0ueZ/YR8izboTy/j4 VNCEHO/bXqGEtEtxN1TQWWc49zDMz6e7J4zxCykfJRyoe50NvKxgJZYqBfXy/hUj2vnu 5cXE+5FkraN56ezB6MbdhMDzgpkoyAoGzJwaPd87t1bYvnuEQi8XLZvXdOBZVQ0yzbIl Tvwg== 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:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:dkim-signature; bh=VBsH5lnwfu2PldznIyhJZ4HEa4TTvYERm7hp608PwKk=; b=KnXOdB6vuowSBXkm7je58keCfxchxoZa2tdQo27/x264Qx03Tryh2fVomWkmPTE0NH qaKcor7ms6/z12iHkZA4nZsyouDc3vADTwnh8DTWNi3AnBaFiEZ1wtSWd6wYT5bzJIyo qnJ3dZBKWbkKR5Z9JGtWXdHERJ96cm7/wkKeYcRUwSQwmBM7yXZdGO1VviaMt78F5yg+ VICBqYwqQVMMSiHIdoDaySojTkZTjJNyqpizkHn7xYO1713NrXNPBxUe8/rWmN/CVTyK ZBNyTrcpJMxLo3BzXt9WiUIjRH4TXfWTt0sNm6lcp9bG4Z8OUvo3/c8bOIJklr670Cw9 SHSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@skidata.com header.s=selector1 header.b=LjZqGN6Q; 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=skidata.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p11si1573129ota.300.2020.02.28.04.53.11; Fri, 28 Feb 2020 04:53:25 -0800 (PST) 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; dkim=fail header.i=@skidata.com header.s=selector1 header.b=LjZqGN6Q; 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=skidata.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726738AbgB1MwD (ORCPT + 99 others); Fri, 28 Feb 2020 07:52:03 -0500 Received: from mail1.skidata.com ([91.230.2.99]:63410 "EHLO mail1.skidata.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725876AbgB1MwC (ORCPT ); Fri, 28 Feb 2020 07:52:02 -0500 X-Greylist: delayed 429 seconds by postgrey-1.27 at vger.kernel.org; Fri, 28 Feb 2020 07:52:01 EST DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=skidata.com; i=@skidata.com; q=dns/txt; s=selector1; t=1582894322; x=1614430322; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=g/fumDPqX7LPA3wXxiP1dS805jxlDQnX8YtVKUMeu98=; b=LjZqGN6QzHklV6YiFhSqYetNYrYn8bjM9JqpeNng0UnezFAhpXrmWHu6 BR00jGPg9M60QK0/3c53EzQOl7pviMJdWbMhtV1RDFZs69ZXSb4gZ+UDZ IyrcsN3YS6f4pUHcYIELYAAq/4/6UTFyooVHfu7+gjezTQWvplbXIli2R py2/kIf5QaLbO1V2Ok9xocu3wrSp+nVMjS26vrQaAq4tDeZRwzF3l8lIO sueyrPpHw9mXayIKPTd3Xf2iQFx1LQdN59MY/dl6ZPiibZ5AnKGYKOHpB +yGbuGGoZX9QySvs52yvAk7TcMOomPxGMwzFvcxlXRqyJyDv8jBLn07Q9 Q==; IronPort-SDR: 08BFDbudq1MaMeOSQQ+Gr+tpOdBaghZBiTJoclI9zpC7I1cY4eavjFCRIGYIm6UxiXKZiGbpCh 5nEss8HtL7INBEMdm9q0dm9ZdiGzxuQDeYYNUGresM574MXNUjSs40GfPn4EeZDM61hp230D75 kp96qCOjdjvkfVtBPmqGyuBgtjq0aNsJOeLu5Dr+3VPNJYAVB4gZHbebABmkrTYdW2swMKek1c nrh19pKH2WaOn+Wxg3inHxnCqCBpPIPzAUyWogmBvnV0OAWuSWAmjfATc078ZFTvTr/SskG9i6 Q80= X-IronPort-AV: E=Sophos;i="5.70,496,1574118000"; d="scan'208";a="22939519" Date: Fri, 28 Feb 2020 13:44:48 +0100 From: Richard Leitner To: Martin Fuzzey CC: , , Shawn Guo , Sascha Hauer , Fabio Estevam , NXP Linux Team , Robin Gong , , Subject: Re: [PATCH] dmaengine: imx-sdma: fix context cache Message-ID: <20200228124448.GA1689606@pcleri> References: <1580305274-27274-1-git-send-email-martin.fuzzey@flowbird.group> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1580305274-27274-1-git-send-email-martin.fuzzey@flowbird.group> X-Originating-IP: [192.168.111.252] X-ClientProxiedBy: sdex3srv.skidata.net (192.168.111.81) To sdex5srv.skidata.net (192.168.111.83) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Wed, Jan 29, 2020 at 02:40:06PM +0100, Martin Fuzzey wrote: > There is a DMA problem with the serial ports on i.MX6. > > When the following sequence is performed: > > 1) Open a port > 2) Write some data > 3) Close the port > 4) Open a *different* port > 5) Write some data > 6) Close the port > > The second write sends nothing and the second close hangs. > If the first close() is omitted it works. > > Adding logs to the the UART driver shows that the DMA is being setup but > the callback is never invoked for the second write. > > This used to work in 4.19. > > Git bisect leads to: > ad0d92d: "dmaengine: imx-sdma: refine to load context only once" > > This commit adds a "context_loaded" flag used to avoid unnecessary context > setups. > However the flag is only reset in sdma_channel_terminate_work(), > which is only invoked in a worker triggered by sdma_terminate_all() IF > there is an active descriptor. > > So, if no active descriptor remains when the channel is terminated, the > flag is not reset and, when the channel is later reused the old context > is used. > > Fix the problem by always resetting the flag in sdma_free_chan_resources(). > > Fixes: ad0d92d: "dmaengine: imx-sdma: refine to load context only once" > Cc: stable@vger.kernel.org > Signed-off-by: Martin Fuzzey > Thanks for the patch! We were chasing this issue for days and just found your patch as we were preparing our (quite similar) solution for submission ;-) I've successfully tested your patch on a custom i.MX6Solo board. Therefore feel free to add Tested-by: Richard Leitner regards;rl