drm/amdgpu: fix gtt_mgr bo's offset
Subsystems (2)
PATCH 1/1 drm/amdgpu: fix gtt_mgr bo's offset
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +2 -2
@@ -128,8 +128,8 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man,if (!r) { mem->start = node->start; - tbo->offset = (tbo->mem.start <<PAGE_SHIFT ) + - tbo->bdev->man[tbo->mem.mem_type].gpu_offset; + tbo->offset = (mem->start <<PAGE_SHIFT ) + + tbo->bdev->man[mem->mem_type].gpu_offset; }return r;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 11 lines · Flora Cui
Change-Id I89e9be3d5c96d46655f3a977fb557b20b4d87609Signed-off-by Flora Cui <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man, · line 132
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +2
-2@@ -128,8 +128,8 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man,if (!r) { mem->start = node->start; - tbo->offset = (tbo->mem.start <<PAGE_SHIFT ) + - tbo->bdev->man[tbo->mem.mem_type].gpu_offset; + tbo->offset = (mem->start <<PAGE_SHIFT ) + + tbo->bdev->man[mem->mem_type].gpu_offset;
mem->mem_type seems not set yet as well if I am correct.
IIRC, I feel it's better that tbo->offset is set out of this function after get_node successfully.
Regards,
David Zhou
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man, · line 135
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +0
-0}return r;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 9 lines · On Tue, Sep 20, 2016 at 06:19:33PM +0800, zhoucm1 wrote:
Quoted 6 lines · Flora Cui
Change-Id I89e9be3d5c96d46655f3a977fb557b20b4d87609Signed-off-by Flora Cui <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man, · line 131
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +2
-2@@ -128,8 +128,8 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man,if (!r) { mem->start = node->start; - tbo->offset = (tbo->mem.start <<PAGE_SHIFT ) + - tbo->bdev->man[tbo->mem.mem_type].gpu_offset; + tbo->offset = (mem->start <<PAGE_SHIFT ) + + tbo->bdev->man[mem->mem_type].gpu_offset;
mem->mem_typeseems not set yet as well if I am correct.
IIRC, I feel it's better thattbo->offsetis set out of this function afterget_nodesuccessfully.
how about change to tbo->bdev->man[TTM_PL_TT].gpu_offset? since gtt_mgr is for GTT only.
Quoted 6 lines
Regards,
David ZhouQuoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +0
-0}return r;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 20.09.2016 um 12:19 schrieb zhoucm1:
Quoted 9 lines · Flora Cui
Quoted 6 lines
Change-Id I89e9be3d5c96d46655f3a977fb557b20b4d87609Signed-off-by Flora Cui <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c int amdgpu_gtt_mgr_alloc(struct · line 132
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +2
-2@@ -128,8 +128,8 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man, if (!r) { mem->start = node->start; - tbo->offset = (tbo->mem.start <<PAGE_SHIFT ) + - tbo->bdev->man[tbo->mem.mem_type].gpu_offset; + tbo->offset = (mem->start <<PAGE_SHIFT ) + + tbo->bdev->man[mem->mem_type].gpu_offset;
mem->mem_typeseems not set yet as well if I am correct.
IIRC, I feel it's better thattbo->offsetis set out of this function afterget_nodesuccessfully.
The patch itself is indeed not correct, but it points me to the bug I've been searching for weeks now.
So thanks a lot for this.
Regards,
Christian.
Quoted 11 lines
Regards,
David Zhoudrivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man, · line 135
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +0
-0}return 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
Am 20.09.2016 um 12:41 schrieb Flora Cui:
Quoted 24 lines · On Tue, Sep 20, 2016 at 06:19:33PM +0800, zhoucm1 wrote:
Quoted 8 lines · Flora Cui
Quoted 6 lines
Change-Id I89e9be3d5c96d46655f3a977fb557b20b4d87609Signed-off-by Flora Cui <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man, · line 131
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +2
-2@@ -128,8 +128,8 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man,if (!r) { mem->start = node->start; - tbo->offset = (tbo->mem.start <<PAGE_SHIFT ) + - tbo->bdev->man[tbo->mem.mem_type].gpu_offset; + tbo->offset = (mem->start <<PAGE_SHIFT ) + + tbo->bdev->man[mem->mem_type].gpu_offset;
mem->mem_typeseems not set yet as well if I am correct.
IIRC, I feel it's better thattbo->offsetis set out of this function afterget_nodesuccessfully.
Quoted 2 lines
how about change to tbo->bdev->man[TTM_PL_TT].gpu_offset? since
gtt_mgris for GTT only.
Not 100% correct either.
The problem is that sometimes a GTT MM node will be bound for a BO which is still in VRAM (e.g. on eviction for example).
So you need to check if (&tbo->mem == mem) and only then update the tbo's offset.
Regards,
Christian.
Quoted 10 lines
Quoted 6 lines
Regards,
David ZhouQuoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +0
-0}return 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
Flora Cui
Reviewed-by Hawking ZhangDoes this change make sense?
Quoted 51 lines · Christian König
Am 20.09.2016 um 12:41 schrieb Flora Cui:
Quoted 24 lines · On Tue, Sep 20, 2016 at 06:19:33PM +0800, zhoucm1 wrote:
Quoted 8 lines · Flora Cui
Quoted 6 lines
Change-Id I89e9be3d5c96d46655f3a977fb557b20b4d87609Signed-off-by Flora Cui <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man, · line 131
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +2
-2@@ -128,8 +128,8 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man,if (!r) { mem->start = node->start; - tbo->offset = (tbo->mem.start <<PAGE_SHIFT ) + - tbo->bdev->man[tbo->mem.mem_type].gpu_offset; + tbo->offset = (mem->start <<PAGE_SHIFT ) + + tbo->bdev->man[mem->mem_type].gpu_offset;
mem->mem_typeseems not set yet as well if I am correct.
IIRC, I feel it's better thattbo->offsetis set out of this function afterget_nodesuccessfully.Quoted 2 lines
how about change to tbo->bdev->man[TTM_PL_TT].gpu_offset? since
gtt_mgris for GTT only.Not 100% correct either.
The problem is that sometimes a GTT MM node will be bound for a BO which is still in VRAM (e.g. on eviction for example).
So you need to check if (
&tbo->mem== mem) and only then update the tbo's offset.Regards,
Christian.Quoted 10 lines
Quoted 6 lines
Regards,
David ZhouQuoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +0
-0}return r;_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 5 lines
_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
From411f93d78e8f3691ce480146374c1e603c2c6db6Mon Sep 17 00:00:00 2001
From: Flora Cui <[email protected]>
Date: Tue, 20 Sep 2016 17:07:31 +0800
Subject: [PATCH] drm/amdgpu: fix gtt_mgr bo's offset
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +3 -2
@@ -128,8 +128,9 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man,if (!r) { mem->start = node->start; - tbo->offset = (tbo->mem.start <<PAGE_SHIFT ) + - tbo->bdev->man[tbo->mem.mem_type].gpu_offset; +if (&tbo->mem == mem) + tbo->offset = (tbo->mem.start <<PAGE_SHIFT ) + + tbo->bdev->man[tbo->mem.mem_type].gpu_offset; }return r;
Signature · 1 line
2.7.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
we need this fix for urgent promotion. so please please reply me asap.
Quoted 51 lines · Christian König
Am 20.09.2016 um 12:41 schrieb Flora Cui:
Quoted 24 lines · On Tue, Sep 20, 2016 at 06:19:33PM +0800, zhoucm1 wrote:
Quoted 8 lines · Flora Cui
Quoted 6 lines
Change-Id I89e9be3d5c96d46655f3a977fb557b20b4d87609Signed-off-by Flora Cui <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man, · line 131
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +2
-2@@ -128,8 +128,8 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man,if (!r) { mem->start = node->start; - tbo->offset = (tbo->mem.start <<PAGE_SHIFT ) + - tbo->bdev->man[tbo->mem.mem_type].gpu_offset; + tbo->offset = (mem->start <<PAGE_SHIFT ) + + tbo->bdev->man[mem->mem_type].gpu_offset;
mem->mem_typeseems not set yet as well if I am correct.
IIRC, I feel it's better thattbo->offsetis set out of this function afterget_nodesuccessfully.Quoted 2 lines
how about change to tbo->bdev->man[TTM_PL_TT].gpu_offset? since
gtt_mgris for GTT only.Not 100% correct either.
The problem is that sometimes a GTT MM node will be bound for a BO which is still in VRAM (e.g. on eviction for example).
So you need to check if (
&tbo->mem== mem) and only then update the tbo's offset.Regards,
Christian.Quoted 10 lines
Quoted 6 lines
Regards,
David ZhouQuoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +0
-0}return 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
Am 20.09.2016 um 13:16 schrieb Flora Cui:
Quoted 1 line
Does this change make sense?
Yes, exactly. Patch is Reviewed-by: Christian König <[email protected]>.
But please be aware that there is at least one other bug I'm currently investigating.
Regards,
Christian.
Quoted 49 lines · Christian König
Quoted 47 lines
Am 20.09.2016 um 12:41 schrieb Flora Cui:
Quoted 23 lines · On Tue, Sep 20, 2016 at 06:19:33PM +0800, zhoucm1 wrote:
Quoted 7 lines · Flora Cui
Quoted 6 lines
Change-Id I89e9be3d5c96d46655f3a977fb557b20b4d87609Signed-off-by Flora Cui <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man, · line 131
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +2
-2@@ -128,8 +128,8 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man,if (!r) { mem->start = node->start; - tbo->offset = (tbo->mem.start <<PAGE_SHIFT ) + - tbo->bdev->man[tbo->mem.mem_type].gpu_offset; + tbo->offset = (mem->start <<PAGE_SHIFT ) + + tbo->bdev->man[mem->mem_type].gpu_offset;
mem->mem_typeseems not set yet as well if I am correct.
IIRC, I feel it's better thattbo->offsetis set out of this function afterget_nodesuccessfully.Quoted 2 lines
how about change to tbo->bdev->man[TTM_PL_TT].gpu_offset? since
gtt_mgris for GTT only.Not 100% correct either.
The problem is that sometimes a GTT MM node will be bound for a BO which is still in VRAM (e.g. on eviction for example).
So you need to check if (
&tbo->mem== mem) and only then update the tbo's offset.Regards,
Christian.Quoted 9 lines
Quoted 5 lines
Regards,
David ZhouQuoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +0
-0}return r;_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 4 lines
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
Quoted 4 lines · Christian König
Am 20.09.2016 um 13:16 schrieb Flora Cui:
Quoted 1 line
Does this change make sense?
Yes, exactly. Patch is Reviewed-by: Christian König <[email protected]>.
Hi Flora,
Does this change work?
if (&tbo->mem == mem)
this checking seems always be false, right?
Regards,
David Zhou
Quoted 62 lines
But please be aware that there is at least one other bug I'm currently investigating.
Regards,
Christian.Quoted 54 lines · Christian König
Quoted 52 lines
Am 20.09.2016 um 12:41 schrieb Flora Cui:
Quoted 24 lines · On Tue, Sep 20, 2016 at 06:19:33PM +0800, zhoucm1 wrote:
Quoted 7 lines · Flora Cui
Quoted 6 lines
Change-Id I89e9be3d5c96d46655f3a977fb557b20b4d87609Signed-off-by Flora Cui <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c int amdgpu_gtt_mgr_alloc(struct · line 132
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +2
-2@@ -128,8 +128,8 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man, if (!r) { mem->start = node->start; - tbo->offset = (tbo->mem.start <<PAGE_SHIFT ) + - tbo->bdev->man[tbo->mem.mem_type].gpu_offset; + tbo->offset = (mem->start <<PAGE_SHIFT ) + + tbo->bdev->man[mem->mem_type].gpu_offset;
mem->mem_typeseems not set yet as well if I am correct.
IIRC, I feel it's better thattbo->offsetis set out of this function afterget_nodesuccessfully.Quoted 2 lines
how about change to tbo->bdev->man[TTM_PL_TT].gpu_offset? since
gtt_mgris for GTT only.Not 100% correct either.
The problem is that sometimes a GTT MM node will be bound for a BO which is still in VRAM (e.g. on eviction for example).
So you need to check if (
&tbo->mem== mem) and only then update the tbo's offset.Regards,
Christian.Quoted 9 lines
Quoted 5 lines
Regards,
David ZhouQuoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +0
-0}return 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
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 6 lines · On Wed, Sep 21, 2016 at 09:54:04AM +0800, zhoucm1 wrote:
Quoted 3 lines · Christian König
Am 20.09.2016 um 13:16 schrieb Flora Cui:
Quoted 1 line
Does this change make sense?
Quoted 7 lines
Quoted 2 lines
Yes, exactly. Patch is Reviewed-by: Christian König <[email protected]>.
Hi Flora,
Does this change work?if (
&tbo->mem== mem)
this checking seems always be false, right?
mostly the check is true. eg amdgpu_bo_pin_restricted->amdgpu_ttm_bind(), the mem is &bo->tbo.mem
Quoted 71 lines
Regards,
David ZhouQuoted 67 lines
But please be aware that there is at least one other bug I'm currently investigating.
Regards,
Christian.Quoted 58 lines · Christian König
Quoted 56 lines
Am 20.09.2016 um 12:41 schrieb Flora Cui:
Quoted 26 lines · On Tue, Sep 20, 2016 at 06:19:33PM +0800, zhoucm1 wrote:
Quoted 16 lines · Flora Cui
Quoted 15 lines
Change-Id I89e9be3d5c96d46655f3a977fb557b20b4d87609Signed-off-by Flora Cui <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +0
-0@@ -128,8 +128,8 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man, if (!r) { mem->start = node->start;Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man,
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +2
-2- tbo->offset = (tbo->mem.start <<PAGE_SHIFT ) + - tbo->bdev->man[tbo->mem.mem_type].gpu_offset; + tbo->offset = (mem->start <<PAGE_SHIFT ) + + tbo->bdev->man[mem->mem_type].gpu_offset;
mem->mem_typeseems not set yet as well if I am correct. IIRC, I feel it's better thattbo->offsetis set out of this function afterget_nodesuccessfully.Quoted 2 lines
how about change to tbo->bdev->man[TTM_PL_TT].gpu_offset? since
gtt_mgris for GTT only.Not 100% correct either.
The problem is that sometimes a GTT MM node will be bound for a BO which is
still in VRAM (e.g. on eviction for example).So you need to check if (
&tbo->mem== mem) and only then update the tbo's
offset.Regards,
Christian.Quoted 9 lines
Quoted 5 lines
Regards,
David ZhouQuoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +0
-0}return 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
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx