Re: [PATCH 1/2] drm/shmem: Add madvise state and purge helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 5, 2019 at 11:47 AM Rob Clark <robdclark@xxxxxxxxx> wrote:
>
> On Mon, Aug 5, 2019 at 9:35 AM Daniel Vetter <daniel@xxxxxxxx> wrote:
> >
> > On Mon, Aug 05, 2019 at 08:33:57AM -0600, Rob Herring wrote:
> > > Add support to the shmem GEM helpers for tracking madvise state and
> > > purging pages. This is based on the msm implementation.
> > >
> > > The BO provides a list_head, but the list management is handled outside
> > > of the shmem helpers as there are different locking requirements.
> > >
> > > Cc: Tomeu Vizoso <tomeu.vizoso@xxxxxxxxxxxxx>
> > > Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
> > > Cc: Maxime Ripard <maxime.ripard@xxxxxxxxxxx>
> > > Cc: Sean Paul <sean@xxxxxxxxxx>
> > > Cc: David Airlie <airlied@xxxxxxxx>
> > > Cc: Daniel Vetter <daniel@xxxxxxxx>
> > > Cc: Eric Anholt <eric@xxxxxxxxxx>
> > > Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
> > > ---
> > >  drivers/gpu/drm/drm_gem_shmem_helper.c | 57 ++++++++++++++++++++++++++
> > >  include/drm/drm_gem_shmem_helper.h     | 15 +++++++
> > >  2 files changed, 72 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c
> > > index 2f64667ac805..4b442576de1c 100644
> > > --- a/drivers/gpu/drm/drm_gem_shmem_helper.c
> > > +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
> > > @@ -75,6 +75,7 @@ struct drm_gem_shmem_object *drm_gem_shmem_create(struct drm_device *dev, size_t
> > >       shmem = to_drm_gem_shmem_obj(obj);
> > >       mutex_init(&shmem->pages_lock);
> > >       mutex_init(&shmem->vmap_lock);
> >
> > Maybe a bit late, but for reasons (interop with ttm, which will be more
> > important once we have dynamic dma-buf) it would be real nice to use the
> > reservation_obj lock for all this stuff. msm, being struct_mutex based,
> > isn't a great example here. The downside is that it will be a lot harder
> > to get  msm to use these then, but much better to not spread struct_mutex
> > inspired locking too far.
> >
>
> but somewhere you need to protect access to list of bo's that are
> available to shrink.. iirc that is the only thing we should need
> struct_mutex for now in shrinker path in drm/msm.  The per-bo state is
> protected by a per-bo lock.

Right. And for panfrost, I have a lock just for the shrinker list and
don't use struct_mutex. Hopefully I've understood the locking
requirements sufficiently.

Rob
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux