[PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

Gerd Hoffmann kraxel at redhat.com
Wed Nov 13 07:53:59 UTC 2019


  Hi,

> > > I guess ... but kinda awkward to leave this issue in here, it's really
> > > surprising if you call the pte shootdown function, and it doesn't work as
> > > advertised.
> >
> > I was mainly wondering how this worked for us and how to hit it not
> > working to test fixing it.
> >
> > Is there a simple way to check if a BO is mmapped or not? I'd assume
> > so, just don't know the answer off hand. A simple fix would be to
> > either require buffer is not mapped before madvise or skip purging if
> > it is mapped.
> 
> Imo simplest fix is to just go back and readd the fake offset. Ugly,
> but works at least.

Well, shmem helpers removed the fake offset before, so I'm likewise
starting to wonder what exactly broke by removing the offset elsewhere.

Maybe shmem helpers where already broken before that patch.  I can see
that removing the fake offset and continuing to use a shared address
space isn't going to fly.  Unlike ttm the shmem helpers should have no
problems using obj->filp, but I can't see the shmem helper code
switching vma->vm_file over to obj->filp anywhere ...

cheers,
  Gerd



More information about the dri-devel mailing list