Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753899AbbHFHmx (ORCPT ); Thu, 6 Aug 2015 03:42:53 -0400 Received: from mail-bl2on0121.outbound.protection.outlook.com ([65.55.169.121]:65332 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752806AbbHFHmv (ORCPT ); Thu, 6 Aug 2015 03:42:51 -0400 From: Chen Bough To: Jiri Slaby , Ulf Hansson CC: "linux-mmc@vger.kernel.org" , "Linux kernel mailing list" Subject: RE: [RFC] sdhci: fix DMA leaks [was: [SHDCI] Heavy (thousands) DMA leaks] Thread-Topic: [RFC] sdhci: fix DMA leaks [was: [SHDCI] Heavy (thousands) DMA leaks] Thread-Index: AQHQz5EPYBUedJp7gE2YIrmK3qyoMZ3+lGog Date: Thu, 6 Aug 2015 07:42:46 +0000 Message-ID: References: <55B9EF02.7040404@suse.cz> <55BF36D6.4080504@suse.cz> <55C1F919.4080002@suse.cz> <55C227B4.3030102@suse.cz> In-Reply-To: <55C227B4.3030102@suse.cz> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Haibo.Chen@freescale.com; x-originating-ip: [199.59.226.141] x-microsoft-exchange-diagnostics: 1;BY1PR03MB1386;5:jJ0oSoiRlsNijvGA8MWNryFmoG2ByI/zo+9tFDKJKI3e3hfY7vxq5OprwGRWWEFMzRAMMOsD+WZwNt6XAw5QfS4FqWRzldHiIL9gTh0gYVkqHlysgjfqIgJw6ui/MSN9Gmahy1UUlyILuRxOA7Cp6w==;24:ujBsUFIMhMH9jitTHZe5Ya6bg5iAmxTlh/tg1u2yhFLxorpilotibug6dEWxyeDZ34NlDsLgShkzY2GH/wOcMzBFgI40eteG7HG+1NOmVnc=;20:YAJc3OYTXUZi3sjz7LX4AtOa/Zade/j6LUs6pgZjsPbKCcYY9KVXoHuXUmqaaiPvVPAVU0Eov7HMMQV3ZMic0g== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1386;UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1514; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:BY1PR03MB1386;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1386; x-forefront-prvs: 06607E485E x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(479174004)(189002)(13464003)(76104003)(24454002)(52314003)(199003)(377454003)(99286002)(87936001)(92566002)(5001960100002)(81156007)(4001540100001)(97736004)(5001770100001)(2656002)(66066001)(64706001)(5001830100001)(40100003)(5001860100001)(101416001)(77156002)(74316001)(62966003)(93886004)(106116001)(54356999)(76176999)(106356001)(46102003)(50986999)(105586002)(122556002)(19580395003)(19580405001)(68736005)(33656002)(77096005)(5890100001)(2950100001)(2900100001)(76576001)(102836002)(86362001)(5003600100002)(10400500002)(189998001)(5002640100001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR03MB1386;H:BY1PR03MB1388.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Aug 2015 07:42:46.7535 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR03MB1386 X-Microsoft-Exchange-Diagnostics: 1;BY1PR03MB1514;2:ZltMzX5XM2oW+93sLrLiVY4qC/CLt6qen1/y4D0wOq84i9gH8MSxYWLyCj7RmRg6IP8iYRVfTD8bR5l9dieINPQPa06iRtg6QTeiOGkOa0wIW/PzW2EP46SGrqdHMziCNkpVrTsQBk5BNoE0I96G7D6EQZkfgVrXnkJGzAB5yGM=;3:/UhDffHmIjID73EQgAKY5kzhl66EM7oeTUPpcORzE7thEGtXetrfy/npoSL0H0YgHQZsyu9gG0Im28SGdlRJMqY8Gp4ovtfFzyLdvI/XMygzHqrpfqbPzrhHUhPK6UEaDw0mrNoQeca0AjYIcz6NfA==;25:of4DpHJDb8oGUk1TRlXjs4fdfyzp0YU2Xf/3a5GLLKsVgN7w45XSLRPyYSX7DrkRcvzE1Ex3GLB0dGiibc30WLDFgqOyiIKTVvdzfEnSMEqPH8UjszR7WNn8T3J1ZsyWVfvCoTrnh2EYsk5o3o1QQN0bKUJUk5NdmoBkhtjxccl1S63ni+q68Np6CnQygjyXxq2qeGKS4zIM/R9FzIVxK9M7YczrIpA/lCKmHqJxXiWWEt/lTkaImx7BDDUPxmh2;23:yAmEDcC5sWog2gqq3cQoLZ9Ed+yH8hU1CLCx92+yStviL0M67wjtuhQwBELLpAVD89sNc+XzMzJrVr6kw5BA6AHr6Ba+GmZ44Q6mwkDeE/Rt9xgC3vFC0UB6c4DRqaWLoX/LJRbPL4g8QRDvnBlIqUbKcqX6+NrUIdg3hZD4kaAHdx7fRdCVJ7+dfsOC9y6BDu1o6D/5IftO7AGhRz0fY883AqPkhGRUtG4zd6Tsk9Q4evOdPnUoHLrkX8hXONcm X-OriginatorOrg: freescale.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id t767gxwu013835 Content-Length: 1788 Lines: 48 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?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?