From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleksandr Andrushchenko Subject: Re: [PATCH] drm/xen-front: Make shmem backed display buffer coherent Date: Fri, 21 Dec 2018 11:16:44 +0200 Message-ID: <83a4be07-a06f-5585-66f6-4973f80dbfba@gmail.com> References: <20181127103252.20994-1-andr2000@gmail.com> <17640791-5306-f7e4-8588-dd39c14e975b@tronnes.org> <20181220153646.GA22997@infradead.org> <20181220173950.GA19641@infradead.org> <20181220183311.GA30801@infradead.org> <20181220183851.GA27025@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20181220183851.GA27025@infradead.org> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Christoph Hellwig , Daniel Vetter Cc: Juergen Gross , Oleksandr Andrushchenko , Linux Kernel Mailing List , dri-devel , Daniel Vetter , xen-devel@lists.xenproject.org, boris.ostrovsky@oracle.com List-Id: dri-devel@lists.freedesktop.org On 12/20/18 8:38 PM, Christoph Hellwig wrote: > On Thu, Dec 20, 2018 at 07:35:15PM +0100, Daniel Vetter wrote: >>> Err, with streaming DMA buffer sharing is trivial. The coherent DMA >>> allocator is what causes all kinds of horrible hacks that can't actually >>> work on various platforms. >> Hm, I thought the streaming dma api is the one that causes bounce >> buffers and all that fun. If you're unlucky at least. > Yes it may. But even if that happens everything will actually work, > just slower. While the dma coherent API is simply broken. > > But if you don't want bounce buffering you need to use the dma > noncoherent allocator as proposed here: > > https://lists.linuxfoundation.org/pipermail/iommu/2018-December/031982.html > > which combines allocating memory that doesn't need to be bounce > buffered with a sharing scheme that can actually work. So, the bottom line will be: I can use DMA API for what I need, but: 1. I need to remove GFP_USER 2. No need for DMA32 (so no chance for bouncing to step in) 3. I may need to check if mapping and unmapping of the buffer at once will also help, e.g. no need to have the buffer mapped until it is destroyed Did I get it all right? Thank you, Oleksandr