From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Szyprowski Subject: RE: [PATCHv8 04/10] ARM: dma-mapping: remove offset parameter to prepare for generic dma_ops Date: Wed, 11 Apr 2012 15:05:58 +0200 Message-ID: <014901cd17e3$d67d18b0$83774a10$%szyprowski@samsung.com> References: <1334055852-19500-1-git-send-email-m.szyprowski@samsung.com> <201204101143.27915.arnd@arndb.de> <012e01cd17db$5f165c30$1d431490$%szyprowski@samsung.com> <201204111218.39800.arnd@arndb.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT Return-path: In-reply-to: <201204111218.39800.arnd@arndb.de> Content-language: pl Sender: owner-linux-mm@kvack.org To: 'Arnd Bergmann' Cc: linux-arm-kernel@lists.infradead.org, linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, iommu@lists.linux-foundation.org, 'Kyungmin Park' , 'Joerg Roedel' , 'Russell King - ARM Linux' , 'Chunsang Jeong' , 'Krishna Reddy' , 'KyongHo Cho' , Andrzej Pietrasiewicz , 'Benjamin Herrenschmidt' , 'Konrad Rzeszutek Wilk' , 'Hiroshi Doyu' , 'Subash Patel' List-Id: linux-arch.vger.kernel.org Hi Arnd, On Wednesday, April 11, 2012 2:19 PM Arnd Bergmann wrote: > On Wednesday 11 April 2012, Marek Szyprowski wrote: > > Well, range sync functions are available from the early days of the dma > > mapping api (at least that's what I've found reading the change log and > > old patches). They are the correct way of doing a partial syncs on the > > buffer (usually used by the network device drivers). This patch changes > > only the internal implementation of the dma bounce functions to let > > them tunnel through dma_map_ops structure. The driver api stays > > unchanged, so driver are obliged to call dma_*_range_* functions to > > keep code clean and easy to understand. > > > > The only drawback I can see from this patch is reduced detection of > > the dma api abuse. Let us consider the following code: > > > > dma_addr = dma_map_single(dev, ptr, 64, DMA_TO_DEVICE); > > dma_sync_single_range_for_cpu(dev, dma_addr+16, 0, 32, DMA_TO_DEVICE); > > > > Without the patch such code fails, because dma bounce code is unable > > to find the bounce buffer for the given dma_address. After the patch > > the sync call will be equivalent to: > > > > dma_sync_single_range_for_cpu(dev, dma_addr, 16, 32, DMA_TO_DEVICE); > > > > which succeeds. > > > > I don't consider this as a real problem. DMA API abuse should be caught > > by debug_dma_* function family, so we can simplify the internal low-level > > implementation without losing anything. > > > > Ok, fair enough. Can you put the above text into the changelog? Yes, I will update it in the next release. Best regards -- Marek Szyprowski Samsung Poland R&D Center -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout3.w1.samsung.com ([210.118.77.13]:49027 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753057Ab2DKNGF (ORCPT ); Wed, 11 Apr 2012 09:06:05 -0400 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii Received: from euspt1 ([210.118.77.13]) by mailout3.w1.samsung.com (Sun Java(tm) System Messaging Server 6.3-8.04 (built Jul 29 2009; 32bit)) with ESMTP id <0M2B001UXGDIP300@mailout3.w1.samsung.com> for linux-arch@vger.kernel.org; Wed, 11 Apr 2012 14:05:42 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0M2B00G9WGE28X@spt1.w1.samsung.com> for linux-arch@vger.kernel.org; Wed, 11 Apr 2012 14:06:02 +0100 (BST) Date: Wed, 11 Apr 2012 15:05:58 +0200 From: Marek Szyprowski Subject: RE: [PATCHv8 04/10] ARM: dma-mapping: remove offset parameter to prepare for generic dma_ops In-reply-to: <201204111218.39800.arnd@arndb.de> Message-ID: <014901cd17e3$d67d18b0$83774a10$%szyprowski@samsung.com> Content-language: pl References: <1334055852-19500-1-git-send-email-m.szyprowski@samsung.com> <201204101143.27915.arnd@arndb.de> <012e01cd17db$5f165c30$1d431490$%szyprowski@samsung.com> <201204111218.39800.arnd@arndb.de> Sender: linux-arch-owner@vger.kernel.org List-ID: To: 'Arnd Bergmann' Cc: linux-arm-kernel@lists.infradead.org, linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, iommu@lists.linux-foundation.org, 'Kyungmin Park' , 'Joerg Roedel' , 'Russell King - ARM Linux' , 'Chunsang Jeong' , 'Krishna Reddy' , 'KyongHo Cho' , Andrzej Pietrasiewicz , 'Benjamin Herrenschmidt' , 'Konrad Rzeszutek Wilk' , 'Hiroshi Doyu' , 'Subash Patel' Message-ID: <20120411130558.N2IOLC00jiY_hnBftMhGIPSk7AG-qL4MZGvYrmB0OY8@z> Hi Arnd, On Wednesday, April 11, 2012 2:19 PM Arnd Bergmann wrote: > On Wednesday 11 April 2012, Marek Szyprowski wrote: > > Well, range sync functions are available from the early days of the dma > > mapping api (at least that's what I've found reading the change log and > > old patches). They are the correct way of doing a partial syncs on the > > buffer (usually used by the network device drivers). This patch changes > > only the internal implementation of the dma bounce functions to let > > them tunnel through dma_map_ops structure. The driver api stays > > unchanged, so driver are obliged to call dma_*_range_* functions to > > keep code clean and easy to understand. > > > > The only drawback I can see from this patch is reduced detection of > > the dma api abuse. Let us consider the following code: > > > > dma_addr = dma_map_single(dev, ptr, 64, DMA_TO_DEVICE); > > dma_sync_single_range_for_cpu(dev, dma_addr+16, 0, 32, DMA_TO_DEVICE); > > > > Without the patch such code fails, because dma bounce code is unable > > to find the bounce buffer for the given dma_address. After the patch > > the sync call will be equivalent to: > > > > dma_sync_single_range_for_cpu(dev, dma_addr, 16, 32, DMA_TO_DEVICE); > > > > which succeeds. > > > > I don't consider this as a real problem. DMA API abuse should be caught > > by debug_dma_* function family, so we can simplify the internal low-level > > implementation without losing anything. > > > > Ok, fair enough. Can you put the above text into the changelog? Yes, I will update it in the next release. Best regards -- Marek Szyprowski Samsung Poland R&D Center