Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-02-07 Thread Sakari Ailus
On Fri, Jan 04, 2019 at 10:35:43PM +, Jason Gunthorpe wrote: > Commit 2db76d7c3c6d ("lib/scatterlist: sg_page_iter: support sg lists w/o > backing pages") introduced the sg_page_iter_dma_address() function without > providing a way to use it in the general case. If the sg_dma_len is not >

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-17 Thread Jason Gunthorpe
On Thu, Jan 17, 2019 at 10:30:01AM +0100, h...@lst.de wrote: > On Wed, Jan 16, 2019 at 10:24:36AM -0700, Jason Gunthorpe wrote: > > The fact is there is 0 industry interest in using RDMA on platforms > > that can't do HW DMA cache coherency - the kernel syscalls required to > > do the cache

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-17 Thread Thomas Hellstrom
On Thu, 2019-01-17 at 10:30 +0100, h...@lst.de wrote: > On Wed, Jan 16, 2019 at 10:24:36AM -0700, Jason Gunthorpe wrote: > > The fact is there is 0 industry interest in using RDMA on platforms > > that can't do HW DMA cache coherency - the kernel syscalls required > > to > > do the cache flushing

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-17 Thread h...@lst.de
On Wed, Jan 16, 2019 at 10:24:36AM -0700, Jason Gunthorpe wrote: > The fact is there is 0 industry interest in using RDMA on platforms > that can't do HW DMA cache coherency - the kernel syscalls required to > do the cache flushing on the IO path would just destroy performance to > the point of

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-16 Thread Jason Gunthorpe
On Wed, Jan 16, 2019 at 05:11:34PM +0100, h...@lst.de wrote: > On Tue, Jan 15, 2019 at 02:25:01PM -0700, Jason Gunthorpe wrote: > > RDMA needs something similar as well, in this case drivers take a > > struct page * from get_user_pages() and need to have the DMA map fail > > if the platform can't

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-16 Thread Daniel Stone
On Wed, 16 Jan 2019 at 16:06, h...@lst.de wrote: > On Wed, Jan 16, 2019 at 07:28:13AM +, Koenig, Christian wrote: > > To summarize once more: We have an array of struct pages and want to > > coherently map that to a device. > > And the answer to that is very simple: you can't. What is so

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-16 Thread h...@lst.de
On Tue, Jan 15, 2019 at 02:25:01PM -0700, Jason Gunthorpe wrote: > RDMA needs something similar as well, in this case drivers take a > struct page * from get_user_pages() and need to have the DMA map fail > if the platform can't DMA map in a way that does not require any > additional DMA API calls

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-16 Thread h...@lst.de
On Wed, Jan 16, 2019 at 07:28:13AM +, Koenig, Christian wrote: > To summarize once more: We have an array of struct pages and want to > coherently map that to a device. And the answer to that is very simple: you can't. What is so hard to understand about? If you want to map arbitrary

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-16 Thread Christian König
Am 15.01.19 um 22:25 schrieb Jason Gunthorpe: On Tue, Jan 15, 2019 at 02:17:26PM +, Thomas Hellstrom wrote: Hi, Christoph, On Mon, 2019-01-14 at 10:48 +0100, Christoph Hellwig wrote: On Thu, Jan 10, 2019 at 04:42:18PM -0700, Jason Gunthorpe wrote: Changes since the RFC: - Rework vmwgfx

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-16 Thread Daniel Vetter
On Wed, Jan 16, 2019 at 07:28:13AM +, Koenig, Christian wrote: > Am 16.01.19 um 08:09 schrieb Thomas Hellstrom: > > On Tue, 2019-01-15 at 21:58 +0100, h...@lst.de wrote: > >> On Tue, Jan 15, 2019 at 07:13:11PM +, Koenig, Christian wrote: > >>> Thomas is correct that the interface you

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-15 Thread Koenig, Christian
Am 16.01.19 um 08:09 schrieb Thomas Hellstrom: > On Tue, 2019-01-15 at 21:58 +0100, h...@lst.de wrote: >> On Tue, Jan 15, 2019 at 07:13:11PM +, Koenig, Christian wrote: >>> Thomas is correct that the interface you propose here doesn't work >>> at >>> all for GPUs. >>> >>> The kernel driver is

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-15 Thread Thomas Hellstrom
On Tue, 2019-01-15 at 21:58 +0100, h...@lst.de wrote: > On Tue, Jan 15, 2019 at 07:13:11PM +, Koenig, Christian wrote: > > Thomas is correct that the interface you propose here doesn't work > > at > > all for GPUs. > > > > The kernel driver is not informed of flush/sync, but rather just > >

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-15 Thread Jason Gunthorpe
On Tue, Jan 15, 2019 at 02:17:26PM +, Thomas Hellstrom wrote: > Hi, Christoph, > > On Mon, 2019-01-14 at 10:48 +0100, Christoph Hellwig wrote: > > On Thu, Jan 10, 2019 at 04:42:18PM -0700, Jason Gunthorpe wrote: > > > > Changes since the RFC: > > > > - Rework vmwgfx too [CH] > > > > - Use a

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-15 Thread h...@lst.de
On Tue, Jan 15, 2019 at 07:13:11PM +, Koenig, Christian wrote: > Thomas is correct that the interface you propose here doesn't work at > all for GPUs. > > The kernel driver is not informed of flush/sync, but rather just setups > coherent mappings between system memory and devices. > > In

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-15 Thread Koenig, Christian
Am 15.01.19 um 19:31 schrieb h...@lst.de: > On Tue, Jan 15, 2019 at 06:03:39PM +, Thomas Hellstrom wrote: >> In the graphics case, it's probably because it doesn't fit the graphics >> use-cases: >> >> 1) Memory typically needs to be mappable by another device. (the "dma- >> buf" interface) >

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-15 Thread h...@lst.de
On Tue, Jan 15, 2019 at 06:03:39PM +, Thomas Hellstrom wrote: > In the graphics case, it's probably because it doesn't fit the graphics > use-cases: > > 1) Memory typically needs to be mappable by another device. (the "dma- > buf" interface) And there is nothing preventing dma-buf sharing of

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-15 Thread Thomas Hellstrom
On Tue, 2019-01-15 at 16:20 +0100, h...@lst.de wrote: > On Tue, Jan 15, 2019 at 03:24:55PM +0100, Christian König wrote: > > Yeah, indeed. Bounce buffers are an absolute no-go for GPUs. > > > > If the DMA API finds that a piece of memory is not directly > > accessible by > > the GPU we need to

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-15 Thread h...@lst.de
On Tue, Jan 15, 2019 at 03:24:55PM +0100, Christian König wrote: > Yeah, indeed. Bounce buffers are an absolute no-go for GPUs. > > If the DMA API finds that a piece of memory is not directly accessible by > the GPU we need to return an error and not try to use bounce buffers behind > the

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-15 Thread Christian König
Am 15.01.19 um 15:17 schrieb Thomas Hellstrom: Hi, Christoph, On Mon, 2019-01-14 at 10:48 +0100, Christoph Hellwig wrote: On Thu, Jan 10, 2019 at 04:42:18PM -0700, Jason Gunthorpe wrote: Changes since the RFC: - Rework vmwgfx too [CH] - Use a distinct type for the DMA page iterator [CH] - Do

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-15 Thread Thomas Hellstrom
Hi, Christoph, On Mon, 2019-01-14 at 10:48 +0100, Christoph Hellwig wrote: > On Thu, Jan 10, 2019 at 04:42:18PM -0700, Jason Gunthorpe wrote: > > > Changes since the RFC: > > > - Rework vmwgfx too [CH] > > > - Use a distinct type for the DMA page iterator [CH] > > > - Do not have a #ifdef [CH] >

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-14 Thread Jason Gunthorpe
On Sat, Jan 12, 2019 at 01:03:05PM -0600, Shiraz Saleem wrote: > On Sat, Jan 12, 2019 at 06:37:58PM +, Jason Gunthorpe wrote: > > On Sat, Jan 12, 2019 at 12:27:05PM -0600, Shiraz Saleem wrote: > > > On Fri, Jan 04, 2019 at 10:35:43PM +, Jason Gunthorpe wrote: > > > > Commit 2db76d7c3c6d

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-14 Thread Christoph Hellwig
On Thu, Jan 10, 2019 at 04:42:18PM -0700, Jason Gunthorpe wrote: > > Changes since the RFC: > > - Rework vmwgfx too [CH] > > - Use a distinct type for the DMA page iterator [CH] > > - Do not have a #ifdef [CH] > > ChristophH: Will you ack? This looks generally fine. > > Are you still OK with

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-14 Thread Christoph Hellwig
On Sat, Jan 12, 2019 at 01:03:05PM -0600, Shiraz Saleem wrote: > Well I was trying convert the RDMA drivers to use your new iterator variant > and saw the need for it in locations where we need virtual address of the > pages > contained in the SGEs. As far as i can tell that pg_arr[i] value is

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-12 Thread Shiraz Saleem
On Sat, Jan 12, 2019 at 06:37:58PM +, Jason Gunthorpe wrote: > On Sat, Jan 12, 2019 at 12:27:05PM -0600, Shiraz Saleem wrote: > > On Fri, Jan 04, 2019 at 10:35:43PM +, Jason Gunthorpe wrote: > > > Commit 2db76d7c3c6d ("lib/scatterlist: sg_page_iter: support sg lists w/o > > > backing

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-12 Thread Jason Gunthorpe
On Sat, Jan 12, 2019 at 12:27:05PM -0600, Shiraz Saleem wrote: > On Fri, Jan 04, 2019 at 10:35:43PM +, Jason Gunthorpe wrote: > > Commit 2db76d7c3c6d ("lib/scatterlist: sg_page_iter: support sg lists w/o > > backing pages") introduced the sg_page_iter_dma_address() function without > >

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-12 Thread Shiraz Saleem
On Fri, Jan 04, 2019 at 10:35:43PM +, Jason Gunthorpe wrote: > Commit 2db76d7c3c6d ("lib/scatterlist: sg_page_iter: support sg lists w/o > backing pages") introduced the sg_page_iter_dma_address() function without > providing a way to use it in the general case. If the sg_dma_len is not >

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-10 Thread Jason Gunthorpe
On Fri, Jan 04, 2019 at 03:35:31PM -0700, Jason Gunthorpe wrote: > Commit 2db76d7c3c6d ("lib/scatterlist: sg_page_iter: support sg lists w/o > backing pages") introduced the sg_page_iter_dma_address() function without > providing a way to use it in the general case. If the sg_dma_len is not >

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-04 Thread Jason Gunthorpe
On Sat, Jan 05, 2019 at 10:37:17AM +0800, kbuild test robot wrote: > Hi Jason, > > I love your patch! Yet something to improve: > > [auto build test ERROR on linus/master] > [also build test ERROR on v4.20 next-20190103] > [if your patch is applied to the wrong git tree, please drop us a note to

Re: [PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-04 Thread kbuild test robot
Hi Jason, I love your patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v4.20 next-20190103] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url:

[PATCH] lib/scatterlist: Provide a DMA page iterator

2019-01-04 Thread Jason Gunthorpe
Commit 2db76d7c3c6d ("lib/scatterlist: sg_page_iter: support sg lists w/o backing pages") introduced the sg_page_iter_dma_address() function without providing a way to use it in the general case. If the sg_dma_len is not equal to the dma_length callers cannot safely use the