Re: [Intel-gfx] [PATCH 4/4] drm/vc4: Use dma_resv locking wrappers

2019-12-13 Thread Eric Anholt
On Fri, Dec 13, 2019 at 12:10 PM Daniel Vetter  wrote:
>
> On Mon, Nov 25, 2019 at 10:43:56AM +0100, Daniel Vetter wrote:
> > I'll add more fancy logic to them soon, so everyone really has to use
> > them. Plus they already provide some nice additional debug
> > infrastructure on top of direct ww_mutex usage for the fences tracked
> > by dma_resv.
> >
> > Signed-off-by: Daniel Vetter 
>
> Ping for some review/acks.
>
> Thanks, Daniel
>
> > ---
> >  drivers/gpu/drm/vc4/vc4_gem.c | 11 +--
> >  1 file changed, 5 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
> > index 7a06cb6e31c5..e1cfc3ccd05a 100644
> > --- a/drivers/gpu/drm/vc4/vc4_gem.c
> > +++ b/drivers/gpu/drm/vc4/vc4_gem.c
> > @@ -568,7 +568,7 @@ vc4_unlock_bo_reservations(struct drm_device *dev,
> >   for (i = 0; i < exec->bo_count; i++) {
> >   struct drm_gem_object *bo = >bo[i]->base;
> >
> > - ww_mutex_unlock(>resv->lock);
> > + dma_resv_unlock(bo->resv);
> >   }
> >
> >   ww_acquire_fini(acquire_ctx);
> > @@ -595,8 +595,7 @@ vc4_lock_bo_reservations(struct drm_device *dev,
> >  retry:
> >   if (contended_lock != -1) {
> >   bo = >bo[contended_lock]->base;
> > - ret = ww_mutex_lock_slow_interruptible(>resv->lock,
> > -acquire_ctx);
> > + ret = dma_resv_lock_slow_interruptible(bo->resv, acquire_ctx);
> >   if (ret) {
> >   ww_acquire_done(acquire_ctx);
> >   return ret;
> > @@ -609,19 +608,19 @@ vc4_lock_bo_reservations(struct drm_device *dev,
> >
> >   bo = >bo[i]->base;
> >
> > - ret = ww_mutex_lock_interruptible(>resv->lock, 
> > acquire_ctx);
> > + ret = dma_resv_lock_interruptible(bo->resv, acquire_ctx);
> >   if (ret) {
> >   int j;
> >
> >   for (j = 0; j < i; j++) {
> >   bo = >bo[j]->base;
> > - ww_mutex_unlock(>resv->lock);
> > + dma_resv_unlock(bo->resv);
> >   }
> >
> >   if (contended_lock != -1 && contended_lock >= i) {
> >   bo = >bo[contended_lock]->base;
> >
> > - ww_mutex_unlock(>resv->lock);
> > + dma_resv_unlock(bo->resv);
> >   }
> >
> >   if (ret == -EDEADLK) {
> > --
> > 2.24.0
> >

Assuming they're supposed to be exactly equivalent currently,

Acked-by: Eric Anholt 

but we should really just be using drm_gem_lock_reservations()
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 4/4] drm/vc4: Use dma_resv locking wrappers

2019-12-13 Thread Daniel Vetter
On Mon, Nov 25, 2019 at 10:43:56AM +0100, Daniel Vetter wrote:
> I'll add more fancy logic to them soon, so everyone really has to use
> them. Plus they already provide some nice additional debug
> infrastructure on top of direct ww_mutex usage for the fences tracked
> by dma_resv.
> 
> Signed-off-by: Daniel Vetter 

Ping for some review/acks.

Thanks, Daniel

> ---
>  drivers/gpu/drm/vc4/vc4_gem.c | 11 +--
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
> index 7a06cb6e31c5..e1cfc3ccd05a 100644
> --- a/drivers/gpu/drm/vc4/vc4_gem.c
> +++ b/drivers/gpu/drm/vc4/vc4_gem.c
> @@ -568,7 +568,7 @@ vc4_unlock_bo_reservations(struct drm_device *dev,
>   for (i = 0; i < exec->bo_count; i++) {
>   struct drm_gem_object *bo = >bo[i]->base;
>  
> - ww_mutex_unlock(>resv->lock);
> + dma_resv_unlock(bo->resv);
>   }
>  
>   ww_acquire_fini(acquire_ctx);
> @@ -595,8 +595,7 @@ vc4_lock_bo_reservations(struct drm_device *dev,
>  retry:
>   if (contended_lock != -1) {
>   bo = >bo[contended_lock]->base;
> - ret = ww_mutex_lock_slow_interruptible(>resv->lock,
> -acquire_ctx);
> + ret = dma_resv_lock_slow_interruptible(bo->resv, acquire_ctx);
>   if (ret) {
>   ww_acquire_done(acquire_ctx);
>   return ret;
> @@ -609,19 +608,19 @@ vc4_lock_bo_reservations(struct drm_device *dev,
>  
>   bo = >bo[i]->base;
>  
> - ret = ww_mutex_lock_interruptible(>resv->lock, acquire_ctx);
> + ret = dma_resv_lock_interruptible(bo->resv, acquire_ctx);
>   if (ret) {
>   int j;
>  
>   for (j = 0; j < i; j++) {
>   bo = >bo[j]->base;
> - ww_mutex_unlock(>resv->lock);
> + dma_resv_unlock(bo->resv);
>   }
>  
>   if (contended_lock != -1 && contended_lock >= i) {
>   bo = >bo[contended_lock]->base;
>  
> - ww_mutex_unlock(>resv->lock);
> + dma_resv_unlock(bo->resv);
>   }
>  
>   if (ret == -EDEADLK) {
> -- 
> 2.24.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx