Message ID | 20210621070009.13655-1-wsa+renesas@sang-engineering.com |
---|---|
State | New |
Headers | show |
Series | mmc: renesas_sdhi: sys_dmac: abort DMA synced to avoid timeouts | expand |
Hi Wolfram, On Mon, Jun 21, 2021 at 9:00 AM Wolfram Sang <wsa+renesas@sang-engineering.com> wrote: > 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 <geert+renesas@glider.be> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Thanks for your patch! > Geert, this fixes the issue you have seen on your Koelsch board on my > Lager board. Can you test again with this patch please? Unfortunately it does not fix the issue with my SanDisk Extreme 32GB A1 microSD card in the microSD adapter that came with the card (Conrad 1553726): [ 201.590669] sh_mobile_sdhi ee100000.mmc: timeout waiting for hardware interrupt (CMD19) [ 206.710441] sh_mobile_sdhi ee100000.mmc: timeout waiting for hardware interrupt (CMD19) [ 211.830215] sh_mobile_sdhi ee100000.mmc: timeout waiting for hardware interrupt (CMD19) [ 216.949986] sh_mobile_sdhi ee100000.mmc: timeout waiting for hardware interrupt (CMD19) [ 222.069747] sh_mobile_sdhi ee100000.mmc: timeout waiting for hardware interrupt (CMD19) [ 227.189509] sh_mobile_sdhi ee100000.mmc: timeout waiting for hardware interrupt (CMD19) (switching slot) [ 227.230383] mmc0: tuning execution failed: -5 [ 227.234812] mmc0: error -5 whilst initialising SD card [ 238.628970] sh_mobile_sdhi ee140000.mmc: timeout waiting for hardware interrupt (CMD52) [ 243.748755] sh_mobile_sdhi ee140000.mmc: timeout waiting for hardware interrupt (CMD52) [ 248.868475] sh_mobile_sdhi ee140000.mmc: timeout waiting for hardware interrupt (CMD0) [ 253.988234] sh_mobile_sdhi ee140000.mmc: timeout waiting for hardware interrupt (CMD8) [ 259.107995] sh_mobile_sdhi ee140000.mmc: timeout waiting for hardware interrupt (CMD5) [ 264.227746] sh_mobile_sdhi ee140000.mmc: timeout waiting for hardware interrupt (CMD5) [ 269.347563] sh_mobile_sdhi ee140000.mmc: timeout waiting for hardware interrupt (CMD5) [ 274.468165] sh_mobile_sdhi ee140000.mmc: timeout waiting for hardware interrupt (CMD5) [ 278.558584] sh_mobile_sdhi ee160000.mmc: timeout waiting for hardware interrupt (CMD52) [ 279.588686] sh_mobile_sdhi ee140000.mmc: timeout waiting for hardware interrupt (CMD55) [ 283.679075] sh_mobile_sdhi ee160000.mmc: timeout waiting for hardware interrupt (CMD52) [ 284.709164] sh_mobile_sdhi ee140000.mmc: timeout waiting for hardware interrupt (CMD55) [ 288.789522] sh_mobile_sdhi ee160000.mmc: timeout waiting for hardware interrupt (CMD0) [ 289.829596] sh_mobile_sdhi ee140000.mmc: timeout waiting for hardware interrupt (CMD55) [ 293.909915] sh_mobile_sdhi ee160000.mmc: timeout waiting for hardware interrupt (CMD8) [ 294.949984] sh_mobile_sdhi ee140000.mmc: timeout waiting for hardware interrupt (CMD55) The same card works before/after on Salvator-XS with R-Car H3ES2.0. Tree is renesas-devel-2021-06-21-v5.13-rc7 without/with your patch. Gr{oetje,eeting}s, Geert
While the patch does not fix the timeout issue (also verified using an Alt board), it does fix this follow-up issue here: [ 191.485194] ------------[ cut here ]------------ [ 191.490296] WARNING: CPU: 0 PID: 698 at kernel/dma/debug.c:498 add_dma_entry+0x158/0x180 [ 191.499397] DMA-API: exceeded 7 overlapping mappings of cacheline 0x0117cc3a So, I think we want this patch nonetheless but I need to rephrase the commit message.
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); }
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 <geert+renesas@glider.be> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- 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(-)