drm/amdgpu: fix placement flags in amdgpu_ttm_bind
Subsystems (2)
PATCH 1/1 drm/amdgpu: fix placement flags in amdgpu_ttm_bind
From: Christian König <[email protected]>
Otherwise we lose the NO_EVICT flag and can try to evict pinned BOs.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
@@ -819,7 +819,7 @@ int amdgpu_ttm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *bo_mem) placement.busy_placement = &placements; placements.fpfn =0 ; placements.lpfn = adev->mc.gart_size >>PAGE_SHIFT ; - placements.flags =TTM_PL_MASK_CACHING |TTM_PL_FLAG_TT ; + placements.flags = bo->mem.placement |TTM_PL_FLAG_TT ; r =ttm_bo_mem_space (bo, &placement, &tmp, true, false);if (unlikely (r))
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): 1504250669-1590-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
Deucher, Alexander
Reviewed-by Alex DeucherQuoted 8 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Friday, September 01, 2017 3:24 AM
To: [email protected]
Cc: Kuehling, Felix; Russell, Kent
Subject: [PATCH] drm/amdgpu: fix placement flags inamdgpu_ttm_bind
Quoted 5 lines
From: Christian König <[email protected]>
Otherwise we lose the
NO_EVICTflag and can try to evict pinned BOs.Signed-off-by Christian König <[email protected]>
Quoted 22 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-1@@ -819,7 +819,7 @@ int amdgpu_ttm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *bo_mem) placement.busy_placement = &placements; placements.fpfn =0 ; placements.lpfn = adev->mc.gart_size >>PAGE_SHIFT ; - placements.flags =TTM_PL_MASK_CACHING |TTM_PL_FLAG_TT ; + placements.flags = bo->mem.placement |TTM_PL_FLAG_TT ; r =ttm_bo_mem_space (bo, &placement, &tmp, true, false);if (unlikely(r))
--
2.7.4
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Thanks for the fix. I still don't quite understand how this works. We still call ttm_bo_move_ttm for a pinned BO. Maybe the function name is misleading. As I understand it, this doesn't move the memory physically. It just changes the GART address mapping? All that's needed is maintaining the flags to ensure that the pinned BO stays off the LRU lists and won't get swapped out?
Thanks,
Felix
Quoted 14 lines · Christian König
From: Christian König <[email protected]>
Otherwise we lose the
NO_EVICTflag and can try to evict pinned BOs.Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_ttm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *bo_mem) · line 825
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-1@@ -819,7 +819,7 @@ int amdgpu_ttm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *bo_mem) placement.busy_placement = &placements; placements.fpfn =0 ; placements.lpfn = adev->mc.gart_size >>PAGE_SHIFT ; - placements.flags =TTM_PL_MASK_CACHING |TTM_PL_FLAG_TT ; + placements.flags = bo->mem.placement |TTM_PL_FLAG_TT ; r =ttm_bo_mem_space (bo, &placement, &tmp, true, false);if (unlikely (r))
_______________________________________________
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): 7ad01d92-b07d-db94-fac3-69033cf5cfe5-5C7GfCeVMHo@public.gmane.org
Quoted 8 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Felix Kuehling
Sent: Friday, September 01, 2017 3:18 PM
To: Christian König; [email protected]
Cc: Russell, Kent
Subject: Re: [PATCH] drm/amdgpu: fix placement flags inamdgpu_ttm_bind
Quoted 6 lines
Thanks for the fix. I still don't quite understand how this works. We still call
ttm_bo_move_ttmfor a pinned BO. Maybe the function name is misleading. As I understand it, this doesn't move the memory physically. It just changes the GART address mapping? All that's needed is maintaining the flags to ensure that the pinned BO stays off the LRU lists and won't get swapped out?
It's been a while since I traced through this, but as long as the flag is retained, it will be checked in ttm_bo_add_to_lru() and if set the bo won't be added to the LRU list. ttm_bo_move_ttm() is always called via amdgpu_ttm_bind() as part of the initial pinning process in amdgpu_bo_pin_restricted().
Alex
Quoted 28 lines
Thanks,
FelixReview
Quoted 10 lines · Christian König
From: Christian König <[email protected]>
Otherwise we lose the
NO_EVICTflag and can try to evict pinned BOs.Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.cdrivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_ttm_bind(struct ttm_buffer_object
Quoted 4 lines
index e9a0518..ac14c18 100644
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0@@ -819,7 +819,7 @@ int amdgpu_ttm_bind(struct ttm_buffer_object*bo, struct
ttm_mem_reg*bo_mem)Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-1placement.busy_placement = &placements; placements.fpfn =0 ; placements.lpfn = adev->mc.gart_size >>PAGE_SHIFT ; - placements.flags =TTM_PL_MASK_CACHING |TTM_PL_FLAG_TT ; + placements.flags = bo->mem.placement |TTM_PL_FLAG_TT ;
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_ttm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *bo_mem) · line 825
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0r =ttm_bo_mem_space (bo, &placement, &tmp, true, false);if (unlikely (r))_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
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): BN6PR12MB165267D7FBDAF971242FB6A5F7920-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Am 01.09.2017 um 21:58 schrieb Deucher, Alexander:
Quoted 8 lines
Quoted 8 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Felix Kuehling
Sent: Friday, September 01, 2017 3:18 PM
To: Christian König; [email protected]
Cc: Russell, Kent
Subject: Re: [PATCH] drm/amdgpu: fix placement flags inamdgpu_ttm_bind
Quoted 4 lines
Quoted 4 lines
Thanks for the fix. I still don't quite understand how this works. We still call
ttm_bo_move_ttmfor a pinned BO. Maybe the function name is misleading. As I understand it, this doesn't move the memory physically. It just changes the GART address mapping?
Correct, the physical backing memory stays the same. The function just moves the TTM from one ttm_mem_reg structure to another and unbind/binds it in between.
Quoted 4 lines
Quoted 3 lines
All that's needed is
maintaining the flags to ensure that the pinned BO stays off the LRU lists and won't get swapped out?It's been a while since I traced through this, but as long as the flag is retained, it will be checked in
ttm_bo_add_to_lru()and if set the bo won't be added to the LRU list.ttm_bo_move_ttm()is always called viaamdgpu_ttm_bind()as part of the initial pinning process inamdgpu_bo_pin_restricted().
Correct as well, we just need to make sure the mem->placement flags are correct when the BO is unreserved.
Christian.
Quoted 36 lines
Alex
Quoted 27 lines
Thanks,
FelixReview
Quoted 10 lines · Christian König
From: Christian König <[email protected]>
Otherwise we lose the
NO_EVICTflag and can try to evict pinned BOs.Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.cdrivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_ttm_bind(struct ttm_buffer_object
Quoted 4 lines
index e9a0518..ac14c18 100644
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0@@ -819,7 +819,7 @@ int amdgpu_ttm_bind(struct ttm_buffer_object*bo, struct
ttm_mem_reg*bo_mem)Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-1placement.busy_placement = &placements; placements.fpfn =0 ; placements.lpfn = adev->mc.gart_size >>PAGE_SHIFT ; - placements.flags =TTM_PL_MASK_CACHING |TTM_PL_FLAG_TT ; + placements.flags = bo->mem.placement |TTM_PL_FLAG_TT ;Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_ttm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *bo_mem) · line 825
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0r =ttm_bo_mem_space (bo, &placement, &tmp, true, false);if (unlikely (r))_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx