drm/ttm: add allow_reserved_eviction and resv into ttm_operation_ctx
Subsystems (4)
PATCH 1/3 drm/ttm: add allow_reserved_eviction and resv into ttm_operation_ctx
allow_reserved_eviction: Allow eviction of reserved BOs
resv: Reservation object to allow reserved evictions with
--- include/drm/ttm/ttm_bo_api.h | 4 ++++ 1 file changed, 4 insertions(+)
include/drm/ttm/ttm_bo_api.h +4 -0
@@ -263,6 +263,8 @@ struct ttm_bo_kmap_obj {* * @interruptible: Sleep interruptible if sleeping. * @no_wait_gpu: Return immediately if the GPU is busy. +* @allow_reserved_eviction: Allow eviction of reserved BOs. +* @resv: Reservation object to allow reserved evictions with. * * Context for TTM operations like changing buffer placement or general memory * allocation.
@@ -270,6 +272,8 @@ struct ttm_bo_kmap_obj {struct ttm_operation_ctx {bool interruptible;bool no_wait_gpu; +bool allow_reserved_eviction; +struct reservation_object *resv;uint64_t bytes_moved; };
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1513142278-4294-1-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org
PATCH 2/3 drm/amd/amdgpu: init allow_reserved_eviction and resv when create a new bo
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -1
@@ -327,7 +327,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,uint64_t init_value, struct amdgpu_bo **bo_ptr) { - struct ttm_operation_ctx ctx = { !kernel, false }; + struct ttm_operation_ctx ctx = { !kernel, false, true, resv };struct amdgpu_bo *bo;enum ttm_bo_type type;unsigned long page_align;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1513142278-4294-2-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/3] drm/amd/amdgpu: init allow_reserved_eviction and resv when create a new bo
Am 13.12.2017 um 06:17 schrieb Roger He:
Quoted 2 lines
Change-Id I0c6571c2a64e6c5bdad80ccbcccb40eba1c20b4eSigned-off-by Roger He <[email protected]>
We should supply the resv object in amdgpu_cs_bo_validate() as well, or otherwise the deleted object handling won't work as desired any more.
Apart from that looks good to me.
Christian.
Quoted 9 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c static int amdgpu_bo_do_create(struct amdgpu_device *adev, · line 333
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1
-1@@ -327,7 +327,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,uint64_t init_value, struct amdgpu_bo **bo_ptr) { - struct ttm_operation_ctx ctx = { !kernel, false }; + struct ttm_operation_ctx ctx = { !kernel, false, true, resv };struct amdgpu_bo *bo;enum ttm_bo_type type;unsigned long page_align;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/3] drm/amd/amdgpu: init allow_reserved_eviction and resv when create a new bo
In reply to Roger HeQuoted 11 lines · Roger He
Change-Id I0c6571c2a64e6c5bdad80ccbcccb40eba1c20b4eSigned-off-by Roger He <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c static int amdgpu_bo_do_create(struct amdgpu_device *adev, · line 330
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1
-1@@ -327,7 +327,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,uint64_t init_value, struct amdgpu_bo **bo_ptr) { - struct ttm_operation_ctx ctx = { !kernel, false }; + struct ttm_operation_ctx ctx = { !kernel, false, true, resv };
Please use named initializers, to make it easier to understand which field is initialized to which value.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/3 drm/ttm: enable eviction for Per-VM-BO
In reply to a message not in the archive--- drivers/gpu/drm/ttm/ttm_bo.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +4 -8
@@ -707,7 +707,6 @@ bool ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,EXPORT_SYMBOL (ttm_bo_eviction_valuable);static int ttm_mem_evict_first (struct ttm_bo_device *bdev, -struct reservation_object *resv,uint32_t mem_type,const struct ttm_place *place,struct ttm_operation_ctx *ctx)
@@ -722,10 +721,8 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev,spin_lock (&glob->lru_lock);for (i =0 ; i <TTM_MAX_BO_PRIORITY ; ++i) {list_for_each_entry (bo, &man->lru[i], lru) { -if (bo->resv == resv) { -if (list_empty (&bo->ddestroy)) -continue ; - }else { +if (!ctx->allow_reserved_eviction || + bo->resv != ctx->resv) { locked =reservation_object_trylock (bo->resv);if (!locked)continue ;
@@ -835,7 +832,7 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo,return ret;if (mem->mm_node)break ; - ret =ttm_mem_evict_first (bdev, bo->resv, mem_type, place, ctx); + ret =ttm_mem_evict_first (bdev, mem_type, place, ctx);if (unlikely (ret !=0 ))return ret; }while (1 );
@@ -1332,8 +1329,7 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,for (i =0 ; i <TTM_MAX_BO_PRIORITY ; ++i) {while (!list_empty (&man->lru[i])) {spin_unlock (&glob->lru_lock); - ret =ttm_mem_evict_first (bdev,NULL , mem_type, -NULL , &ctx); + ret =ttm_mem_evict_first (bdev, mem_type,NULL , &ctx);if (ret)return ret;spin_lock (&glob->lru_lock);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1513142278-4294-3-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 3/3] drm/ttm: enable eviction for Per-VM-BO
Am 13.12.2017 um 06:17 schrieb Roger He:
Quoted 19 lines
Change-Id I0c6ece0decd18d30ccc94e5c7ca106d351941c62Signed-off-by Roger He <[email protected]>--- drivers/gpu/drm/ttm/ttm_bo.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)drivers/gpu/drm/ttm/ttm_bo.c +0
-1@@ -707,7 +707,6 @@ bool ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,EXPORT_SYMBOL (ttm_bo_eviction_valuable);static int ttm_mem_evict_first (struct ttm_bo_device *bdev, -struct reservation_object *resv,uint32_t mem_type,const struct ttm_place *place,struct ttm_operation_ctx *ctx)
drivers/gpu/drm/ttm/ttm_bo.c static int ttm_mem_evict_first(struct ttm_bo_device *bdev, · line 725
Quoted 9 lines
drivers/gpu/drm/ttm/ttm_bo.c +2
-4@@ -722,10 +721,8 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev,spin_lock (&glob->lru_lock);for (i =0 ; i <TTM_MAX_BO_PRIORITY ; ++i) {list_for_each_entry (bo, &man->lru[i], lru) { -if (bo->resv == resv) { -if (list_empty (&bo->ddestroy)) -continue ; - }else { +if (!ctx->allow_reserved_eviction || + bo->resv != ctx->resv) {
That will still disable destroyed BO handling during command submission which isn't a good idea I think.
Apart from that the "bo->resv != ctx->resv" is still indented to far to the right. This makes it look like it belongs to the "locked = ..." on the line below.
Christian.
Quoted 13 lines
drivers/gpu/drm/ttm/ttm_bo.c +1
-1locked =reservation_object_trylock (bo->resv);if (!locked)continue ;@@ -835,7 +832,7 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo,return ret;if (mem->mm_node)break ; - ret =ttm_mem_evict_first (bdev, bo->resv, mem_type, place, ctx); + ret =ttm_mem_evict_first (bdev, mem_type, place, ctx);if (unlikely (ret !=0 ))return ret; }while (1 );
drivers/gpu/drm/ttm/ttm_bo.c static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev, · line 1335
Quoted 9 lines
drivers/gpu/drm/ttm/ttm_bo.c +1
-2@@ -1332,8 +1329,7 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,for (i =0 ; i <TTM_MAX_BO_PRIORITY ; ++i) {while (!list_empty (&man->lru[i])) {spin_unlock (&glob->lru_lock); - ret =ttm_mem_evict_first (bdev,NULL , mem_type, -NULL , &ctx); + ret =ttm_mem_evict_first (bdev, mem_type,NULL , &ctx);if (ret)return ret;spin_lock (&glob->lru_lock);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
Reviewed-byAm 13.12.2017 um 06:17 schrieb Roger He:
Quoted 5 lines
allow_reserved_eviction: Allow eviction of reserved BOs
resv: Reservation object to allow reserved evictions withChange-Id I01ea482e8c7470014196eb218e2ff8913306eef0Signed-off-by Roger He <[email protected]>
Quoted 18 lines
--- include/drm/ttm/ttm_bo_api.h | 4 ++++ 1 file changed, 4 insertions(+)include/drm/ttm/ttm_bo_api.h +2
-0@@ -263,6 +263,8 @@ struct ttm_bo_kmap_obj {* * @interruptible: Sleep interruptible if sleeping. * @no_wait_gpu: Return immediately if the GPU is busy. +* @allow_reserved_eviction: Allow eviction of reserved BOs. +* @resv: Reservation object to allow reserved evictions with. * * Context for TTM operations like changing buffer placement or general memory * allocation.
include/drm/ttm/ttm_bo_api.h struct ttm_bo_kmap_obj { · line 279
Quoted 8 lines
include/drm/ttm/ttm_bo_api.h +2
-0@@ -270,6 +272,8 @@ struct ttm_bo_kmap_obj {struct ttm_operation_ctx {bool interruptible;bool no_wait_gpu; +bool allow_reserved_eviction; +struct reservation_object *resv;uint64_t bytes_moved; };
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx