From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965316AbbBBWgO (ORCPT ); Mon, 2 Feb 2015 17:36:14 -0500 Received: from mail-ie0-f178.google.com ([209.85.223.178]:63435 "EHLO mail-ie0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755100AbbBBWgL (ORCPT ); Mon, 2 Feb 2015 17:36:11 -0500 MIME-Version: 1.0 In-Reply-To: <20150202214616.GI8656@n2100.arm.linux.org.uk> References: <1422347154-15258-1-git-send-email-sumit.semwal@linaro.org> <1422347154-15258-2-git-send-email-sumit.semwal@linaro.org> <20150129143908.GA26493@n2100.arm.linux.org.uk> <20150129154718.GB26493@n2100.arm.linux.org.uk> <20150129192610.GE26493@n2100.arm.linux.org.uk> <20150202165405.GX14009@phenom.ffwll.local> <20150202214616.GI8656@n2100.arm.linux.org.uk> Date: Mon, 2 Feb 2015 17:36:10 -0500 Message-ID: Subject: Re: [RFCv3 2/2] dma-buf: add helpers for sharing attacher constraints with dma-parms From: Rob Clark To: Russell King - ARM Linux Cc: Sumit Semwal , LKML , "linux-media@vger.kernel.org" , DRI mailing list , Linaro MM SIG Mailman List , "linux-arm-kernel@lists.infradead.org" , "linux-mm@kvack.org" , Linaro Kernel Mailman List , Tomasz Stanislawski , Robin Murphy , Marek Szyprowski , Daniel Vetter Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 2, 2015 at 4:46 PM, Russell King - ARM Linux wrote: > On Mon, Feb 02, 2015 at 03:30:21PM -0500, Rob Clark wrote: >> On Mon, Feb 2, 2015 at 11:54 AM, Daniel Vetter wrote: >> >> My initial thought is for dma-buf to not try to prevent something than >> >> an exporter can actually do.. I think the scenario you describe could >> >> be handled by two sg-lists, if the exporter was clever enough. >> > >> > That's already needed, each attachment has it's own sg-list. After all >> > there's no array of dma_addr_t in the sg tables, so you can't use one sg >> > for more than one mapping. And due to different iommu different devices >> > can easily end up with different addresses. >> >> >> Well, to be fair it may not be explicitly stated, but currently one >> should assume the dma_addr_t's in the dmabuf sglist are bogus. With >> gpu's that implement per-process/context page tables, I'm not really >> sure that there is a sane way to actually do anything else.. > > That's incorrect - and goes dead against the design of scatterlists. yeah, a bit of an abuse, although I'm not sure I see a much better way when a device vaddr depends on user context.. > Not only that, but it is entirely possible that you may get handed > memory via dmabufs for which there are no struct page's associated > with that memory - think about display systems which have their own > video memory which is accessible to the GPU, but it isn't system > memory. well, I guess anyways when it comes to sharing buffers, it won't be the vram placement of the bo that gets shared ;-) BR, -R > In those circumstances, you have to use the dma_addr_t's and not the > pages. > > -- > FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up > according to speedtest.net. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-ie0-f178.google.com ([209.85.223.178]:63435 "EHLO mail-ie0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755100AbbBBWgL (ORCPT ); Mon, 2 Feb 2015 17:36:11 -0500 MIME-Version: 1.0 In-Reply-To: <20150202214616.GI8656@n2100.arm.linux.org.uk> References: <1422347154-15258-1-git-send-email-sumit.semwal@linaro.org> <1422347154-15258-2-git-send-email-sumit.semwal@linaro.org> <20150129143908.GA26493@n2100.arm.linux.org.uk> <20150129154718.GB26493@n2100.arm.linux.org.uk> <20150129192610.GE26493@n2100.arm.linux.org.uk> <20150202165405.GX14009@phenom.ffwll.local> <20150202214616.GI8656@n2100.arm.linux.org.uk> Date: Mon, 2 Feb 2015 17:36:10 -0500 Message-ID: Subject: Re: [RFCv3 2/2] dma-buf: add helpers for sharing attacher constraints with dma-parms From: Rob Clark To: Russell King - ARM Linux Cc: Sumit Semwal , LKML , "linux-media@vger.kernel.org" , DRI mailing list , Linaro MM SIG Mailman List , "linux-arm-kernel@lists.infradead.org" , "linux-mm@kvack.org" , Linaro Kernel Mailman List , Tomasz Stanislawski , Robin Murphy , Marek Szyprowski , Daniel Vetter Content-Type: text/plain; charset=UTF-8 Sender: linux-media-owner@vger.kernel.org List-ID: On Mon, Feb 2, 2015 at 4:46 PM, Russell King - ARM Linux wrote: > On Mon, Feb 02, 2015 at 03:30:21PM -0500, Rob Clark wrote: >> On Mon, Feb 2, 2015 at 11:54 AM, Daniel Vetter wrote: >> >> My initial thought is for dma-buf to not try to prevent something than >> >> an exporter can actually do.. I think the scenario you describe could >> >> be handled by two sg-lists, if the exporter was clever enough. >> > >> > That's already needed, each attachment has it's own sg-list. After all >> > there's no array of dma_addr_t in the sg tables, so you can't use one sg >> > for more than one mapping. And due to different iommu different devices >> > can easily end up with different addresses. >> >> >> Well, to be fair it may not be explicitly stated, but currently one >> should assume the dma_addr_t's in the dmabuf sglist are bogus. With >> gpu's that implement per-process/context page tables, I'm not really >> sure that there is a sane way to actually do anything else.. > > That's incorrect - and goes dead against the design of scatterlists. yeah, a bit of an abuse, although I'm not sure I see a much better way when a device vaddr depends on user context.. > Not only that, but it is entirely possible that you may get handed > memory via dmabufs for which there are no struct page's associated > with that memory - think about display systems which have their own > video memory which is accessible to the GPU, but it isn't system > memory. well, I guess anyways when it comes to sharing buffers, it won't be the vram placement of the bo that gets shared ;-) BR, -R > In those circumstances, you have to use the dma_addr_t's and not the > pages. > > -- > FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up > according to speedtest.net. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ig0-f179.google.com (mail-ig0-f179.google.com [209.85.213.179]) by kanga.kvack.org (Postfix) with ESMTP id 100FB6B006C for ; Mon, 2 Feb 2015 17:36:11 -0500 (EST) Received: by mail-ig0-f179.google.com with SMTP id l13so20449297iga.0 for ; Mon, 02 Feb 2015 14:36:10 -0800 (PST) Received: from mail-ig0-x233.google.com (mail-ig0-x233.google.com. [2607:f8b0:4001:c05::233]) by mx.google.com with ESMTPS id ly5si8452290icb.101.2015.02.02.14.36.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Feb 2015 14:36:10 -0800 (PST) Received: by mail-ig0-f179.google.com with SMTP id l13so20449275iga.0 for ; Mon, 02 Feb 2015 14:36:10 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20150202214616.GI8656@n2100.arm.linux.org.uk> References: <1422347154-15258-1-git-send-email-sumit.semwal@linaro.org> <1422347154-15258-2-git-send-email-sumit.semwal@linaro.org> <20150129143908.GA26493@n2100.arm.linux.org.uk> <20150129154718.GB26493@n2100.arm.linux.org.uk> <20150129192610.GE26493@n2100.arm.linux.org.uk> <20150202165405.GX14009@phenom.ffwll.local> <20150202214616.GI8656@n2100.arm.linux.org.uk> Date: Mon, 2 Feb 2015 17:36:10 -0500 Message-ID: Subject: Re: [RFCv3 2/2] dma-buf: add helpers for sharing attacher constraints with dma-parms From: Rob Clark Content-Type: text/plain; charset=UTF-8 Sender: owner-linux-mm@kvack.org List-ID: To: Russell King - ARM Linux Cc: Sumit Semwal , LKML , "linux-media@vger.kernel.org" , DRI mailing list , Linaro MM SIG Mailman List , "linux-arm-kernel@lists.infradead.org" , "linux-mm@kvack.org" , Linaro Kernel Mailman List , Tomasz Stanislawski , Robin Murphy , Marek Szyprowski , Daniel Vetter On Mon, Feb 2, 2015 at 4:46 PM, Russell King - ARM Linux wrote: > On Mon, Feb 02, 2015 at 03:30:21PM -0500, Rob Clark wrote: >> On Mon, Feb 2, 2015 at 11:54 AM, Daniel Vetter wrote: >> >> My initial thought is for dma-buf to not try to prevent something than >> >> an exporter can actually do.. I think the scenario you describe could >> >> be handled by two sg-lists, if the exporter was clever enough. >> > >> > That's already needed, each attachment has it's own sg-list. After all >> > there's no array of dma_addr_t in the sg tables, so you can't use one sg >> > for more than one mapping. And due to different iommu different devices >> > can easily end up with different addresses. >> >> >> Well, to be fair it may not be explicitly stated, but currently one >> should assume the dma_addr_t's in the dmabuf sglist are bogus. With >> gpu's that implement per-process/context page tables, I'm not really >> sure that there is a sane way to actually do anything else.. > > That's incorrect - and goes dead against the design of scatterlists. yeah, a bit of an abuse, although I'm not sure I see a much better way when a device vaddr depends on user context.. > Not only that, but it is entirely possible that you may get handed > memory via dmabufs for which there are no struct page's associated > with that memory - think about display systems which have their own > video memory which is accessible to the GPU, but it isn't system > memory. well, I guess anyways when it comes to sharing buffers, it won't be the vram placement of the bo that gets shared ;-) BR, -R > In those circumstances, you have to use the dma_addr_t's and not the > pages. > > -- > FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up > according to speedtest.net. -- 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/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 From: robdclark@gmail.com (Rob Clark) Date: Mon, 2 Feb 2015 17:36:10 -0500 Subject: [RFCv3 2/2] dma-buf: add helpers for sharing attacher constraints with dma-parms In-Reply-To: <20150202214616.GI8656@n2100.arm.linux.org.uk> References: <1422347154-15258-1-git-send-email-sumit.semwal@linaro.org> <1422347154-15258-2-git-send-email-sumit.semwal@linaro.org> <20150129143908.GA26493@n2100.arm.linux.org.uk> <20150129154718.GB26493@n2100.arm.linux.org.uk> <20150129192610.GE26493@n2100.arm.linux.org.uk> <20150202165405.GX14009@phenom.ffwll.local> <20150202214616.GI8656@n2100.arm.linux.org.uk> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Mon, Feb 2, 2015 at 4:46 PM, Russell King - ARM Linux wrote: > On Mon, Feb 02, 2015 at 03:30:21PM -0500, Rob Clark wrote: >> On Mon, Feb 2, 2015 at 11:54 AM, Daniel Vetter wrote: >> >> My initial thought is for dma-buf to not try to prevent something than >> >> an exporter can actually do.. I think the scenario you describe could >> >> be handled by two sg-lists, if the exporter was clever enough. >> > >> > That's already needed, each attachment has it's own sg-list. After all >> > there's no array of dma_addr_t in the sg tables, so you can't use one sg >> > for more than one mapping. And due to different iommu different devices >> > can easily end up with different addresses. >> >> >> Well, to be fair it may not be explicitly stated, but currently one >> should assume the dma_addr_t's in the dmabuf sglist are bogus. With >> gpu's that implement per-process/context page tables, I'm not really >> sure that there is a sane way to actually do anything else.. > > That's incorrect - and goes dead against the design of scatterlists. yeah, a bit of an abuse, although I'm not sure I see a much better way when a device vaddr depends on user context.. > Not only that, but it is entirely possible that you may get handed > memory via dmabufs for which there are no struct page's associated > with that memory - think about display systems which have their own > video memory which is accessible to the GPU, but it isn't system > memory. well, I guess anyways when it comes to sharing buffers, it won't be the vram placement of the bo that gets shared ;-) BR, -R > In those circumstances, you have to use the dma_addr_t's and not the > pages. > > -- > FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up > according to speedtest.net. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rob Clark Subject: Re: [RFCv3 2/2] dma-buf: add helpers for sharing attacher constraints with dma-parms Date: Mon, 2 Feb 2015 17:36:10 -0500 Message-ID: References: <1422347154-15258-1-git-send-email-sumit.semwal@linaro.org> <1422347154-15258-2-git-send-email-sumit.semwal@linaro.org> <20150129143908.GA26493@n2100.arm.linux.org.uk> <20150129154718.GB26493@n2100.arm.linux.org.uk> <20150129192610.GE26493@n2100.arm.linux.org.uk> <20150202165405.GX14009@phenom.ffwll.local> <20150202214616.GI8656@n2100.arm.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Return-path: Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by gabe.freedesktop.org (Postfix) with ESMTP id BCB9C6E45B for ; Mon, 2 Feb 2015 14:36:10 -0800 (PST) Received: by mail-ie0-f180.google.com with SMTP id rl12so21001195iec.11 for ; Mon, 02 Feb 2015 14:36:10 -0800 (PST) In-Reply-To: <20150202214616.GI8656@n2100.arm.linux.org.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Russell King - ARM Linux Cc: Linaro Kernel Mailman List , Robin Murphy , LKML , DRI mailing list , Linaro MM SIG Mailman List , "linux-mm@kvack.org" , Marek Szyprowski , Tomasz Stanislawski , "linux-arm-kernel@lists.infradead.org" , "linux-media@vger.kernel.org" List-Id: dri-devel@lists.freedesktop.org T24gTW9uLCBGZWIgMiwgMjAxNSBhdCA0OjQ2IFBNLCBSdXNzZWxsIEtpbmcgLSBBUk0gTGludXgK PGxpbnV4QGFybS5saW51eC5vcmcudWs+IHdyb3RlOgo+IE9uIE1vbiwgRmViIDAyLCAyMDE1IGF0 IDAzOjMwOjIxUE0gLTA1MDAsIFJvYiBDbGFyayB3cm90ZToKPj4gT24gTW9uLCBGZWIgMiwgMjAx NSBhdCAxMTo1NCBBTSwgRGFuaWVsIFZldHRlciA8ZGFuaWVsQGZmd2xsLmNoPiB3cm90ZToKPj4g Pj4gTXkgaW5pdGlhbCB0aG91Z2h0IGlzIGZvciBkbWEtYnVmIHRvIG5vdCB0cnkgdG8gcHJldmVu dCBzb21ldGhpbmcgdGhhbgo+PiA+PiBhbiBleHBvcnRlciBjYW4gYWN0dWFsbHkgZG8uLiBJIHRo aW5rIHRoZSBzY2VuYXJpbyB5b3UgZGVzY3JpYmUgY291bGQKPj4gPj4gYmUgaGFuZGxlZCBieSB0 d28gc2ctbGlzdHMsIGlmIHRoZSBleHBvcnRlciB3YXMgY2xldmVyIGVub3VnaC4KPj4gPgo+PiA+ IFRoYXQncyBhbHJlYWR5IG5lZWRlZCwgZWFjaCBhdHRhY2htZW50IGhhcyBpdCdzIG93biBzZy1s aXN0LiBBZnRlciBhbGwKPj4gPiB0aGVyZSdzIG5vIGFycmF5IG9mIGRtYV9hZGRyX3QgaW4gdGhl IHNnIHRhYmxlcywgc28geW91IGNhbid0IHVzZSBvbmUgc2cKPj4gPiBmb3IgbW9yZSB0aGFuIG9u ZSBtYXBwaW5nLiBBbmQgZHVlIHRvIGRpZmZlcmVudCBpb21tdSBkaWZmZXJlb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