drm/radeon: fix radeon_move_blit on 32bit systems
Subsystems (2)
PATCH 1/5 drm/radeon: fix radeon_move_blit on 32bit systems
From: Christian König <[email protected]>
This bug seems to be present for a very long time.
--- drivers/gpu/drm/radeon/radeon_ttm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_ttm.c +2 -2
@@ -263,8 +263,8 @@ static int radeon_move_blit(struct ttm_buffer_object *bo, rdev =radeon_get_rdev (bo->bdev); ridx =radeon_copy_ring_index (rdev); - old_start = old_mem->start <<PAGE_SHIFT ; - new_start = new_mem->start <<PAGE_SHIFT ; + old_start = (u64 )old_mem->start <<PAGE_SHIFT ; + new_start = (u64 )new_mem->start <<PAGE_SHIFT ;switch (old_mem->mem_type) {case TTM_PL_VRAM :
Signature · 6 lines
2.5.0 _______________________________________________ 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): 1471436784-13252-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
PATCH 2/5 drm/amdgpu: fix amdgpu_move_blit on 32bit systems
From: Christian König <[email protected]>
This bug seems to be present for a very long time.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -2
@@ -252,8 +252,8 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo, adev =amdgpu_get_adev (bo->bdev); ring = adev->mman.buffer_funcs_ring; - old_start = old_mem->start <<PAGE_SHIFT ; - new_start = new_mem->start <<PAGE_SHIFT ; + old_start = (u64 )old_mem->start <<PAGE_SHIFT ; + new_start = (u64 )new_mem->start <<PAGE_SHIFT ;switch (old_mem->mem_type) {case TTM_PL_VRAM :
Signature · 6 lines
2.5.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/5 drm/amdgpu: fix lru size grouping
In reply to a message not in the archiveFrom: Christian König <[email protected]>
Adding a BO can make it the insertion point for larger sizes as well.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 ++++++++ 2 files changed, 9 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -428,6 +428,7 @@ struct amdgpu_mman {/* custom LRU management */ struct amdgpu_mman_lru log2_size[AMDGPU_TTM_LRU_SIZE ]; +struct amdgpu_mman_lru guard; }; int amdgpu_copy_buffer(struct amdgpu_ring *ring,
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +8 -0
@@ -951,6 +951,8 @@ static struct list_head *amdgpu_ttm_lru_tail(struct ttm_buffer_object *tbo)struct list_head *res = lru->lru[tbo->mem.mem_type]; lru->lru[tbo->mem.mem_type] = &tbo->lru; +while ((++lru)->lru[tbo->mem.mem_type] == res) + lru->lru[tbo->mem.mem_type] = &tbo->lru;return res; }
@@ -961,6 +963,8 @@ static struct list_head *amdgpu_ttm_swap_lru_tail(struct ttm_buffer_object *tbo)struct list_head *res = lru->swap_lru; lru->swap_lru = &tbo->swap; +while ((++lru)->swap_lru == res) + lru->swap_lru = &tbo->swap;return res; }
@@ -1008,6 +1012,10 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) lru->swap_lru = &adev->mman.bdev.glob->swap_lru; } +for (j =0 ; j <TTM_NUM_MEM_TYPES ; ++j) + adev->mman.guard.lru[j] =NULL ; + adev->mman.guard.swap_lru =NULL ; + adev->mman.initialized = true; r =ttm_bo_init_mm (&adev->mman.bdev,TTM_PL_VRAM , adev->mc.real_vram_size >>PAGE_SHIFT );
Signature · 6 lines
2.5.0 _______________________________________________ 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): 1471436784-13252-3-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
Re: [PATCH 3/5] drm/amdgpu: fix lru size grouping
One suggestion inline [FK].
With that fixed, Reviewed-by: Felix Kuehling <[email protected]>
Regards,
Felix
Quoted 15 lines · Christian König
From: Christian König <[email protected]>
Adding a BO can make it the insertion point for larger sizes as well.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 ++++++++ 2 files changed, 9 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_mman { · line 431
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -428,6 +428,7 @@ struct amdgpu_mman {/* custom LRU management */ struct amdgpu_mman_lru log2_size[AMDGPU_TTM_LRU_SIZE ]; +struct amdgpu_mman_lru guard;
[FK] It would be safer to make the array AMDGPU_TTM_LRU_SIZE+1, instead of adding a separate guard afterwards. That way the guard can't get accidentally separated by a future change.
Quoted 26 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0}; int amdgpu_copy_buffer(struct amdgpu_ring *ring,drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4
-0@@ -951,6 +951,8 @@ static struct list_head *amdgpu_ttm_lru_tail(struct ttm_buffer_object *tbo)struct list_head *res = lru->lru[tbo->mem.mem_type]; lru->lru[tbo->mem.mem_type] = &tbo->lru; +while ((++lru)->lru[tbo->mem.mem_type] == res) + lru->lru[tbo->mem.mem_type] = &tbo->lru;return res; }@@ -961,6 +963,8 @@ static struct list_head *amdgpu_ttm_swap_lru_tail(struct ttm_buffer_object *tbo)struct list_head *res = lru->swap_lru; lru->swap_lru = &tbo->swap; +while ((++lru)->swap_lru == res) + lru->swap_lru = &tbo->swap;return res; }
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_ttm_init(struct amdgpu_device *adev) · line 1021
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4
-0@@ -1008,6 +1012,10 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) lru->swap_lru = &adev->mman.bdev.glob->swap_lru; } +for (j =0 ; j <TTM_NUM_MEM_TYPES ; ++j) + adev->mman.guard.lru[j] =NULL ; + adev->mman.guard.swap_lru =NULL ; + adev->mman.initialized = true; r =ttm_bo_init_mm (&adev->mman.bdev,TTM_PL_VRAM , adev->mc.real_vram_size >>PAGE_SHIFT );
_______________________________________________
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): cdd78daa-d6d8-b211-c4cc-1747bda7162f-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 3/5] drm/amdgpu: fix lru size grouping
Quoted 6 lines
/* custom LRU management */ struct amdgpu_mman_lru log2_size[AMDGPU_TTM_LRU_SIZE];drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0+struct amdgpu_mman_lru guard;[FK] It would be safer to make the array AMDGPU_TTM_LRU_SIZE+1, instead of adding a separate guard afterwards. That way the guard can't get accidentally separated by a future change.
Thought about that as well, but decided against it. The crux is just that ARRAY_SIZE() won't return the expected value any more.
I'm going to add a comment explaining that this shouldn't be moved apart.
Christian.
Am 17.08.2016 um 23:00 schrieb Felix Kuehling:
Quoted 61 lines
One suggestion inline [FK].
With that fixed, Reviewed-by: Felix Kuehling <[email protected]>
Regards,
FelixQuoted 15 lines · Christian König
From: Christian König <[email protected]>
Adding a BO can make it the insertion point for larger sizes as well.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 ++++++++ 2 files changed, 9 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_mman { · line 431
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -428,6 +428,7 @@ struct amdgpu_mman {/* custom LRU management */ struct amdgpu_mman_lru log2_size[AMDGPU_TTM_LRU_SIZE ]; +struct amdgpu_mman_lru guard;[FK] It would be safer to make the array AMDGPU_TTM_LRU_SIZE+1, instead of adding a separate guard afterwards. That way the guard can't get accidentally separated by a future change.
Quoted 29 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0}; int amdgpu_copy_buffer(struct amdgpu_ring *ring,drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4
-0@@ -951,6 +951,8 @@ static struct list_head *amdgpu_ttm_lru_tail(struct ttm_buffer_object *tbo)struct list_head *res = lru->lru[tbo->mem.mem_type]; lru->lru[tbo->mem.mem_type] = &tbo->lru; +while ((++lru)->lru[tbo->mem.mem_type] == res) + lru->lru[tbo->mem.mem_type] = &tbo->lru;return res; }@@ -961,6 +963,8 @@ static struct list_head *amdgpu_ttm_swap_lru_tail(struct ttm_buffer_object *tbo)struct list_head *res = lru->swap_lru; lru->swap_lru = &tbo->swap; +while ((++lru)->swap_lru == res) + lru->swap_lru = &tbo->swap;return res; }@@ -1008,6 +1012,10 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) lru->swap_lru = &adev->mman.bdev.glob->swap_lru; }
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_ttm_init(struct amdgpu_device *adev) · line 1021
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4
-0+for (j =0 ; j <TTM_NUM_MEM_TYPES ; ++j) + adev->mman.guard.lru[j] =NULL ; + adev->mman.guard.swap_lru =NULL ; + adev->mman.initialized = true; r =ttm_bo_init_mm (&adev->mman.bdev,TTM_PL_VRAM , adev->mc.real_vram_size >>PAGE_SHIFT );_______________________________________________
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): 0c6e022d-25b7-17b5-7aee-b3321f0d48cf-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
Re: [PATCH 3/5] drm/amdgpu: fix lru size grouping
OK. Feel free to add my Reviewed-by.
Quoted 7 lines · Christian König
Quoted 6 lines
/* custom LRU management */ struct amdgpu_mman_lru log2_size[AMDGPU_TTM_LRU_SIZE];+ struct
amdgpu_mman_lruguard;
[FK] It would be safer to make the array AMDGPU_TTM_LRU_SIZE+1, instead of adding a separate guard afterwards. That way the guard can't get accidentally separated by a future change.
Quoted 79 lines
Thought about that as well, but decided against it. The crux is just that
ARRAY_SIZE()won't return the expected value any more.I'm going to add a comment explaining that this shouldn't be moved apart.
Christian.
Am 17.08.2016 um 23:00 schrieb Felix Kuehling:
Quoted 69 lines
One suggestion inline [FK].
With that fixed, Reviewed-by: Felix Kuehling <[email protected]>
Regards,
FelixQuoted 16 lines · Christian König
From: Christian König <[email protected]>
Adding a BO can make it the insertion point for larger sizes as well.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 ++++++++ 2 files changed, 9 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_mman { · line 430
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -428,6 +428,7 @@ struct amdgpu_mman {/* custom LRU management */ struct amdgpu_mman_lru log2_size[AMDGPU_TTM_LRU_SIZE ]; +struct amdgpu_mman_lru guard;[FK] It would be safer to make the array AMDGPU_TTM_LRU_SIZE+1, instead of adding a separate guard afterwards. That way the guard can't get accidentally separated by a future change.
Quoted 24 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0}; int amdgpu_copy_buffer(struct amdgpu_ring *ring,drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4
-0@@ -951,6 +951,8 @@ static struct list_head *amdgpu_ttm_lru_tail(struct ttm_buffer_object *tbo)struct list_head *res = lru->lru[tbo->mem.mem_type]; lru->lru[tbo->mem.mem_type] = &tbo->lru; +while ((++lru)->lru[tbo->mem.mem_type] == res) + lru->lru[tbo->mem.mem_type] = &tbo->lru;return res; }@@ -961,6 +963,8 @@ static struct list_head *amdgpu_ttm_swap_lru_tail(struct ttm_buffer_object *tbo)struct list_head *res = lru->swap_lru; lru->swap_lru = &tbo->swap; +while ((++lru)->swap_lru == res) + lru->swap_lru = &tbo->swap;return res; }drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_ttm_init(struct amdgpu_device *adev) · line 1020
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3
-0@@ -1008,6 +1012,10 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) lru->swap_lru = &adev->mman.bdev.glob->swap_lru; } + for (j = 0; j < TTM_NUM_MEM_TYPES; ++j) + adev->mman.guard.lru[j] =NULL ; + adev->mman.guard.swap_lru =NULL ; + adev->mman.initialized = true; r =ttm_bo_init_mm (&adev->mman.bdev,TTM_PL_VRAM , adev->mc.real_vram_size >>PAGE_SHIFT );_______________________________________________
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
PATCH 4/5 drm/amdgpu: fix sdma_v2_4_ring_test_ib
In reply to a message not in the archiveFrom: Christian König <[email protected]>
Typo in checking the return code.
--- drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +1 -1
@@ -714,7 +714,7 @@ static int sdma_v2_4_ring_test_ib(struct amdgpu_ring *ring, long timeout)DRM_ERROR ("amdgpu: IB test timed out\n" ); r = -ETIMEDOUT ; goto err1; - }else if (r) { + }else if (r <0 ) {DRM_ERROR ("amdgpu: fence wait failed (%ld).\n" , r); goto err1; }
Signature · 6 lines
2.5.0 _______________________________________________ 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): 1471436784-13252-4-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
zhoucm1
Reviewed-by Chunming ZhouRe: [PATCH 4/5] drm/amdgpu: fix sdma_v2_4_ring_test_ib
Quoted 5 lines · Christian König
From: Christian König <[email protected]>
Typo in checking the return code.
Signed-off-by Christian König <[email protected]>
Quoted 9 lines
--- drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0
-0
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c static int sdma_v2_4_ring_test_ib(struct amdgpu_ring *ring, long timeout) · line 720
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +1
-1@@ -714,7 +714,7 @@ static int sdma_v2_4_ring_test_ib(struct amdgpu_ring *ring, long timeout)DRM_ERROR ("amdgpu: IB test timed out\n" ); r = -ETIMEDOUT ; goto err1; - }else if (r) { + }else if (r <0 ) {DRM_ERROR ("amdgpu: fence wait failed (%ld).\n" , r); goto err1; }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/5 drm/amdgpu: fix timeout value check in amd_sched_job_recovery
In reply to a message not in the archiveFrom: Christian König <[email protected]>
Could be that we don't actually have a timeout set.
--- drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +1 -1
@@ -407,7 +407,7 @@ void amd_sched_job_recovery(struct amd_gpu_scheduler *sched)spin_lock (&sched->job_list_lock); s_job =list_first_entry_or_null (&sched->ring_mirror_list, struct amd_sched_job, node); -if (s_job) +if (s_job && sched->timeout !=MAX_SCHEDULE_TIMEOUT )schedule_delayed_work (&s_job->work_tdr, sched->timeout);list_for_each_entry_safe (s_job, tmp, &sched->ring_mirror_list, node) {
Signature · 6 lines
2.5.0 _______________________________________________ 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): 1471436784-13252-5-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
zhoucm1
Reviewed-by Chunming ZhouRe: [PATCH 5/5] drm/amdgpu: fix timeout value check in amd_sched_job_recovery
Quoted 5 lines · Christian König
From: Christian König <[email protected]>
Could be that we don't actually have a timeout set.
Signed-off-by Christian König <[email protected]>
Quoted 9 lines
--- drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +0
-0
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c void amd_sched_job_recovery(struct amd_gpu_scheduler *sched) · line 413
Quoted 8 lines
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +1
-1@@ -407,7 +407,7 @@ void amd_sched_job_recovery(struct amd_gpu_scheduler *sched)spin_lock (&sched->job_list_lock); s_job =list_first_entry_or_null (&sched->ring_mirror_list, struct amd_sched_job, node); -if (s_job) +if (s_job && sched->timeout !=MAX_SCHEDULE_TIMEOUT )schedule_delayed_work (&s_job->work_tdr, sched->timeout);list_for_each_entry_safe (s_job, tmp, &sched->ring_mirror_list, node) {
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 5 lines · Christian König
From: Christian König <[email protected]>
This bug seems to be present for a very long time.
Signed-off-by Christian König <[email protected]>
Patches 1,2,4 are:
patches 3, 5 are:
Quoted 22 lines
--- drivers/gpu/drm/radeon/radeon_ttm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/radeon/radeon_ttm.c +2
-3@@ -263,8 +263,8 @@ static int radeon_move_blit(struct ttm_buffer_object *bo, rdev =radeon_get_rdev (bo->bdev); ridx =radeon_copy_ring_index (rdev); - old_start = old_mem->start <<PAGE_SHIFT ; - new_start = new_mem->start <<PAGE_SHIFT ; + old_start = (u64 )old_mem->start <<PAGE_SHIFT ; + new_start = (u64 )new_mem->start <<PAGE_SHIFT ;switch (old_mem->mem_type) {case TTM_PL_VRAM : --2.5.0
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