On 13/11/17 10:54 AM, Christian König wrote:
> Needed for the next patch.
> 
> v2: actually predicate all unlocks
> 
> Signed-off-by: Christian König <christian.koe...@amd.com>

[...]

> @@ -531,24 +533,28 @@ static int ttm_bo_cleanup_refs_and_unlock(struct 
> ttm_buffer_object *bo,
>                       return -EBUSY;
>  
>               spin_lock(&glob->lru_lock);
> -             ret = reservation_object_trylock(bo->resv) ? 0 : -EBUSY;
> -
> -             /*
> -              * We raced, and lost, someone else holds the reservation now,
> -              * and is probably busy in ttm_bo_cleanup_memtype_use.
> -              *
> -              * Even if it's not the case, because we finished waiting any
> -              * delayed destruction would succeed, so just return success
> -              * here.
> -              */
> -             if (ret) {
> -                     spin_unlock(&glob->lru_lock);
> -                     return 0;
> +             if (unlock_resv) {
> +                     ret = reservation_object_trylock(bo->resv) ? 0 : -EBUSY;
> +                     /*
> +                      * We raced, and lost, someone else holds the 
> reservation now,
> +                      * and is probably busy in ttm_bo_cleanup_memtype_use.
> +                      *
> +                      * Even if it's not the case, because we finished 
> waiting any
> +                      * delayed destruction would succeed, so just return 
> success
> +                      * here.
> +                      */
> +                     if (ret) {
> +                             spin_unlock(&glob->lru_lock);
> +                             return 0;
> +                     }
> +             } else {
> +                     ret = 0;
>               }
>       }

This could be simplified slightly:

                if (unlock_resv && !reservation_object_trylock(bo->resv)) {
                        /*
                         * We raced, and lost, someone else holds the 
reservation now,
                         * and is probably busy in ttm_bo_cleanup_memtype_use.
                         *
                         * Even if it's not the case, because we finished 
waiting any
                         * delayed destruction would succeed, so just return 
success
                         * here.
                         */
                        spin_unlock(&glob->lru_lock);
                        return 0;
                }

                ret = 0;
        }


Either way, this patch is


Reviewed-and-Tested-by: Michel Dänzer <michel.daen...@amd.com>


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to