Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752907AbbHCJah (ORCPT ); Mon, 3 Aug 2015 05:30:37 -0400 Received: from mail-bl2on0116.outbound.protection.outlook.com ([65.55.169.116]:15200 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751756AbbHCJaf convert rfc822-to-8bit (ORCPT ); Mon, 3 Aug 2015 05:30:35 -0400 From: Chen Bough To: Jiri Slaby CC: Ulf Hansson , "linux-mmc@vger.kernel.org" , Linux kernel mailing list Subject: RE: [SHDCI] Heavy (thousands) DMA leaks Thread-Topic: [SHDCI] Heavy (thousands) DMA leaks Thread-Index: AQHQyqqR5WQwDKgF90uqPM+msnFdIp35/zHA Date: Mon, 3 Aug 2015 09:30:33 +0000 Message-ID: References: <55B9EF02.7040404@suse.cz> In-Reply-To: <55B9EF02.7040404@suse.cz> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: suse.cz; dkim=none (message not signed) header.d=none; x-originating-ip: [123.151.195.51] x-microsoft-exchange-diagnostics: 1;BY1PR03MB1387;5:oXJUHDbpkzDxs/UuUf6Jvyqd20SkSWc2VzUWzNMueeS6OPE3u1CIRouHzugdNuzwxD5sbrAQnsk34Hb7sGYRIP7GL/w4VcfZNO687WjljNBXW4goiaQ9BN3pNTy3CA8xKoKqe1Z+1w5jul531cJfSQ==;24:4OGnZOV4wxv323zU/Byet09BNYSFnGG507v6TOJXdRW1/u+QR55N3O2ccx135WbF8+ue4W/Zv2EkFYKp4s0NWSM19DSCz7pwFWSvyW7S9NE=;20:fWS3ERcBCso0qyxFhL9apUhGyeqM8oLYaNDujKiK4axY7i9hOUJhco2gzXmXSUCgmgmyamWYo+p32Ep0+Ny/zA== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1387; 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:BY1PR03MB1387;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1387; x-forefront-prvs: 0657D528EC x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(479174004)(377454003)(13464003)(110136002)(92566002)(86362001)(76176999)(54356999)(46102003)(76576001)(77156002)(62966003)(50986999)(5002640100001)(5001960100002)(189998001)(106116001)(122556002)(87936001)(99286002)(19580395003)(77096005)(19580405001)(5003600100002)(40100003)(66066001)(74316001)(33656002)(2656002)(2900100001)(2950100001)(102836002);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR03MB1387;H:BY1PR03MB1388.namprd03.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Aug 2015 09:30:33.2520 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR03MB1387 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3868 Lines: 90 Hi Js, I carefully review my patch, all the DMA memory mapped in sdhci_pre_req() is unmapped in sdhci_post_req. Can you provide the method of your testing DMA leaks? You said over 4000 leaked mappings during one card transfer, if true, We can't map any dma memory after some sd transfer, do you meet this? Best Regards Haibo Chen > -----Original Message----- > From: Jiri Slaby [mailto:jslaby@suse.cz] > Sent: Thursday, July 30, 2015 5:32 PM > To: Chen Haibo-B51421 > Cc: Ulf Hansson; linux-mmc@vger.kernel.org; Linux kernel mailing list > Subject: [SHDCI] Heavy (thousands) DMA leaks > > Hi, > > after > commit 348487cb28e66b032bae1b38424d81bf5b444408 > Author: Haibo Chen > Date: Tue Dec 9 17:04:05 2014 +0800 > > mmc: sdhci: use pipeline mmc requests to improve performance > > I see heavy DMA leaks which result in warnings of the dma api debug code: > WARNING: CPU: 0 PID: 0 at lib/dma-debug.c:509 add_dma_entry+0x138/0x150() > DMA-API: exceeded 7 overlapping mappings of cacheline 0x000000000b20ec00 > > > > And mainly this one upon sdhci module removal. It is over 4000 leaked > mappings during one card transfer. > mmc0: card e624 removed > ------------[ cut here ]------------ > WARNING: CPU: 2 PID: 1263 at lib/dma-debug.c:974 > dma_debug_device_change+0x158/0x1c0() > pci 0000:02:00.0: DMA-API: device driver has pending DMA allocations > while released from device [count=4041] One of leaked entries details: > [device address=0x00000000ddff0000] > [size=65536 bytes] [mapped with DMA_FROM_DEVICE] [mapped as scather- > gather] Modules linked in: > CPU: 2 PID: 1263 Comm: bash Tainted: G W 4.2.0-rc4 #12 > Hardware name: LENOVO 23252SG/23252SG, BIOS G2ET33WW (1.13 ) 07/24/2012 > ffffffff81cc5e32 ffff8800d03c3b68 ffffffff81820938 0000000000000000 > ffff8800d03c3bb8 ffff8800d03c3ba8 ffffffff810b827a 0000000100260021 > ffff88030e500000 0000000000000fc9 ffff88030d95aeb8 ffff88030e4ddd68 Call > Trace: > [] dump_stack+0x4c/0x6e [] > warn_slowpath_common+0x8a/0xc0 [] > warn_slowpath_fmt+0x46/0x50 [] > dma_debug_device_change+0x158/0x1c0 > [] notifier_call_chain+0x4d/0x80 [] > __blocking_notifier_call_chain+0x4d/0x70 > [] blocking_notifier_call_chain+0x16/0x20 > [] __device_release_driver+0x105/0x130 > [] device_release_driver+0x23/0x30 > [] unbind_store+0xba/0xe0 [] ? > kernfs_fop_write+0xe8/0x170 [] > drv_attr_store+0x24/0x30 [] sysfs_kf_write+0x3a/0x50 > [] kernfs_fop_write+0x120/0x170 [] > __vfs_write+0x28/0xe0 [] ? __sb_start_write+0x49/0xe0 > [] ? local_clock+0x25/0x30 [] > vfs_write+0xa1/0x170 [] ? vtime_account_user+0x54/0x60 > [] SyS_write+0x46/0xa0 [] ? > context_tracking_user_exit+0x13/0x20 > [] entry_SYSCALL_64_fastpath+0x12/0x6a > ---[ end trace 398181ad32332b33 ]--- > Mapped at: > [] debug_dma_map_sg+0x122/0x140 [] > sdhci_pre_dma_transfer+0xc3/0x1b0 [] > sdhci_pre_req+0x42/0x70 [] mmc_pre_req+0x42/0x60 > [] mmc_start_req+0x3e/0x400 > > I already fixed one symptom -- memory corruption. Could you revisit the > commit once again, as there is surely at least one more bug? > > thanks, > -- > js > suse labs -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/