All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx <intel-gfx@lists.freedesktop.org>,
	dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 3/3] drm/prime: Use anon_drm_getfile() for an internal drm struct file
Date: Wed, 6 Nov 2019 14:06:26 +0100	[thread overview]
Message-ID: <CAKMK7uEy_HdxksnqXbUqsmCvXZ-BcXv=DqFv8wZ6Y4NE0q4dSw@mail.gmail.com> (raw)
In-Reply-To: <157303711710.24928.18026997375656120508@skylake-alporthouse-com>

On Wed, Nov 6, 2019 at 11:45 AM Chris Wilson <chris@chris-wilson.co.uk> wrote:
>
> Quoting Daniel Vetter (2019-11-06 10:21:57)
> > On Wed, Nov 06, 2019 at 10:07:16AM +0000, Chris Wilson wrote:
> > > Currently the drm_prime mmap fallback uses a mock struct file to provide
> > > the file pointer into the backend mmap routine. Now that we can create
> > > fully fledged anonymous struct file around the drm device, put it to
> > > use.
> > >
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > ---
> > >  drivers/gpu/drm/drm_prime.c | 26 ++++++++------------------
> > >  1 file changed, 8 insertions(+), 18 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> > > index 0814211b0f3f..5faa63713ec8 100644
> > > --- a/drivers/gpu/drm/drm_prime.c
> > > +++ b/drivers/gpu/drm/drm_prime.c
> > > @@ -709,8 +709,7 @@ EXPORT_SYMBOL(drm_gem_dmabuf_vunmap);
> > >   */
> > >  int drm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
> > >  {
> > > -     struct drm_file *priv;
> > > -     struct file *fil;
> > > +     struct file *file;
> > >       int ret;
> > >
> > >       if (obj->funcs && obj->funcs->mmap) {
> >
> > obj->funcs->mmap is the new way of doing this (and hopefully finally
> > something clean), I'd really like to retire the below hack outright.
> >
> > Plus I'm not sure why you need an anon inode here? If a driver needs this
> > for unmap_mapping_range or similar I think it'd be better to try and make
> > something work cleanly for obj->funcs->mmap.
>
> It's faking one currently. If the fake is not good enough, you are
> playing whack-a-mole until you finally do create a fully fledged file.
>
> If you are going to the trouble of having to create a struct file to
> provide to the fallback routines, might as well avoid stinky code :)

We're currently not faking the inode at all, we're just using the one
that comes with the dma-buf. So distinct from the drm_device file, and
hence unmap_mapping_range won't work (or at least doing that on the
drm_device inode wont shoot down the ptes for redirected dma-buf
mmaps). obj->funcs->mmap has the same issue.

But since all current users of this don't expect unmap_mapping_range
to work correctly, it's not an real issue. If that changes then imo we
should fix up the obj->funcs->mmap path to have the correct inode, not
the deprecated path you're updating here. But since there's no patch 4
in this series to start using this for i915 or someone else, I'm not
seeing the point.

Or am I blind? At least slightly confused,
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - 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: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx <intel-gfx@lists.freedesktop.org>,
	dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 3/3] drm/prime: Use anon_drm_getfile() for an internal drm struct file
Date: Wed, 6 Nov 2019 14:06:26 +0100	[thread overview]
Message-ID: <CAKMK7uEy_HdxksnqXbUqsmCvXZ-BcXv=DqFv8wZ6Y4NE0q4dSw@mail.gmail.com> (raw)
Message-ID: <20191106130626.o6aiWec0sEvZq1J5pcnDiq_5NA5plDNG8xycs0x05uQ@z> (raw)
In-Reply-To: <157303711710.24928.18026997375656120508@skylake-alporthouse-com>

On Wed, Nov 6, 2019 at 11:45 AM Chris Wilson <chris@chris-wilson.co.uk> wrote:
>
> Quoting Daniel Vetter (2019-11-06 10:21:57)
> > On Wed, Nov 06, 2019 at 10:07:16AM +0000, Chris Wilson wrote:
> > > Currently the drm_prime mmap fallback uses a mock struct file to provide
> > > the file pointer into the backend mmap routine. Now that we can create
> > > fully fledged anonymous struct file around the drm device, put it to
> > > use.
> > >
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > ---
> > >  drivers/gpu/drm/drm_prime.c | 26 ++++++++------------------
> > >  1 file changed, 8 insertions(+), 18 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> > > index 0814211b0f3f..5faa63713ec8 100644
> > > --- a/drivers/gpu/drm/drm_prime.c
> > > +++ b/drivers/gpu/drm/drm_prime.c
> > > @@ -709,8 +709,7 @@ EXPORT_SYMBOL(drm_gem_dmabuf_vunmap);
> > >   */
> > >  int drm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
> > >  {
> > > -     struct drm_file *priv;
> > > -     struct file *fil;
> > > +     struct file *file;
> > >       int ret;
> > >
> > >       if (obj->funcs && obj->funcs->mmap) {
> >
> > obj->funcs->mmap is the new way of doing this (and hopefully finally
> > something clean), I'd really like to retire the below hack outright.
> >
> > Plus I'm not sure why you need an anon inode here? If a driver needs this
> > for unmap_mapping_range or similar I think it'd be better to try and make
> > something work cleanly for obj->funcs->mmap.
>
> It's faking one currently. If the fake is not good enough, you are
> playing whack-a-mole until you finally do create a fully fledged file.
>
> If you are going to the trouble of having to create a struct file to
> provide to the fallback routines, might as well avoid stinky code :)

We're currently not faking the inode at all, we're just using the one
that comes with the dma-buf. So distinct from the drm_device file, and
hence unmap_mapping_range won't work (or at least doing that on the
drm_device inode wont shoot down the ptes for redirected dma-buf
mmaps). obj->funcs->mmap has the same issue.

But since all current users of this don't expect unmap_mapping_range
to work correctly, it's not an real issue. If that changes then imo we
should fix up the obj->funcs->mmap path to have the correct inode, not
the deprecated path you're updating here. But since there's no patch 4
in this series to start using this for i915 or someone else, I'm not
seeing the point.

Or am I blind? At least slightly confused,
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-11-06 13:06 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-06 10:07 [PATCH 1/3] drm: Expose a method for creating anonymous struct file around drm_minor Chris Wilson
2019-11-06 10:07 ` [Intel-gfx] " Chris Wilson
2019-11-06 10:07 ` Chris Wilson
2019-11-06 10:07 ` [PATCH 2/3] drm/i915/selftests: Wrap vm_mmap() around GEM objects Chris Wilson
2019-11-06 10:07   ` [Intel-gfx] " Chris Wilson
2019-11-06 10:07   ` Chris Wilson
2019-11-06 10:07 ` [PATCH 3/3] drm/prime: Use anon_drm_getfile() for an internal drm struct file Chris Wilson
2019-11-06 10:07   ` [Intel-gfx] " Chris Wilson
2019-11-06 10:21   ` Daniel Vetter
2019-11-06 10:21     ` [Intel-gfx] " Daniel Vetter
2019-11-06 10:21     ` Daniel Vetter
2019-11-06 10:45     ` Chris Wilson
2019-11-06 10:45       ` [Intel-gfx] " Chris Wilson
2019-11-06 10:45       ` Chris Wilson
2019-11-06 13:06       ` Daniel Vetter [this message]
2019-11-06 13:06         ` [Intel-gfx] " Daniel Vetter
2019-11-06 13:17         ` Chris Wilson
2019-11-06 13:17           ` [Intel-gfx] " Chris Wilson
2019-11-06 13:17           ` Chris Wilson
2019-11-06 10:19 ` [PATCH 1/3] drm: Expose a method for creating anonymous struct file around drm_minor Daniel Vetter
2019-11-06 10:19   ` [Intel-gfx] " Daniel Vetter
2019-11-06 10:19   ` Daniel Vetter
2019-11-06 10:26   ` Chris Wilson
2019-11-06 10:26     ` [Intel-gfx] " Chris Wilson
2019-11-06 10:26     ` Chris Wilson
2019-11-06 10:42     ` Chris Wilson
2019-11-06 10:42       ` [Intel-gfx] " Chris Wilson
2019-11-06 10:42       ` Chris Wilson
2019-11-06 13:08       ` Daniel Vetter
2019-11-06 13:08         ` [Intel-gfx] " Daniel Vetter
2019-11-06 13:08         ` Daniel Vetter
2019-11-06 11:24 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] " Patchwork
2019-11-06 11:24   ` [Intel-gfx] " Patchwork
2019-11-06 11:44 ` ✓ Fi.CI.BAT: success " Patchwork
2019-11-06 11:44   ` [Intel-gfx] " Patchwork
2019-11-07  8:40 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-11-07  8:40   ` [Intel-gfx] " Patchwork

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='CAKMK7uEy_HdxksnqXbUqsmCvXZ-BcXv=DqFv8wZ6Y4NE0q4dSw@mail.gmail.com' \
    --to=daniel@ffwll.ch \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /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.