diff mbox series

[2/4] drm/ttm: cleanup ttm_buffer_object_transfer

Message ID 20191111145832.37320-2-christian.koenig@amd.com (mailing list archive)
State New, archived
Headers show
Series [1/4] drm/ttm: refine ghost BO resv criteria | expand

Commit Message

Christian König Nov. 11, 2019, 2:58 p.m. UTC
The function is always called with deleted BOs.

While at it cleanup the indentation as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

Comments

Felix Kuehling Nov. 15, 2019, 10:27 p.m. UTC | #1
The subject doesn't match the change. This changes ttm_bo_cleanup_refs, 
not ttm_buffer_object_transfer.

On 2019-11-11 9:58 a.m., Christian König wrote:
> The function is always called with deleted BOs.
>
> While at it cleanup the indentation as well.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>   drivers/gpu/drm/ttm/ttm_bo.c | 12 +++---------
>   1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 7e7925fecd9e..1178980f4147 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -527,14 +527,9 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo,
>   			       bool interruptible, bool no_wait_gpu,
>   			       bool unlock_resv)
>   {
> -	struct dma_resv *resv;
> +	struct dma_resv *resv = &bo->base._resv;
>   	int ret;
>   
> -	if (unlikely(list_empty(&bo->ddestroy)))

Would it make sense to add a BUG_ON or WARN_ON here to check the 
assumption made by this code?

Regards,
   Felix

> -		resv = bo->base.resv;
> -	else
> -		resv = &bo->base._resv;
> -
>   	if (dma_resv_test_signaled_rcu(resv, true))
>   		ret = 0;
>   	else
> @@ -547,9 +542,8 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo,
>   			dma_resv_unlock(bo->base.resv);
>   		spin_unlock(&ttm_bo_glob.lru_lock);
>   
> -		lret = dma_resv_wait_timeout_rcu(resv, true,
> -							   interruptible,
> -							   30 * HZ);
> +		lret = dma_resv_wait_timeout_rcu(resv, true, interruptible,
> +						 30 * HZ);
>   
>   		if (lret < 0)
>   			return lret;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 7e7925fecd9e..1178980f4147 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -527,14 +527,9 @@  static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo,
 			       bool interruptible, bool no_wait_gpu,
 			       bool unlock_resv)
 {
-	struct dma_resv *resv;
+	struct dma_resv *resv = &bo->base._resv;
 	int ret;
 
-	if (unlikely(list_empty(&bo->ddestroy)))
-		resv = bo->base.resv;
-	else
-		resv = &bo->base._resv;
-
 	if (dma_resv_test_signaled_rcu(resv, true))
 		ret = 0;
 	else
@@ -547,9 +542,8 @@  static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo,
 			dma_resv_unlock(bo->base.resv);
 		spin_unlock(&ttm_bo_glob.lru_lock);
 
-		lret = dma_resv_wait_timeout_rcu(resv, true,
-							   interruptible,
-							   30 * HZ);
+		lret = dma_resv_wait_timeout_rcu(resv, true, interruptible,
+						 30 * HZ);
 
 		if (lret < 0)
 			return lret;