Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap()

2020-09-17 Thread Daniel Vetter
On Thu, Sep 17, 2020 at 6:39 PM Jason Gunthorpe wrote: > > On Thu, Sep 17, 2020 at 06:06:14PM +0200, Christian König wrote: > > > > If it is already taking a page fault I'm not sure the extra function > > > > call indirection is going to be a big deal. Having a uniform VMA > > > > sounds saner tha

Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap()

2020-09-17 Thread Jason Gunthorpe
On Thu, Sep 17, 2020 at 06:06:14PM +0200, Christian König wrote: > > > If it is already taking a page fault I'm not sure the extra function > > > call indirection is going to be a big deal. Having a uniform VMA > > > sounds saner than every driver custom rolling something. > > > > > > When I unwou

Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap()

2020-09-17 Thread Christian König
Am 17.09.20 um 17:37 schrieb Daniel Vetter: On Thu, Sep 17, 2020 at 5:24 PM Jason Gunthorpe wrote: On Thu, Sep 17, 2020 at 04:54:44PM +0200, Christian König wrote: Am 17.09.20 um 16:35 schrieb Jason Gunthorpe: On Thu, Sep 17, 2020 at 02:24:29PM +0200, Christian König wrote: Am 17.09.20 um 14

Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap()

2020-09-17 Thread Daniel Vetter
On Thu, Sep 17, 2020 at 5:24 PM Jason Gunthorpe wrote: > > On Thu, Sep 17, 2020 at 04:54:44PM +0200, Christian König wrote: > > Am 17.09.20 um 16:35 schrieb Jason Gunthorpe: > > > On Thu, Sep 17, 2020 at 02:24:29PM +0200, Christian König wrote: > > > > Am 17.09.20 um 14:18 schrieb Jason Gunthorpe:

Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap()

2020-09-17 Thread Jason Gunthorpe
On Thu, Sep 17, 2020 at 04:54:44PM +0200, Christian König wrote: > Am 17.09.20 um 16:35 schrieb Jason Gunthorpe: > > On Thu, Sep 17, 2020 at 02:24:29PM +0200, Christian König wrote: > > > Am 17.09.20 um 14:18 schrieb Jason Gunthorpe: > > > > On Thu, Sep 17, 2020 at 02:03:48PM +0200, Christian König

Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap()

2020-09-17 Thread Christian König
Am 17.09.20 um 16:35 schrieb Jason Gunthorpe: On Thu, Sep 17, 2020 at 02:24:29PM +0200, Christian König wrote: Am 17.09.20 um 14:18 schrieb Jason Gunthorpe: On Thu, Sep 17, 2020 at 02:03:48PM +0200, Christian König wrote: Am 17.09.20 um 13:31 schrieb Jason Gunthorpe: On Thu, Sep 17, 2020 at 1

Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap()

2020-09-17 Thread Jason Gunthorpe
On Thu, Sep 17, 2020 at 02:24:29PM +0200, Christian König wrote: > Am 17.09.20 um 14:18 schrieb Jason Gunthorpe: > > On Thu, Sep 17, 2020 at 02:03:48PM +0200, Christian König wrote: > > > Am 17.09.20 um 13:31 schrieb Jason Gunthorpe: > > > > On Thu, Sep 17, 2020 at 10:09:12AM +0200, Daniel Vetter w

Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap()

2020-09-17 Thread Daniel Vetter
On Thu, Sep 17, 2020 at 02:24:29PM +0200, Christian König wrote: > Am 17.09.20 um 14:18 schrieb Jason Gunthorpe: > > On Thu, Sep 17, 2020 at 02:03:48PM +0200, Christian König wrote: > > > Am 17.09.20 um 13:31 schrieb Jason Gunthorpe: > > > > On Thu, Sep 17, 2020 at 10:09:12AM +0200, Daniel Vetter w

Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap()

2020-09-17 Thread Christian König
Am 17.09.20 um 14:18 schrieb Jason Gunthorpe: On Thu, Sep 17, 2020 at 02:03:48PM +0200, Christian König wrote: Am 17.09.20 um 13:31 schrieb Jason Gunthorpe: On Thu, Sep 17, 2020 at 10:09:12AM +0200, Daniel Vetter wrote: Yeah, but it doesn't work when forwarding from the drm chardev to the dma

Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap()

2020-09-17 Thread Jason Gunthorpe
On Thu, Sep 17, 2020 at 02:03:48PM +0200, Christian König wrote: > Am 17.09.20 um 13:31 schrieb Jason Gunthorpe: > > On Thu, Sep 17, 2020 at 10:09:12AM +0200, Daniel Vetter wrote: > > > > > Yeah, but it doesn't work when forwarding from the drm chardev to the > > > dma-buf on the importer side, si

Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap()

2020-09-17 Thread Christian König
Am 17.09.20 um 13:31 schrieb Jason Gunthorpe: On Thu, Sep 17, 2020 at 10:09:12AM +0200, Daniel Vetter wrote: Yeah, but it doesn't work when forwarding from the drm chardev to the dma-buf on the importer side, since you'd need a ton of different address spaces. And you still rely on the core cod

Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap()

2020-09-17 Thread Jason Gunthorpe
On Thu, Sep 17, 2020 at 10:09:12AM +0200, Daniel Vetter wrote: > Yeah, but it doesn't work when forwarding from the drm chardev to the > dma-buf on the importer side, since you'd need a ton of different > address spaces. And you still rely on the core code picking up your > pgoff mangling, which f

Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap()

2020-09-17 Thread Daniel Vetter
On Thu, Sep 17, 2020 at 9:11 AM Christian König wrote: > > Am 17.09.20 um 08:23 schrieb Daniel Vetter: > > On Wed, Sep 16, 2020 at 5:31 PM Christian König > > wrote: > >> Am 16.09.20 um 17:24 schrieb Daniel Vetter: > >>> On Wed, Sep 16, 2020 at 4:14 PM Christian König > >>> wrote: > Am 16.0

Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap()

2020-09-17 Thread Christian König
Am 17.09.20 um 08:23 schrieb Daniel Vetter: On Wed, Sep 16, 2020 at 5:31 PM Christian König wrote: Am 16.09.20 um 17:24 schrieb Daniel Vetter: On Wed, Sep 16, 2020 at 4:14 PM Christian König wrote: Am 16.09.20 um 16:07 schrieb Jason Gunthorpe: On Wed, Sep 16, 2020 at 11:53:59AM +0200, Danie

Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap()

2020-09-16 Thread Daniel Vetter
On Wed, Sep 16, 2020 at 5:31 PM Christian König wrote: > > Am 16.09.20 um 17:24 schrieb Daniel Vetter: > > On Wed, Sep 16, 2020 at 4:14 PM Christian König > > wrote: > >> Am 16.09.20 um 16:07 schrieb Jason Gunthorpe: > >>> On Wed, Sep 16, 2020 at 11:53:59AM +0200, Daniel Vetter wrote: > >>> > >>>

Re: Changing vma->vm_file in dma_buf_mmap()

2020-09-16 Thread Daniel Vetter
On Wed, Sep 16, 2020 at 4:14 PM Christian König wrote: > > Am 16.09.20 um 16:07 schrieb Jason Gunthorpe: > > On Wed, Sep 16, 2020 at 11:53:59AM +0200, Daniel Vetter wrote: > > > >> But within the driver, we generally need thousands of these, and that > >> tends to bring fd exhaustion problems with

Re: Changing vma->vm_file in dma_buf_mmap()

2020-09-16 Thread Christian König
Am 16.09.20 um 16:07 schrieb Jason Gunthorpe: On Wed, Sep 16, 2020 at 11:53:59AM +0200, Daniel Vetter wrote: But within the driver, we generally need thousands of these, and that tends to bring fd exhaustion problems with it. That's why all the private buffer objects which aren't shared with ot

Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap()

2020-09-16 Thread Christian König
Am 16.09.20 um 17:24 schrieb Daniel Vetter: On Wed, Sep 16, 2020 at 4:14 PM Christian König wrote: Am 16.09.20 um 16:07 schrieb Jason Gunthorpe: On Wed, Sep 16, 2020 at 11:53:59AM +0200, Daniel Vetter wrote: But within the driver, we generally need thousands of these, and that tends to bring

Re: Changing vma->vm_file in dma_buf_mmap()

2020-09-16 Thread Daniel Vetter
On Wed, Sep 16, 2020 at 1:45 PM Christian König wrote: > > [SNIP] > > But Jason pointed me to the right piece of code. See this comment in in > mmap_region(): > > /* ->mmap() can change vma->vm_file, but must guarantee that > * vma_link() below can deny write-access if VM_DENYWRITE is set > * and

Re: Changing vma->vm_file in dma_buf_mmap()

2020-09-16 Thread Jason Gunthorpe
On Wed, Sep 16, 2020 at 11:53:59AM +0200, Daniel Vetter wrote: > But within the driver, we generally need thousands of these, and that > tends to bring fd exhaustion problems with it. That's why all the private > buffer objects which aren't shared with other process or other drivers are > handles

Re: Changing vma->vm_file in dma_buf_mmap()

2020-09-16 Thread Daniel Vetter
On Mon, Sep 14, 2020 at 08:26:47PM +0200, Christian König wrote: > Am 14.09.20 um 16:06 schrieb Jason Gunthorpe: > > On Mon, Sep 14, 2020 at 03:30:47PM +0200, Christian König wrote: > > > Am 14.09.20 um 15:29 schrieb Christian König: > > > > Hi Andrew, > > > > > > > > I'm the new DMA-buf maintaine

Re: Changing vma->vm_file in dma_buf_mmap()

2020-09-14 Thread Christian König
Am 14.09.20 um 16:06 schrieb Jason Gunthorpe: On Mon, Sep 14, 2020 at 03:30:47PM +0200, Christian König wrote: Am 14.09.20 um 15:29 schrieb Christian König: Hi Andrew, I'm the new DMA-buf maintainer and Daniel and others came up with patches extending the use of the dma_buf_mmap() function. N

Re: Changing vma->vm_file in dma_buf_mmap()

2020-09-14 Thread Jason Gunthorpe
On Mon, Sep 14, 2020 at 03:30:47PM +0200, Christian König wrote: > Am 14.09.20 um 15:29 schrieb Christian König: > > Hi Andrew, > > > > I'm the new DMA-buf maintainer and Daniel and others came up with > > patches extending the use of the dma_buf_mmap() function. > > > > Now this function is doin

Changing vma->vm_file in dma_buf_mmap()

2020-09-14 Thread Christian König
Hi Andrew, I'm the new DMA-buf maintainer and Daniel and others came up with patches extending the use of the dma_buf_mmap() function. Now this function is doing something a bit odd by changing the vma->vm_file while installing a VMA in the mmap() system call The background here is that DMA-bu

Re: Changing vma->vm_file in dma_buf_mmap()

2020-09-14 Thread Christian König
Am 14.09.20 um 15:29 schrieb Christian König: Hi Andrew, Sorry forgot to add Daniel as well. I'm the new DMA-buf maintainer and Daniel and others came up with patches extending the use of the dma_buf_mmap() function. Now this function is doing something a bit odd by changing the vma->vm_fi