From: daniel at ffwll.ch (Daniel Vetter)
Subject: [PATCH v2] Add udmabuf misc device
Date: Mon, 9 Apr 2018 10:21:31 +0200 [thread overview]
Message-ID: <20180409082131.GF31310@phenom.ffwll.local> (raw)
In-Reply-To: <5d88baad-a956-6bd5-e0d6-aabae6647f3e@amd.com>
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: daniel@ffwll.ch (Daniel Vetter)
Subject: [PATCH v2] Add udmabuf misc device
Date: Mon, 9 Apr 2018 10:21:31 +0200 [thread overview]
Message-ID: <20180409082131.GF31310@phenom.ffwll.local> (raw)
Message-ID: <20180409082131.E_X4zRe7PURJgh4-yi0hoYx41O8M6tMaUYu5rGIOoYo@z> (raw)
In-Reply-To: <5d88baad-a956-6bd5-e0d6-aabae6647f3e@amd.com>
On Fri, Apr 06, 2018@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
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel@ffwll.ch>
To: "Christian König" <christian.koenig@amd.com>
Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>,
David Airlie <airlied@linux.ie>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
open list <linux-kernel@vger.kernel.org>,
dri-devel@lists.freedesktop.org, qemu-devel@nongnu.org,
"moderated list:DMA BUFFER SHARING FRAMEWORK"
<linaro-mm-sig@lists.linaro.org>,
Gerd Hoffmann <kraxel@redhat.com>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>, Shuah Khan <shuah@kernel.org>,
"open list:DMA BUFFER SHARING FRAMEWORK"
<linux-media@vger.kernel.org>
Subject: Re: [PATCH v2] Add udmabuf misc device
Date: Mon, 9 Apr 2018 10:21:31 +0200 [thread overview]
Message-ID: <20180409082131.GF31310@phenom.ffwll.local> (raw)
In-Reply-To: <5d88baad-a956-6bd5-e0d6-aabae6647f3e@amd.com>
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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel@ffwll.ch>
To: "Christian König" <christian.koenig@amd.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>,
dri-devel@lists.freedesktop.org,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Tomeu Vizoso <tomeu.vizoso@collabora.com>,
David Airlie <airlied@linux.ie>,
open list <linux-kernel@vger.kernel.org>,
qemu-devel@nongnu.org,
"moderated list:DMA BUFFER SHARING FRAMEWORK"
<linaro-mm-sig@lists.linaro.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>, Shuah Khan <shuah@kernel.org>,
"open list:DMA BUFFER SHARING FRAMEWORK"
<linux-media@vger.kernel.org>
Subject: Re: [PATCH v2] Add udmabuf misc device
Date: Mon, 9 Apr 2018 10:21:31 +0200 [thread overview]
Message-ID: <20180409082131.GF31310@phenom.ffwll.local> (raw)
In-Reply-To: <5d88baad-a956-6bd5-e0d6-aabae6647f3e@amd.com>
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
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel@ffwll.ch>
To: "Christian König" <christian.koenig@amd.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>,
dri-devel@lists.freedesktop.org,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Tomeu Vizoso <tomeu.vizoso@collabora.com>,
David Airlie <airlied@linux.ie>,
open list <linux-kernel@vger.kernel.org>,
qemu-devel@nongnu.org,
"moderated list:DMA BUFFER SHARING FRAMEWORK"
<linaro-mm-sig@lists.linaro.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>, Shuah Khan <shuah@kernel.org>,
"open list:DMA BUFFER SHARING FRAMEWORK"
<linux-media@vger.kernel.org>
Subject: Re: [Qemu-devel] [PATCH v2] Add udmabuf misc device
Date: Mon, 9 Apr 2018 10:21:31 +0200 [thread overview]
Message-ID: <20180409082131.GF31310@phenom.ffwll.local> (raw)
In-Reply-To: <5d88baad-a956-6bd5-e0d6-aabae6647f3e@amd.com>
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
next prev parent reply other threads:[~2018-04-09 8:21 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-16 7:46 [PATCH v2] Add udmabuf misc device kraxel
2018-03-16 7:46 ` [Qemu-devel] " Gerd Hoffmann
2018-03-16 7:46 ` Gerd Hoffmann
2018-03-16 7:46 ` Gerd Hoffmann
2018-03-16 7:46 ` Gerd Hoffmann
2018-03-16 7:55 ` gregkh
2018-03-16 7:55 ` [Qemu-devel] " Greg KH
2018-03-16 7:55 ` Greg KH
2018-03-16 7:55 ` Greg KH
2018-03-16 7:55 ` Greg KH
2018-03-16 7:56 ` gregkh
2018-03-16 7:56 ` [Qemu-devel] " Greg KH
2018-03-16 7:56 ` Greg KH
2018-03-16 7:56 ` Greg KH
2018-03-16 7:56 ` Greg KH
2018-03-16 12:30 `
2018-03-16 12:30 ` [Qemu-devel] " Christian König
2018-03-16 12:30 ` Christian König
2018-03-16 12:30 ` Christian König
2018-03-16 12:30 ` Christian König
2018-04-06 9:33 ` kraxel
2018-04-06 9:33 ` [Qemu-devel] " Gerd Hoffmann
2018-04-06 9:33 ` Gerd Hoffmann
2018-04-06 9:33 ` Gerd Hoffmann
2018-04-06 9:33 ` Gerd Hoffmann
2018-04-06 12:24 `
2018-04-06 12:24 ` [Qemu-devel] " Christian König
2018-04-06 12:24 ` Christian König
2018-04-06 12:24 ` Christian König
2018-04-06 12:24 ` Christian König
2018-04-09 8:21 ` daniel [this message]
2018-04-09 8:21 ` [Qemu-devel] " Daniel Vetter
2018-04-09 8:21 ` Daniel Vetter
2018-04-09 8:21 ` Daniel Vetter
2018-04-09 8:21 ` Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180409082131.GF31310@phenom.ffwll.local \
--to=unknown@example.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.