[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180409082131.GF31310@phenom.ffwll.local>
Date: Mon, 9 Apr 2018 10:21:31 +0200
From: Daniel Vetter <daniel@...ll.ch>
To: Christian König <christian.koenig@....com>
Cc: Gerd Hoffmann <kraxel@...hat.com>, dri-devel@...ts.freedesktop.org,
Daniel Vetter <daniel.vetter@...ll.ch>,
Tomeu Vizoso <tomeu.vizoso@...labora.com>,
David Airlie <airlied@...ux.ie>,
open list <linux-kernel@...r.kernel.org>,
qemu-devel@...gnu.org,
"moderated list:DMA BUFFER SHARING FRAMEWORK"
<linaro-mm-sig@...ts.linaro.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>, Shuah Khan <shuah@...nel.org>,
"open list:DMA BUFFER SHARING FRAMEWORK"
<linux-media@...r.kernel.org>
Subject: Re: [PATCH v2] Add udmabuf misc device
On Fri, Apr 06, 2018 at 02:24:46PM +0200, Christian König wrote:
> Am 06.04.2018 um 11:33 schrieb Gerd Hoffmann:
> > Hi,
> >
> > > The pages backing a DMA-buf are not allowed to move (at least not without a
> > > patch set I'm currently working on), but for certain MM operations to work
> > > correctly you must be able to modify the page tables entries and move the
> > > pages backing them around.
> > >
> > > For example try to use fork() with some copy on write pages with this
> > > approach. You will find that you have only two options to correctly handle
> > > this.
> > The fork() issue should go away with shared memory pages (no cow).
> > I guess this is the reason why vgem is internally backed by shmem.
>
> Yes, exactly that is also an approach which should work fine. Just don't try
> to get this working with get_user_pages().
>
> >
> > Hmm. So I could try to limit the udmabuf driver to shmem too (i.e.
> > have the ioctl take a shmem filehandle and offset instead of a virtual
> > address).
> >
> > But maybe it is better then to just extend vgem, i.e. add support to
> > create gem objects from existing shmem.
> >
> > Comments?
>
> Yes, extending vgem instead of creating something new sounds like a good
> idea to me as well.
+1 on adding a vgem "import from shmem/memfd" ioctl. Sounds like a good
idea, and generally useful.
We might want to limit to memfd though for semantic reasons: dma-buf have
invariant size, shmem not so much. memfd can be locked down to not change
their size anymore. And iirc the core mm page invalidation protocol around
truncate() is about as bad as get_user_pages vs cow :-)
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Powered by blists - more mailing lists