From patchwork Mon Jun 21 07:00:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 12333893 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71416C49EA2 for ; Mon, 21 Jun 2021 07:00:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 58DEE600D3 for ; Mon, 21 Jun 2021 07:00:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229621AbhFUHCs (ORCPT ); Mon, 21 Jun 2021 03:02:48 -0400 Received: from www.zeus03.de ([194.117.254.33]:56952 "EHLO mail.zeus03.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229597AbhFUHCo (ORCPT ); Mon, 21 Jun 2021 03:02:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=k1; bh=A9dRsXCaYnIasu+H+nbPiLdt0Rm bsXpIzdZ6dEsD4JA=; b=HbFbCXLo19D5ytdfWRObIuU7jALT/0KGcVbkEltCoQU WUuB7rMaj+9e01fqMXku3uyKYm80CVDPxDPPMx5FgvTZjGXzVeJK6lqOxwwDE8SL ekfcWMpDNqYyxULwG/UEs5ir9fivBoqpO4ARxAg05U4v9kBGJgNfEo7vCQrS46ko = Received: (qmail 1651335 invoked from network); 21 Jun 2021 09:00:18 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 21 Jun 2021 09:00:18 +0200 X-UD-Smtp-Session: l3s3148p1@7cClOUHF7r8gAwDPXwSyANzZOjko0laY From: Wolfram Sang To: linux-mmc@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Wolfram Sang , Geert Uytterhoeven Subject: [PATCH] mmc: renesas_sdhi: sys_dmac: abort DMA synced to avoid timeouts Date: Mon, 21 Jun 2021 09:00:09 +0200 Message-Id: <20210621070009.13655-1-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org When aborting DMA, we terminate the transfer without waiting for it to succeed. This may lead to races which can e.g. lead to timeout problems when tuning. Remove the deprecated dmaengine_terminate_all() function and use the explicit dmaengine_terminate_sync(). Fixes: e3de2be7368d ("mmc: tmio_mmc: fix card eject during IO with DMA") Reported-by: Geert Uytterhoeven Signed-off-by: Wolfram Sang --- Geert, this fixes the issue you have seen on your Koelsch board on my Lager board. Can you test again with this patch please? I noticed that Renesas driver are quite an active user of this deprecated dmaengine function. I will audit and improve the other drivers meanwhile. drivers/mmc/host/renesas_sdhi_sys_dmac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/renesas_sdhi_sys_dmac.c b/drivers/mmc/host/renesas_sdhi_sys_dmac.c index ffa64211f4de..6956b83469c8 100644 --- a/drivers/mmc/host/renesas_sdhi_sys_dmac.c +++ b/drivers/mmc/host/renesas_sdhi_sys_dmac.c @@ -108,9 +108,9 @@ static void renesas_sdhi_sys_dmac_abort_dma(struct tmio_mmc_host *host) renesas_sdhi_sys_dmac_enable_dma(host, false); if (host->chan_rx) - dmaengine_terminate_all(host->chan_rx); + dmaengine_terminate_sync(host->chan_rx); if (host->chan_tx) - dmaengine_terminate_all(host->chan_tx); + dmaengine_terminate_sync(host->chan_tx); renesas_sdhi_sys_dmac_enable_dma(host, true); }