On Mon, Aug 5, 2019 at 11:47 AM Rob Clark <[email protected]> wrote: > > On Mon, Aug 5, 2019 at 9:35 AM Daniel Vetter <[email protected]> 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 <[email protected]> > > > Cc: Maarten Lankhorst <[email protected]> > > > Cc: Maxime Ripard <[email protected]> > > > Cc: Sean Paul <[email protected]> > > > Cc: David Airlie <[email protected]> > > > Cc: Daniel Vetter <[email protected]> > > > Cc: Eric Anholt <[email protected]> > > > Signed-off-by: Rob Herring <[email protected]> > > > --- > > > 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 [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
