diff mbox series

[2/2] mmc: cavium: Add the missing dma unmap when the dma has finished.

Message ID 20190726023049.27055-3-haokexin@gmail.com (mailing list archive)
State New, archived
Headers show
Series mmc: cavium: Fix two calltraces when the | expand

Commit Message

Kevin Hao July 26, 2019, 2:30 a.m. UTC
This fixes the below calltrace when the CONFIG_DMA_API_DEBUG is enabled.
  DMA-API: thunderx_mmc 0000:01:01.4: cpu touching an active dma mapped cacheline [cln=0x000000002fdf9800]
  WARNING: CPU: 21 PID: 1 at kernel/dma/debug.c:596 debug_dma_assert_idle+0x1f8/0x270
  Modules linked in:
  CPU: 21 PID: 1 Comm: init Not tainted 5.3.0-rc1-next-20190725-yocto-standard+ #64
  Hardware name: Marvell OcteonTX CN96XX board (DT)
  pstate: 80400009 (Nzcv daif +PAN -UAO)
  pc : debug_dma_assert_idle+0x1f8/0x270
  lr : debug_dma_assert_idle+0x1f8/0x270
  sp : ffff0000113cfc10
  x29: ffff0000113cfc10 x28: 0000ffff8c880000
  x27: ffff800bc72a0000 x26: ffff000010ff8000
  x25: ffff000010ff8940 x24: ffff000010ff8968
  x23: 0000000000000000 x22: ffff000010e83700
  x21: ffff000010ea2000 x20: ffff000010e835c8
  x19: ffff800bc2c73300 x18: ffffffffffffffff
  x17: 0000000000000000 x16: 0000000000000000
  x15: ffff000010e835c8 x14: 6d20616d64206576
  x13: 69746361206e6120 x12: 676e696863756f74
  x11: 20757063203a342e x10: 31303a31303a3030
  x9 : 303020636d6d5f78 x8 : 3230303030303030
  x7 : 00000000000002fd x6 : ffff000010fd57d0
  x5 : 0000000000000000 x4 : ffff0000106c5210
  x3 : 00000000ffffffff x2 : 0000800bee9c0000
  x1 : 57d5843f4aa62800 x0 : 0000000000000000
  Call trace:
   debug_dma_assert_idle+0x1f8/0x270
   wp_page_copy+0xb0/0x688
   do_wp_page+0xa8/0x5b8
   __handle_mm_fault+0x600/0xd00
   handle_mm_fault+0x118/0x1e8
   do_page_fault+0x200/0x500
   do_mem_abort+0x50/0xb0
   el0_da+0x20/0x24
  ---[ end trace a005534bd23e109f ]---
  DMA-API: Mapped at:
   debug_dma_map_sg+0x94/0x350
   cvm_mmc_request+0x3c4/0x988
   __mmc_start_request+0x9c/0x1f8
   mmc_start_request+0x7c/0xb0
   mmc_blk_mq_issue_rq+0x5c4/0x7b8

Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
 drivers/mmc/host/cavium.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Ulf Hansson Aug. 2, 2019, 3:16 p.m. UTC | #1
On Fri, 26 Jul 2019 at 04:32, Kevin Hao <haokexin@gmail.com> wrote:
>
> This fixes the below calltrace when the CONFIG_DMA_API_DEBUG is enabled.
>   DMA-API: thunderx_mmc 0000:01:01.4: cpu touching an active dma mapped cacheline [cln=0x000000002fdf9800]
>   WARNING: CPU: 21 PID: 1 at kernel/dma/debug.c:596 debug_dma_assert_idle+0x1f8/0x270
>   Modules linked in:
>   CPU: 21 PID: 1 Comm: init Not tainted 5.3.0-rc1-next-20190725-yocto-standard+ #64
>   Hardware name: Marvell OcteonTX CN96XX board (DT)
>   pstate: 80400009 (Nzcv daif +PAN -UAO)
>   pc : debug_dma_assert_idle+0x1f8/0x270
>   lr : debug_dma_assert_idle+0x1f8/0x270
>   sp : ffff0000113cfc10
>   x29: ffff0000113cfc10 x28: 0000ffff8c880000
>   x27: ffff800bc72a0000 x26: ffff000010ff8000
>   x25: ffff000010ff8940 x24: ffff000010ff8968
>   x23: 0000000000000000 x22: ffff000010e83700
>   x21: ffff000010ea2000 x20: ffff000010e835c8
>   x19: ffff800bc2c73300 x18: ffffffffffffffff
>   x17: 0000000000000000 x16: 0000000000000000
>   x15: ffff000010e835c8 x14: 6d20616d64206576
>   x13: 69746361206e6120 x12: 676e696863756f74
>   x11: 20757063203a342e x10: 31303a31303a3030
>   x9 : 303020636d6d5f78 x8 : 3230303030303030
>   x7 : 00000000000002fd x6 : ffff000010fd57d0
>   x5 : 0000000000000000 x4 : ffff0000106c5210
>   x3 : 00000000ffffffff x2 : 0000800bee9c0000
>   x1 : 57d5843f4aa62800 x0 : 0000000000000000
>   Call trace:
>    debug_dma_assert_idle+0x1f8/0x270
>    wp_page_copy+0xb0/0x688
>    do_wp_page+0xa8/0x5b8
>    __handle_mm_fault+0x600/0xd00
>    handle_mm_fault+0x118/0x1e8
>    do_page_fault+0x200/0x500
>    do_mem_abort+0x50/0xb0
>    el0_da+0x20/0x24
>   ---[ end trace a005534bd23e109f ]---
>   DMA-API: Mapped at:
>    debug_dma_map_sg+0x94/0x350
>    cvm_mmc_request+0x3c4/0x988
>    __mmc_start_request+0x9c/0x1f8
>    mmc_start_request+0x7c/0xb0
>    mmc_blk_mq_issue_rq+0x5c4/0x7b8
>
> Signed-off-by: Kevin Hao <haokexin@gmail.com>

Applied for fixes and by adding a stable/fixes tag, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/cavium.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mmc/host/cavium.c b/drivers/mmc/host/cavium.c
> index c956813bc6bd..89deb451e0ac 100644
> --- a/drivers/mmc/host/cavium.c
> +++ b/drivers/mmc/host/cavium.c
> @@ -374,6 +374,7 @@ static int finish_dma_single(struct cvm_mmc_host *host, struct mmc_data *data)
>  {
>         data->bytes_xfered = data->blocks * data->blksz;
>         data->error = 0;
> +       dma_unmap_sg(host->dev, data->sg, data->sg_len, get_dma_dir(data));
>         return 1;
>  }
>
> --
> 2.14.4
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/cavium.c b/drivers/mmc/host/cavium.c
index c956813bc6bd..89deb451e0ac 100644
--- a/drivers/mmc/host/cavium.c
+++ b/drivers/mmc/host/cavium.c
@@ -374,6 +374,7 @@  static int finish_dma_single(struct cvm_mmc_host *host, struct mmc_data *data)
 {
 	data->bytes_xfered = data->blocks * data->blksz;
 	data->error = 0;
+	dma_unmap_sg(host->dev, data->sg, data->sg_len, get_dma_dir(data));
 	return 1;
 }