diff mbox

[1/6] drm/ttm: remove no_gpu_wait param from ttm_bo_move_accel_cleanup

Message ID 1465991045-2328-1-git-send-email-deathsimple@vodafone.de (mailing list archive)
State New, archived
Headers show

Commit Message

Christian König June 15, 2016, 11:44 a.m. UTC
From: Christian König <christian.koenig@amd.com>

It isn't used and not waiting for the GPU after scheduling a move is
actually quite dangerous.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +--
 drivers/gpu/drm/nouveau/nouveau_bo.c    | 1 -
 drivers/gpu/drm/radeon/radeon_ttm.c     | 3 +--
 drivers/gpu/drm/ttm/ttm_bo_util.c       | 1 -
 include/drm/ttm/ttm_bo_driver.h         | 4 +---
 5 files changed, 3 insertions(+), 9 deletions(-)

Comments

Christian König June 15, 2016, 1:27 p.m. UTC | #1
Alex do you want to pull that in through your branches or should I send 
Dave a separate pull request for the TTM changes?

BTW: I'm trying to enable this on radeon as well. In theory it should 
work out of the box.

Regards,
Christian.

Am 15.06.2016 um 13:44 schrieb Christian König:
> From: Christian König <christian.koenig@amd.com>
>
> It isn't used and not waiting for the GPU after scheduling a move is
> actually quite dangerous.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +--
>   drivers/gpu/drm/nouveau/nouveau_bo.c    | 1 -
>   drivers/gpu/drm/radeon/radeon_ttm.c     | 3 +--
>   drivers/gpu/drm/ttm/ttm_bo_util.c       | 1 -
>   include/drm/ttm/ttm_bo_driver.h         | 4 +---
>   5 files changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 232f123..b2b9df6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -287,8 +287,7 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,
>   			       new_mem->num_pages * PAGE_SIZE, /* bytes */
>   			       bo->resv, &fence);
>   	/* FIXME: handle copy error */
> -	r = ttm_bo_move_accel_cleanup(bo, fence,
> -				      evict, no_wait_gpu, new_mem);
> +	r = ttm_bo_move_accel_cleanup(bo, fence, evict, new_mem);
>   	fence_put(fence);
>   	return r;
>   }
> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
> index b61660b..49ae191 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
> @@ -1082,7 +1082,6 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr,
>   				ret = ttm_bo_move_accel_cleanup(bo,
>   								&fence->base,
>   								evict,
> -								no_wait_gpu,
>   								new_mem);
>   				nouveau_fence_unref(&fence);
>   			}
> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
> index 20ca22d..ffdad81 100644
> --- a/drivers/gpu/drm/radeon/radeon_ttm.c
> +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
> @@ -300,8 +300,7 @@ static int radeon_move_blit(struct ttm_buffer_object *bo,
>   	if (IS_ERR(fence))
>   		return PTR_ERR(fence);
>   
> -	r = ttm_bo_move_accel_cleanup(bo, &fence->base,
> -				      evict, no_wait_gpu, new_mem);
> +	r = ttm_bo_move_accel_cleanup(bo, &fence->base, evict, new_mem);
>   	radeon_fence_unref(&fence);
>   	return r;
>   }
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index 434f239..c8fe554 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -637,7 +637,6 @@ EXPORT_SYMBOL(ttm_bo_kunmap);
>   int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
>   			      struct fence *fence,
>   			      bool evict,
> -			      bool no_wait_gpu,
>   			      struct ttm_mem_reg *new_mem)
>   {
>   	struct ttm_bo_device *bdev = bo->bdev;
> diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
> index 0d1d9d7..697e5f9 100644
> --- a/include/drm/ttm/ttm_bo_driver.h
> +++ b/include/drm/ttm/ttm_bo_driver.h
> @@ -1004,7 +1004,6 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
>    * @bo: A pointer to a struct ttm_buffer_object.
>    * @fence: A fence object that signals when moving is complete.
>    * @evict: This is an evict move. Don't return until the buffer is idle.
> - * @no_wait_gpu: Return immediately if the GPU is busy.
>    * @new_mem: struct ttm_mem_reg indicating where to move.
>    *
>    * Accelerated move function to be called when an accelerated move
> @@ -1016,8 +1015,7 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
>    */
>   
>   extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
> -				     struct fence *fence,
> -				     bool evict, bool no_wait_gpu,
> +				     struct fence *fence, bool evict,
>   				     struct ttm_mem_reg *new_mem);
>   /**
>    * ttm_io_prot
Alex Deucher June 15, 2016, 3:57 p.m. UTC | #2
On Wed, Jun 15, 2016 at 9:27 AM, Christian König
<christian.koenig@amd.com> wrote:
> Alex do you want to pull that in through your branches or should I send Dave
> a separate pull request for the TTM changes?

I'll pick it up today.

>
> BTW: I'm trying to enable this on radeon as well. In theory it should work
> out of the box.

Excellent!

Alex

>
> Regards,
> Christian.
>
>
> Am 15.06.2016 um 13:44 schrieb Christian König:
>>
>> From: Christian König <christian.koenig@amd.com>
>>
>> It isn't used and not waiting for the GPU after scheduling a move is
>> actually quite dangerous.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +--
>>   drivers/gpu/drm/nouveau/nouveau_bo.c    | 1 -
>>   drivers/gpu/drm/radeon/radeon_ttm.c     | 3 +--
>>   drivers/gpu/drm/ttm/ttm_bo_util.c       | 1 -
>>   include/drm/ttm/ttm_bo_driver.h         | 4 +---
>>   5 files changed, 3 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> index 232f123..b2b9df6 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> @@ -287,8 +287,7 @@ static int amdgpu_move_blit(struct ttm_buffer_object
>> *bo,
>>                                new_mem->num_pages * PAGE_SIZE, /* bytes */
>>                                bo->resv, &fence);
>>         /* FIXME: handle copy error */
>> -       r = ttm_bo_move_accel_cleanup(bo, fence,
>> -                                     evict, no_wait_gpu, new_mem);
>> +       r = ttm_bo_move_accel_cleanup(bo, fence, evict, new_mem);
>>         fence_put(fence);
>>         return r;
>>   }
>> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c
>> b/drivers/gpu/drm/nouveau/nouveau_bo.c
>> index b61660b..49ae191 100644
>> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
>> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
>> @@ -1082,7 +1082,6 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo,
>> int evict, bool intr,
>>                                 ret = ttm_bo_move_accel_cleanup(bo,
>>
>> &fence->base,
>>                                                                 evict,
>> -
>> no_wait_gpu,
>>                                                                 new_mem);
>>                                 nouveau_fence_unref(&fence);
>>                         }
>> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c
>> b/drivers/gpu/drm/radeon/radeon_ttm.c
>> index 20ca22d..ffdad81 100644
>> --- a/drivers/gpu/drm/radeon/radeon_ttm.c
>> +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
>> @@ -300,8 +300,7 @@ static int radeon_move_blit(struct ttm_buffer_object
>> *bo,
>>         if (IS_ERR(fence))
>>                 return PTR_ERR(fence);
>>   -     r = ttm_bo_move_accel_cleanup(bo, &fence->base,
>> -                                     evict, no_wait_gpu, new_mem);
>> +       r = ttm_bo_move_accel_cleanup(bo, &fence->base, evict, new_mem);
>>         radeon_fence_unref(&fence);
>>         return r;
>>   }
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c
>> b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> index 434f239..c8fe554 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> @@ -637,7 +637,6 @@ EXPORT_SYMBOL(ttm_bo_kunmap);
>>   int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
>>                               struct fence *fence,
>>                               bool evict,
>> -                             bool no_wait_gpu,
>>                               struct ttm_mem_reg *new_mem)
>>   {
>>         struct ttm_bo_device *bdev = bo->bdev;
>> diff --git a/include/drm/ttm/ttm_bo_driver.h
>> b/include/drm/ttm/ttm_bo_driver.h
>> index 0d1d9d7..697e5f9 100644
>> --- a/include/drm/ttm/ttm_bo_driver.h
>> +++ b/include/drm/ttm/ttm_bo_driver.h
>> @@ -1004,7 +1004,6 @@ extern void ttm_bo_free_old_node(struct
>> ttm_buffer_object *bo);
>>    * @bo: A pointer to a struct ttm_buffer_object.
>>    * @fence: A fence object that signals when moving is complete.
>>    * @evict: This is an evict move. Don't return until the buffer is idle.
>> - * @no_wait_gpu: Return immediately if the GPU is busy.
>>    * @new_mem: struct ttm_mem_reg indicating where to move.
>>    *
>>    * Accelerated move function to be called when an accelerated move
>> @@ -1016,8 +1015,7 @@ extern void ttm_bo_free_old_node(struct
>> ttm_buffer_object *bo);
>>    */
>>     extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
>> -                                    struct fence *fence,
>> -                                    bool evict, bool no_wait_gpu,
>> +                                    struct fence *fence, bool evict,
>>                                      struct ttm_mem_reg *new_mem);
>>   /**
>>    * ttm_io_prot
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 232f123..b2b9df6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -287,8 +287,7 @@  static int amdgpu_move_blit(struct ttm_buffer_object *bo,
 			       new_mem->num_pages * PAGE_SIZE, /* bytes */
 			       bo->resv, &fence);
 	/* FIXME: handle copy error */
-	r = ttm_bo_move_accel_cleanup(bo, fence,
-				      evict, no_wait_gpu, new_mem);
+	r = ttm_bo_move_accel_cleanup(bo, fence, evict, new_mem);
 	fence_put(fence);
 	return r;
 }
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index b61660b..49ae191 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -1082,7 +1082,6 @@  nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr,
 				ret = ttm_bo_move_accel_cleanup(bo,
 								&fence->base,
 								evict,
-								no_wait_gpu,
 								new_mem);
 				nouveau_fence_unref(&fence);
 			}
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 20ca22d..ffdad81 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -300,8 +300,7 @@  static int radeon_move_blit(struct ttm_buffer_object *bo,
 	if (IS_ERR(fence))
 		return PTR_ERR(fence);
 
-	r = ttm_bo_move_accel_cleanup(bo, &fence->base,
-				      evict, no_wait_gpu, new_mem);
+	r = ttm_bo_move_accel_cleanup(bo, &fence->base, evict, new_mem);
 	radeon_fence_unref(&fence);
 	return r;
 }
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 434f239..c8fe554 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -637,7 +637,6 @@  EXPORT_SYMBOL(ttm_bo_kunmap);
 int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
 			      struct fence *fence,
 			      bool evict,
-			      bool no_wait_gpu,
 			      struct ttm_mem_reg *new_mem)
 {
 	struct ttm_bo_device *bdev = bo->bdev;
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 0d1d9d7..697e5f9 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -1004,7 +1004,6 @@  extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
  * @bo: A pointer to a struct ttm_buffer_object.
  * @fence: A fence object that signals when moving is complete.
  * @evict: This is an evict move. Don't return until the buffer is idle.
- * @no_wait_gpu: Return immediately if the GPU is busy.
  * @new_mem: struct ttm_mem_reg indicating where to move.
  *
  * Accelerated move function to be called when an accelerated move
@@ -1016,8 +1015,7 @@  extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
  */
 
 extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
-				     struct fence *fence,
-				     bool evict, bool no_wait_gpu,
+				     struct fence *fence, bool evict,
 				     struct ttm_mem_reg *new_mem);
 /**
  * ttm_io_prot