Limiting the thread to Renesas only, again, to discuss the other issue:
On 17.10.2017 06:51, Yoshihiro Shimoda wrote:
Hi Linus-san,
From: Linus Walleij, Sent: Monday, October 16, 2017 9:22 PM
On Mon, Oct 16, 2017 at 2:07 PM, Geert Uytterhoeven
<geert@xxxxxxxxxxxxxx> wrote:
On Mon, Oct 16, 2017 at 1:41 PM, Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
On Mon, Oct 16, 2017 at 11:02 AM, Geert Uytterhoeven
<geert@xxxxxxxxxxxxxx> wrote:
IIUC,
- Since the MMC_BOUNCE disappeared in v4.14-rc1, the MMC core will request a command with 64kbyte+ size.
- So, swiotlb will got request 64kbyte+ size. This is different with previous version.
Other people reported problems with that. Sorry about this...
This problem should be solved by upstream
commit de3ee99b097dd51938276e3af388cd4ad0f2750a
"mmc: Delete bounce buffer handling"
I just killed off the bounce buffers so they can't hurt anyone anymore.
Can you check that you have this patch in your tree?
Given Dirk saw the issue with v4.14-rc4, I'm afraid that patch is already
included :-(
So the first issue is definately gone.
Then it seems the driver is specifying to high ->max_seg_size
since the buffer cannot be mapped?
Unless you're using ADMA drivers/mmc/host/sdhci.c sets it as:
mmc->max_seg_size = mmc->max_req_size;
Thank you for the comment!
On R-Car Gen3, it's using drivers/mmc/host/renesas_sdhi_internal_dmac.c,
and sets the max_seg_size to very big size (0xffffffff * 512) now...
So, I modified the value to 262144 and rebase the kernel to v4.14-rc5
(-rc4 seems have other issue in block driver.), the "swiotlb buffer is full" issue disappeared.
And:
mmc->max_req_size = 524288;
renesas_sdhi_internal_dmac ee100000.sd: swiotlb_tbl_map_single: test:
size modified to 524288 bytes
renesas_sdhi_internal_dmac ee100000.sd: swiotlb buffer is full (sz:
524288 bytes)
So if your driver cannot handle 524288 bytes, why is it saying it can
handle 524288 bytes?
I think the "swiotlb buffer is full" came from lib/swiotlb.c.
I'm not sure the detail of swiotlb.c, but IIUC, it has a memory size limitation.
- In lib/swiotlb.c, it calculates nslots.
- The size of one slot is 2048 bytes because IO_TLB_SHIFT in include/linux/swiotlb.h is set to 11.
- IO_TLB_SEGSIZE is set to 128 in include/linux/swiotlb.h.
- This value is number of maximum slots.
- So, maximum size for a single map of swiotlb is 256kbytes (2048 * 128).
So, I will submit a patch to set the max_req_size to 256kbytes today.
Great, many thanks! I'll try to test that in the next days, then.
While above fixes the swiotlb full issue, we still have the issue that
it looks like the driver doesn't handle that issue correctly and
crashes, then:
renesas_sdhi_internal_dmac ee100000.sd: DMA: Out of SW-IOMMU space for
524288 bytes
-> Unable to handle kernel paging request at virtual address
ffffffffc0000000 <-
I'd propose to fix that, too. Have you looked into that issue, too?
I'm no expert on this, but it looks to me that other drivers are
checking the return value of dma_map_sg() differently?
ret = dma_map_sg(&host->pdev->dev, sg, host->sg_len, dir);
if (ret < 0)
return;
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/mmc/host/renesas_sdhi_internal_dmac.c#n165
They check for (ret == 0)?
Sorry if I'm wrong on that ;)
Best regards
Dirk