drm/amdgpu: Don't move pinned BOs
Subsystems (2)
PATCH 1/1 drm/amdgpu: Don't move pinned BOs
From: Michel Dänzer <[email protected]>
The purpose of pinning is to prevent a buffer from moving.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 ++++++ 2 files changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4 -0
@@ -608,6 +608,10 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)if ((offset + size) <= adev->mc.visible_vram_size)return 0 ; +/* Can't move a pinned BO to visible VRAM */ +if (abo->pin_count >0 ) +return -EINVAL ; +/* hurrah the memory is not visible ! */ amdgpu_ttm_placement_from_domain (abo,AMDGPU_GEM_DOMAIN_VRAM ); lpfn = adev->mc.visible_vram_size >>PAGE_SHIFT ;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +6 -0
@@ -384,9 +384,15 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, struct ttm_mem_reg *new_mem) {struct amdgpu_device *adev; +struct amdgpu_bo *abo;struct ttm_mem_reg *old_mem = &bo->mem;int r; +/* Can't move a pinned BO */ + abo = container_of(bo, struct amdgpu_bo, tbo); +if (WARN_ON_ONCE (abo->pin_count >0 )) +return -EINVAL ; + adev =amdgpu_get_adev (bo->bdev);if (old_mem->mem_type ==TTM_PL_SYSTEM && bo->ttm ==NULL ) {amdgpu_move_null (bo, new_mem);
Signature · 6 lines
2.8.0.rc3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Am 28.03.2016 um 05:53 schrieb Michel Dänzer:
Quoted 7 lines
From: Michel Dänzer <[email protected]>
The purpose of pinning is to prevent a buffer from moving.
Reviewed-by Christian König <[email protected]>Tested-by Rex Zhu <[email protected]>Signed-off-by Michel Dänzer <[email protected]>
Well, that should not happen (at least when all the code for disallowing pinning into invisible VRAM works correctly).
But I would say better save than sorry, so this patch and the radeon version is Reviewed-by: Christian König <[email protected]>
Regards,
Christian.
Quoted 30 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 ++++++ 2 files changed, 10 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4
-0@@ -608,6 +608,10 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)if ((offset + size) <= adev->mc.visible_vram_size)return 0 ; +/* Can't move a pinned BO to visible VRAM */ +if (abo->pin_count >0 ) +return -EINVAL ; +/* hurrah the memory is not visible ! */ amdgpu_ttm_placement_from_domain (abo,AMDGPU_GEM_DOMAIN_VRAM ); lpfn = adev->mc.visible_vram_size >>PAGE_SHIFT ;drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-0@@ -384,9 +384,15 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, struct ttm_mem_reg *new_mem) {struct amdgpu_device *adev; +struct amdgpu_bo *abo;struct ttm_mem_reg *old_mem = &bo->mem;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static int amdgpu_bo_move(struct ttm_buffer_object *bo, · line 398
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +5
-0int r; +/* Can't move a pinned BO */ + abo = container_of(bo, struct amdgpu_bo, tbo); +if (WARN_ON_ONCE (abo->pin_count >0 )) +return -EINVAL ; + adev =amdgpu_get_adev (bo->bdev);if (old_mem->mem_type ==TTM_PL_SYSTEM && bo->ttm ==NULL ) {amdgpu_move_null (bo, new_mem);
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Alex Deucher
AppliedQuoted 11 lines · Christian König
Am 28.03.2016 um 05:53 schrieb Michel Dänzer:
Quoted 8 lines
From: Michel Dänzer <[email protected]>
The purpose of pinning is to prevent a buffer from moving.
Reviewed-by Christian König <[email protected]>Tested-by Rex Zhu <[email protected]>Signed-off-by Michel Dänzer <[email protected]>
Quoted 6 lines
Well, that should not happen (at least when all the code for disallowing pinning into invisible VRAM works correctly).
But I would say better save than sorry, so this patch and the radeon version is Reviewed-by: Christian König <[email protected]>
Applied both patches. Thanks!
Alex
Quoted 44 lines
Regards,
Christian.Quoted 40 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 ++++++ 2 files changed, 10 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3
-0@@ -608,6 +608,10 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)if ((offset + size) <= adev->mc.visible_vram_size)return 0 ; +/* Can't move a pinned BO to visible VRAM */ + if (abo->pin_count > 0) + return -EINVAL; +/* hurrah the memory is not visible ! */ amdgpu_ttm_placement_from_domain (abo,AMDGPU_GEM_DOMAIN_VRAM ); lpfn = adev->mc.visible_vram_size >>PAGE_SHIFT ;drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +5
-0@@ -384,9 +384,15 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, struct ttm_mem_reg *new_mem) {struct amdgpu_device *adev; +struct amdgpu_bo *abo;struct ttm_mem_reg *old_mem = &bo->mem;int r; +/* Can't move a pinned BO */ + abo = container_of(bo, struct amdgpu_bo, tbo); +if (WARN_ON_ONCE (abo->pin_count >0 )) +return -EINVAL ; + adev =amdgpu_get_adev (bo->bdev);
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static int amdgpu_bo_move(struct ttm_buffer_object *bo, · line 398
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0if (old_mem->mem_type ==TTM_PL_SYSTEM && bo->ttm ==NULL ) {amdgpu_move_null (bo, new_mem);_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel