RE: [RFC] sdhci: fix DMA leaks [was: [SHDCI] Heavy (thousands) DMA leaks]

Chen Bough
2015-08-06T07:42:53Z

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1788 bytes --]

Hi Js,

I read your attached log and patch, yes, dma memory leak will happen when
more than one pre_request execute. The method of ++next->cookie is not good,
your patch seems good, but I still need some time to test the patch, because
you unmap the dma in sdhci_finish_data rather than the sdhci_post_req.

Anyway, thanks for report and debug this issue. I will give you my test result
ASAP.

Best Regards
Haibo Chen

> -----Original Message-----
> From: Jiri Slaby [mailto:jslaby@suse.cz]
> Sent: Wednesday, August 05, 2015 11:12 PM
> To: Chen Haibo-B51421; Ulf Hansson
> Cc: linux-mmc@vger.kernel.org; Linux kernel mailing list
> Subject: [RFC] sdhci: fix DMA leaks [was: [SHDCI] Heavy (thousands) DMA
> leaks]
>
> On 08/05/2015, 01:52 PM, Jiri Slaby wrote:
> >> Yes, I see:
> >> sdhci-pci 0000:02:00.0: swiotlb buffer is full (sz: 65536 bytes)
> >> after some time. The driver falls back to non-DMA transfers after that.
> >> It also generates a warning about that:
> >> WARNING: CPU: 0 PID: 0 at drivers/mmc/host/sdhci.c:857
> >> sdhci_prepare_data+0x8ec/0x900 [sdhci]()
> >
> > I am attaching a debug patch and a debug log. You can see where
> > 0x00000000fffb0000 and 0x00000000fffe0000 is leaked. It is when
> > 'invalid cookie' error happens.
>
> And you could see the cookie handling is totally bogus.
>
> With this rewrite, I no longer see the problems. Could you confirm it
> still does the good job with respect to performance -- the numbers you
> mentioned in your commit.
>
> Ulf, what do you think about the attached patch? (Do not look at the
> commented info prints.)
>
> thanks,
> --
> js
> suse labs
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éÝ¶\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dÊ‡Ú™ë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥