From: Lang Yu Lang.Yu@amd.com
Sometimes drivers need to use bounce buffers to evict BOs. While those reside in some domain they are not necessarily suitable for CS.
Add a flag so that drivers can note that a bounce buffers needs to be reallocated during validation.
v2: add detailed comments v3 (chk): merge commits and rework commit message
Suggested-by: Christian König christian.koenig@amd.com Signed-off-by: Lang Yu Lang.Yu@amd.com Signed-off-by: Christian König christian.koenig@amd.com --- drivers/gpu/drm/ttm/ttm_bo.c | 3 +++ include/drm/ttm/ttm_placement.h | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 51a94fd63bd7..6b393502198e 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -929,6 +929,9 @@ static bool ttm_bo_places_compat(const struct ttm_place *places, { unsigned i;
+ if (mem->placement & TTM_PL_FLAG_TEMPORARY) + return false; + for (i = 0; i < num_placement; i++) { const struct ttm_place *heap = &places[i];
diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h index aa6ba4d0cf78..8995c9e4ec1b 100644 --- a/include/drm/ttm/ttm_placement.h +++ b/include/drm/ttm/ttm_placement.h @@ -47,8 +47,11 @@ * top of the memory area, instead of the bottom. */
-#define TTM_PL_FLAG_CONTIGUOUS (1 << 19) -#define TTM_PL_FLAG_TOPDOWN (1 << 22) +#define TTM_PL_FLAG_CONTIGUOUS (1 << 0) +#define TTM_PL_FLAG_TOPDOWN (1 << 1) + +/* For multihop handling */ +#define TTM_PL_FLAG_TEMPORARY (1 << 2)
/** * struct ttm_place
From: Lang Yu Lang.Yu@amd.com
Currently, we have a limitted GTT memory size and need a bounce buffer when doing buffer migration between VRAM and SYSTEM domain.
The problem is under GTT memory pressure we can't do buffer migration between VRAM and SYSTEM domain. But in some cases we really need that. Eespecially when validating a VRAM backing store BO which resides in SYSTEM domain.
v2: still account temporary GTT allocations v3 (chk): revert to the simpler change for now
Signed-off-by: Lang Yu Lang.Yu@amd.com Signed-off-by: Christian König christian.koenig@amd.com --- drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 19 +++++++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c index 6a84c9778cc0..5e6b76441449 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c @@ -121,14 +121,15 @@ static int amdgpu_gtt_mgr_new(struct ttm_resource_manager *man, struct amdgpu_gtt_node *node; int r;
- spin_lock(&mgr->lock); - if ((&tbo->mem == mem || tbo->mem.mem_type != TTM_PL_TT) && - atomic64_read(&mgr->available) < mem->num_pages) { + if (!(place->flags & TTM_PL_FLAG_TEMPORARY)) { + spin_lock(&mgr->lock); + if (atomic64_read(&mgr->available) < mem->num_pages) { + spin_unlock(&mgr->lock); + return -ENOSPC; + } + atomic64_sub(mem->num_pages, &mgr->available); spin_unlock(&mgr->lock); - return -ENOSPC; } - atomic64_sub(mem->num_pages, &mgr->available); - spin_unlock(&mgr->lock);
if (!place->lpfn) { mem->mm_node = NULL; @@ -162,7 +163,8 @@ static int amdgpu_gtt_mgr_new(struct ttm_resource_manager *man, kfree(node);
err_out: - atomic64_add(mem->num_pages, &mgr->available); + if (!(place->flags & TTM_PL_FLAG_TEMPORARY)) + atomic64_add(mem->num_pages, &mgr->available);
return r; } @@ -188,7 +190,8 @@ static void amdgpu_gtt_mgr_del(struct ttm_resource_manager *man, kfree(node); }
- atomic64_add(mem->num_pages, &mgr->available); + if (!(mem->placement & TTM_PL_FLAG_TEMPORARY)) + atomic64_add(mem->num_pages, &mgr->available); }
/** diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 80437b6ba5f3..6bdff9005a47 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -514,7 +514,7 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, hop->fpfn = 0; hop->lpfn = 0; hop->mem_type = TTM_PL_TT; - hop->flags = 0; + hop->flags = TTM_PL_FLAG_TEMPORARY; return -EMULTIHOP; }
When we run out of GTT we should still be able to evict VRAM->SYSTEM with a bounce bufferdrm/amdgpu: always allow evicting to SYSTEM domain
Signed-off-by: Christian König christian.koenig@amd.com --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 6bdff9005a47..0faf9765ef41 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -147,14 +147,16 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, * BOs to be evicted from VRAM */ amdgpu_bo_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_VRAM | - AMDGPU_GEM_DOMAIN_GTT); + AMDGPU_GEM_DOMAIN_GTT | + AMDGPU_GEM_DOMAIN_CPU); abo->placements[0].fpfn = adev->gmc.visible_vram_size >> PAGE_SHIFT; abo->placements[0].lpfn = 0; abo->placement.busy_placement = &abo->placements[1]; abo->placement.num_busy_placement = 1; } else { /* Move to GTT memory */ - amdgpu_bo_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_GTT); + amdgpu_bo_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_GTT | + AMDGPU_GEM_DOMAIN_CPU); } break; case TTM_PL_TT:
-----Original Message----- From: Christian König ckoenig.leichtzumerken@gmail.com Sent: Tuesday, June 1, 2021 8:25 PM To: Yu, Lang Lang.Yu@amd.com; thomas_os@shipmail.org Cc: dri-devel@lists.freedesktop.org Subject: [PATCH 3/4] drm/amdgpu: always allow evicting to SYSTEM domain
When we run out of GTT we should still be able to evict VRAM->SYSTEM with a bounce bufferdrm/amdgpu: always allow evicting to SYSTEM domain
Signed-off-by: Christian König christian.koenig@amd.com
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 6bdff9005a47..0faf9765ef41 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -147,14 +147,16 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, * BOs to be evicted from VRAM */ amdgpu_bo_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_VRAM |
AMDGPU_GEM_DOMAIN_GTT);
- AMDGPU_GEM_DOMAIN_GTT |
- AMDGPU_GEM_DOMAIN_CPU); abo->placements[0].fpfn = adev-
gmc.visible_vram_size >> PAGE_SHIFT;
abo->placements[0].lpfn = 0; abo->placement.busy_placement = &abo-
placements[1];
abo->placement.num_busy_placement = 1; } else { /* Move to GTT memory */
amdgpu_bo_placement_from_domain(abo,
AMDGPU_GEM_DOMAIN_GTT);
amdgpu_bo_placement_from_domain(abo,
AMDGPU_GEM_DOMAIN_GTT |
- AMDGPU_GEM_DOMAIN_CPU); } break; case TTM_PL_TT:
-- 2.25.1
[Yu, Lang] Yeah, that's it.
From: Lang Yu Lang.Yu@amd.com
Change mgr->available into mgr->used (invert the value).
Makes more sense to do it this way since we don't need the spinlock any more to double check the handling.
v3 (chk): separated from the TEMPOARAY FLAG change.
Signed-off-by: Lang Yu Lang.Yu@amd.com Signed-off-by: Christian König christian.koenig@amd.com --- drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 26 ++++++++------------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 2 +- 2 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c index 5e6b76441449..4d7e34a8d3fd 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c @@ -121,14 +121,10 @@ static int amdgpu_gtt_mgr_new(struct ttm_resource_manager *man, struct amdgpu_gtt_node *node; int r;
- if (!(place->flags & TTM_PL_FLAG_TEMPORARY)) { - spin_lock(&mgr->lock); - if (atomic64_read(&mgr->available) < mem->num_pages) { - spin_unlock(&mgr->lock); - return -ENOSPC; - } - atomic64_sub(mem->num_pages, &mgr->available); - spin_unlock(&mgr->lock); + if (!(place->flags & TTM_PL_FLAG_TEMPORARY) && + atomic64_add_return(mem->num_pages, &mgr->used) > man->size) { + atomic64_sub(mem->num_pages, &mgr->used); + return -ENOSPC; }
if (!place->lpfn) { @@ -164,7 +160,7 @@ static int amdgpu_gtt_mgr_new(struct ttm_resource_manager *man,
err_out: if (!(place->flags & TTM_PL_FLAG_TEMPORARY)) - atomic64_add(mem->num_pages, &mgr->available); + atomic64_sub(mem->num_pages, &mgr->used);
return r; } @@ -191,7 +187,7 @@ static void amdgpu_gtt_mgr_del(struct ttm_resource_manager *man, }
if (!(mem->placement & TTM_PL_FLAG_TEMPORARY)) - atomic64_add(mem->num_pages, &mgr->available); + atomic64_sub(mem->num_pages, &mgr->used); }
/** @@ -204,9 +200,8 @@ static void amdgpu_gtt_mgr_del(struct ttm_resource_manager *man, uint64_t amdgpu_gtt_mgr_usage(struct ttm_resource_manager *man) { struct amdgpu_gtt_mgr *mgr = to_gtt_mgr(man); - s64 result = man->size - atomic64_read(&mgr->available);
- return (result > 0 ? result : 0) * PAGE_SIZE; + return atomic64_read(&mgr->used) * PAGE_SIZE; }
/** @@ -252,9 +247,8 @@ static void amdgpu_gtt_mgr_debug(struct ttm_resource_manager *man, drm_mm_print(&mgr->mm, printer); spin_unlock(&mgr->lock);
- drm_printf(printer, "man size:%llu pages, gtt available:%lld pages, usage:%lluMB\n", - man->size, (u64)atomic64_read(&mgr->available), - amdgpu_gtt_mgr_usage(man) >> 20); + drm_printf(printer, "man size:%llu pages, gtt used:%llu pages\n", + man->size, atomic64_read(&mgr->used)); }
static const struct ttm_resource_manager_func amdgpu_gtt_mgr_func = { @@ -286,7 +280,7 @@ int amdgpu_gtt_mgr_init(struct amdgpu_device *adev, uint64_t gtt_size) size = (adev->gmc.gart_size >> PAGE_SHIFT) - start; drm_mm_init(&mgr->mm, start, size); spin_lock_init(&mgr->lock); - atomic64_set(&mgr->available, gtt_size >> PAGE_SHIFT); + atomic64_set(&mgr->used, 0);
ttm_set_driver_manager(&adev->mman.bdev, TTM_PL_TT, &mgr->manager); ttm_resource_manager_set_used(man, true); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h index b2c97b19cbe1..64a78da33805 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h @@ -51,7 +51,7 @@ struct amdgpu_gtt_mgr { struct ttm_resource_manager manager; struct drm_mm mm; spinlock_t lock; - atomic64_t available; + atomic64_t used; };
struct amdgpu_mman {
Thomas any comments on this?
Is the purpose of this now clear enough?
Thanks, Christian.
Am 01.06.21 um 14:25 schrieb Christian König:
From: Lang Yu Lang.Yu@amd.com
Sometimes drivers need to use bounce buffers to evict BOs. While those reside in some domain they are not necessarily suitable for CS.
Add a flag so that drivers can note that a bounce buffers needs to be reallocated during validation.
v2: add detailed comments v3 (chk): merge commits and rework commit message
Suggested-by: Christian König christian.koenig@amd.com Signed-off-by: Lang Yu Lang.Yu@amd.com Signed-off-by: Christian König christian.koenig@amd.com
drivers/gpu/drm/ttm/ttm_bo.c | 3 +++ include/drm/ttm/ttm_placement.h | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 51a94fd63bd7..6b393502198e 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -929,6 +929,9 @@ static bool ttm_bo_places_compat(const struct ttm_place *places, { unsigned i;
- if (mem->placement & TTM_PL_FLAG_TEMPORARY)
return false;
- for (i = 0; i < num_placement; i++) { const struct ttm_place *heap = &places[i];
diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h index aa6ba4d0cf78..8995c9e4ec1b 100644 --- a/include/drm/ttm/ttm_placement.h +++ b/include/drm/ttm/ttm_placement.h @@ -47,8 +47,11 @@
- top of the memory area, instead of the bottom.
*/
-#define TTM_PL_FLAG_CONTIGUOUS (1 << 19) -#define TTM_PL_FLAG_TOPDOWN (1 << 22) +#define TTM_PL_FLAG_CONTIGUOUS (1 << 0) +#define TTM_PL_FLAG_TOPDOWN (1 << 1)
+/* For multihop handling */ +#define TTM_PL_FLAG_TEMPORARY (1 << 2)
/**
- struct ttm_place
Sure. LGTM,
Reviewed-by: Thomas Hellström thomas.hellstrom@linux.intel.com
On 6/7/21 2:36 PM, Christian König wrote:
Thomas any comments on this?
Is the purpose of this now clear enough?
Thanks, Christian.
Am 01.06.21 um 14:25 schrieb Christian König:
From: Lang Yu Lang.Yu@amd.com
Sometimes drivers need to use bounce buffers to evict BOs. While those reside in some domain they are not necessarily suitable for CS.
Add a flag so that drivers can note that a bounce buffers needs to be reallocated during validation.
v2: add detailed comments v3 (chk): merge commits and rework commit message
Suggested-by: Christian König christian.koenig@amd.com Signed-off-by: Lang Yu Lang.Yu@amd.com Signed-off-by: Christian König christian.koenig@amd.com
drivers/gpu/drm/ttm/ttm_bo.c | 3 +++ include/drm/ttm/ttm_placement.h | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 51a94fd63bd7..6b393502198e 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -929,6 +929,9 @@ static bool ttm_bo_places_compat(const struct ttm_place *places, { unsigned i; + if (mem->placement & TTM_PL_FLAG_TEMPORARY) + return false;
for (i = 0; i < num_placement; i++) { const struct ttm_place *heap = &places[i]; diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h index aa6ba4d0cf78..8995c9e4ec1b 100644 --- a/include/drm/ttm/ttm_placement.h +++ b/include/drm/ttm/ttm_placement.h @@ -47,8 +47,11 @@ * top of the memory area, instead of the bottom. */ -#define TTM_PL_FLAG_CONTIGUOUS (1 << 19) -#define TTM_PL_FLAG_TOPDOWN (1 << 22) +#define TTM_PL_FLAG_CONTIGUOUS (1 << 0) +#define TTM_PL_FLAG_TOPDOWN (1 << 1)
+/* For multihop handling */ +#define TTM_PL_FLAG_TEMPORARY (1 << 2) /** * struct ttm_place
Thanks!
Lang can anybody from your team give as an reviewed-by/test-by on the amdgpu patches? I just want another pair of eyes looking over it.
If nobody else has time I will ask Nirmoy for a quick testing round.
Thanks, Christian.
Am 07.06.21 um 14:38 schrieb Thomas Hellström (Intel):
Sure. LGTM,
Reviewed-by: Thomas Hellström thomas.hellstrom@linux.intel.com
On 6/7/21 2:36 PM, Christian König wrote:
Thomas any comments on this?
Is the purpose of this now clear enough?
Thanks, Christian.
Am 01.06.21 um 14:25 schrieb Christian König:
From: Lang Yu Lang.Yu@amd.com
Sometimes drivers need to use bounce buffers to evict BOs. While those reside in some domain they are not necessarily suitable for CS.
Add a flag so that drivers can note that a bounce buffers needs to be reallocated during validation.
v2: add detailed comments v3 (chk): merge commits and rework commit message
Suggested-by: Christian König christian.koenig@amd.com Signed-off-by: Lang Yu Lang.Yu@amd.com Signed-off-by: Christian König christian.koenig@amd.com
drivers/gpu/drm/ttm/ttm_bo.c | 3 +++ include/drm/ttm/ttm_placement.h | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 51a94fd63bd7..6b393502198e 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -929,6 +929,9 @@ static bool ttm_bo_places_compat(const struct ttm_place *places, { unsigned i; + if (mem->placement & TTM_PL_FLAG_TEMPORARY) + return false;
for (i = 0; i < num_placement; i++) { const struct ttm_place *heap = &places[i]; diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h index aa6ba4d0cf78..8995c9e4ec1b 100644 --- a/include/drm/ttm/ttm_placement.h +++ b/include/drm/ttm/ttm_placement.h @@ -47,8 +47,11 @@ * top of the memory area, instead of the bottom. */ -#define TTM_PL_FLAG_CONTIGUOUS (1 << 19) -#define TTM_PL_FLAG_TOPDOWN (1 << 22) +#define TTM_PL_FLAG_CONTIGUOUS (1 << 0) +#define TTM_PL_FLAG_TOPDOWN (1 << 1)
+/* For multihop handling */ +#define TTM_PL_FLAG_TEMPORARY (1 << 2) /** * struct ttm_place
[AMD Official Use Only]
Thanks,please let Nirmoy do it.
Regards, Lang
获取 Outlook for iOShttps://aka.ms/o0ukef ________________________________ 发件人: Christian König ckoenig.leichtzumerken@gmail.com 发送时间: Monday, June 7, 2021 8:41:49 PM 收件人: Thomas Hellström (Intel) thomas_os@shipmail.org; Yu, Lang Lang.Yu@amd.com 抄送: dri-devel@lists.freedesktop.org dri-devel@lists.freedesktop.org 主题: Re: [PATCH 1/4] drm/ttm: add TTM_PL_FLAG_TEMPORARY flag v3
Thanks!
Lang can anybody from your team give as an reviewed-by/test-by on the amdgpu patches? I just want another pair of eyes looking over it.
If nobody else has time I will ask Nirmoy for a quick testing round.
Thanks, Christian.
Am 07.06.21 um 14:38 schrieb Thomas Hellström (Intel):
Sure. LGTM,
Reviewed-by: Thomas Hellström thomas.hellstrom@linux.intel.com
On 6/7/21 2:36 PM, Christian König wrote:
Thomas any comments on this?
Is the purpose of this now clear enough?
Thanks, Christian.
Am 01.06.21 um 14:25 schrieb Christian König:
From: Lang Yu Lang.Yu@amd.com
Sometimes drivers need to use bounce buffers to evict BOs. While those reside in some domain they are not necessarily suitable for CS.
Add a flag so that drivers can note that a bounce buffers needs to be reallocated during validation.
v2: add detailed comments v3 (chk): merge commits and rework commit message
Suggested-by: Christian König christian.koenig@amd.com Signed-off-by: Lang Yu Lang.Yu@amd.com Signed-off-by: Christian König christian.koenig@amd.com
drivers/gpu/drm/ttm/ttm_bo.c | 3 +++ include/drm/ttm/ttm_placement.h | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 51a94fd63bd7..6b393502198e 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -929,6 +929,9 @@ static bool ttm_bo_places_compat(const struct ttm_place *places, { unsigned i;
- if (mem->placement & TTM_PL_FLAG_TEMPORARY)
return false;
diff --git a/include/drm/ttm/ttm_placement.hfor (i = 0; i < num_placement; i++) { const struct ttm_place *heap = &places[i];
b/include/drm/ttm/ttm_placement.h index aa6ba4d0cf78..8995c9e4ec1b 100644 --- a/include/drm/ttm/ttm_placement.h +++ b/include/drm/ttm/ttm_placement.h @@ -47,8 +47,11 @@
- top of the memory area, instead of the bottom.
*/ -#define TTM_PL_FLAG_CONTIGUOUS (1 << 19) -#define TTM_PL_FLAG_TOPDOWN (1 << 22) +#define TTM_PL_FLAG_CONTIGUOUS (1 << 0) +#define TTM_PL_FLAG_TOPDOWN (1 << 1)
+/* For multihop handling */ +#define TTM_PL_FLAG_TEMPORARY (1 << 2) /**
- struct ttm_place
Hi Nirmoy,
can you give that patch set a testing round and an review?
The memory stress test with low VRAM on APUs should be sufficient and you should have that setup still around.
Thanks in advance, Christian.
Am 07.06.21 um 14:58 schrieb Yu, Lang:
[AMD Official Use Only]
Thanks,please let Nirmoy do it.
Regards, Lang
获取 Outlook for iOS https://aka.ms/o0ukef
*发件人:* Christian König ckoenig.leichtzumerken@gmail.com *发送时间:* Monday, June 7, 2021 8:41:49 PM *收件人:* Thomas Hellström (Intel) thomas_os@shipmail.org; Yu, Lang Lang.Yu@amd.com *抄送:* dri-devel@lists.freedesktop.org dri-devel@lists.freedesktop.org *主题:* Re: [PATCH 1/4] drm/ttm: add TTM_PL_FLAG_TEMPORARY flag v3 Thanks!
Lang can anybody from your team give as an reviewed-by/test-by on the amdgpu patches? I just want another pair of eyes looking over it.
If nobody else has time I will ask Nirmoy for a quick testing round.
Thanks, Christian.
Am 07.06.21 um 14:38 schrieb Thomas Hellström (Intel):
Sure. LGTM,
Reviewed-by: Thomas Hellström thomas.hellstrom@linux.intel.com
On 6/7/21 2:36 PM, Christian König wrote:
Thomas any comments on this?
Is the purpose of this now clear enough?
Thanks, Christian.
Am 01.06.21 um 14:25 schrieb Christian König:
From: Lang Yu Lang.Yu@amd.com
Sometimes drivers need to use bounce buffers to evict BOs. While those reside in some domain they are not necessarily suitable for CS.
Add a flag so that drivers can note that a bounce buffers needs to be reallocated during validation.
v2: add detailed comments v3 (chk): merge commits and rework commit message
Suggested-by: Christian König christian.koenig@amd.com Signed-off-by: Lang Yu Lang.Yu@amd.com Signed-off-by: Christian König christian.koenig@amd.com
drivers/gpu/drm/ttm/ttm_bo.c | 3 +++ include/drm/ttm/ttm_placement.h | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 51a94fd63bd7..6b393502198e 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -929,6 +929,9 @@ static bool ttm_bo_places_compat(const struct ttm_place *places, { unsigned i; + if (mem->placement & TTM_PL_FLAG_TEMPORARY) + return false;
for (i = 0; i < num_placement; i++) { const struct ttm_place *heap = &places[i]; diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h index aa6ba4d0cf78..8995c9e4ec1b 100644 --- a/include/drm/ttm/ttm_placement.h +++ b/include/drm/ttm/ttm_placement.h @@ -47,8 +47,11 @@ * top of the memory area, instead of the bottom. */ -#define TTM_PL_FLAG_CONTIGUOUS (1 << 19) -#define TTM_PL_FLAG_TOPDOWN (1 << 22) +#define TTM_PL_FLAG_CONTIGUOUS (1 << 0) +#define TTM_PL_FLAG_TOPDOWN (1 << 1)
+/* For multihop handling */ +#define TTM_PL_FLAG_TEMPORARY (1 << 2) /** * struct ttm_place
On 6/7/2021 3:01 PM, Christian König wrote:
Hi Nirmoy,
can you give that patch set a testing round and an review?
Sure! I will get back asap.
The memory stress test with low VRAM on APUs should be sufficient and you should have that setup still around.
Thanks in advance, Christian.
Am 07.06.21 um 14:58 schrieb Yu, Lang:
[AMD Official Use Only]
Thanks,please let Nirmoy do it.
Regards, Lang
获取 Outlook for iOS
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Faka.ms%2Fo0ukef&data=04%7C01%7Cnirmoy.das%40amd.com%7Ca1e4256424cb46841b6b08d929b45120%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637586676695741160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=m6t3vxIQ%2BgRQJvI27G9gHtR2XN7Hoyg6WXkG6uDRTbc%3D&reserved=0
*发件人:* Christian König ckoenig.leichtzumerken@gmail.com *发送时间:* Monday, June 7, 2021 8:41:49 PM *收件人:* Thomas Hellström (Intel) thomas_os@shipmail.org; Yu, Lang Lang.Yu@amd.com *抄送:* dri-devel@lists.freedesktop.org dri-devel@lists.freedesktop.org *主题:* Re: [PATCH 1/4] drm/ttm: add TTM_PL_FLAG_TEMPORARY flag v3 Thanks!
Lang can anybody from your team give as an reviewed-by/test-by on the amdgpu patches? I just want another pair of eyes looking over it.
If nobody else has time I will ask Nirmoy for a quick testing round.
Thanks, Christian.
Am 07.06.21 um 14:38 schrieb Thomas Hellström (Intel):
Sure. LGTM,
Reviewed-by: Thomas Hellström thomas.hellstrom@linux.intel.com
On 6/7/21 2:36 PM, Christian König wrote:
Thomas any comments on this?
Is the purpose of this now clear enough?
Thanks, Christian.
Am 01.06.21 um 14:25 schrieb Christian König:
From: Lang Yu Lang.Yu@amd.com
Sometimes drivers need to use bounce buffers to evict BOs. While those reside in some domain they are not necessarily suitable for CS.
Add a flag so that drivers can note that a bounce buffers needs to be reallocated during validation.
v2: add detailed comments v3 (chk): merge commits and rework commit message
Suggested-by: Christian König christian.koenig@amd.com Signed-off-by: Lang Yu Lang.Yu@amd.com Signed-off-by: Christian König christian.koenig@amd.com
drivers/gpu/drm/ttm/ttm_bo.c | 3 +++ include/drm/ttm/ttm_placement.h | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 51a94fd63bd7..6b393502198e 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -929,6 +929,9 @@ static bool ttm_bo_places_compat(const struct ttm_place *places, { unsigned i; + if (mem->placement & TTM_PL_FLAG_TEMPORARY) + return false;
for (i = 0; i < num_placement; i++) { const struct ttm_place *heap = &places[i]; diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h index aa6ba4d0cf78..8995c9e4ec1b 100644 --- a/include/drm/ttm/ttm_placement.h +++ b/include/drm/ttm/ttm_placement.h @@ -47,8 +47,11 @@ * top of the memory area, instead of the bottom. */ -#define TTM_PL_FLAG_CONTIGUOUS (1 << 19) -#define TTM_PL_FLAG_TOPDOWN (1 << 22) +#define TTM_PL_FLAG_CONTIGUOUS (1 << 0) +#define TTM_PL_FLAG_TOPDOWN (1 << 1)
+/* For multihop handling */ +#define TTM_PL_FLAG_TEMPORARY (1 << 2) /** * struct ttm_place
Hi Christian and Lang,
I can't apply it cleanly because of https://patchwork.freedesktop.org/patch/436305/. This series needs a rebase.
Regards,
Nirmoy
On 6/7/2021 4:42 PM, Das, Nirmoy wrote:
On 6/7/2021 3:01 PM, Christian König wrote:
Hi Nirmoy,
can you give that patch set a testing round and an review?
Sure! I will get back asap.
The memory stress test with low VRAM on APUs should be sufficient and you should have that setup still around.
Thanks in advance, Christian.
Am 07.06.21 um 14:58 schrieb Yu, Lang:
[AMD Official Use Only]
Thanks,please let Nirmoy do it.
Regards, Lang
获取 Outlook for iOS
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Faka.ms%2Fo0ukef&data=04%7C01%7Cnirmoy.das%40amd.com%7Cd789a01a337743638ed308d929c28fa0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637586737878220366%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=TkIx1d6hvZtrP6iQihfUlrB6oBP9QZGfNa08anYm4X4%3D&reserved=0
*发件人:* Christian König ckoenig.leichtzumerken@gmail.com *发送时间:* Monday, June 7, 2021 8:41:49 PM *收件人:* Thomas Hellström (Intel) thomas_os@shipmail.org; Yu, Lang Lang.Yu@amd.com *抄送:* dri-devel@lists.freedesktop.org dri-devel@lists.freedesktop.org *主题:* Re: [PATCH 1/4] drm/ttm: add TTM_PL_FLAG_TEMPORARY flag v3 Thanks!
Lang can anybody from your team give as an reviewed-by/test-by on the amdgpu patches? I just want another pair of eyes looking over it.
If nobody else has time I will ask Nirmoy for a quick testing round.
Thanks, Christian.
Am 07.06.21 um 14:38 schrieb Thomas Hellström (Intel):
Sure. LGTM,
Reviewed-by: Thomas Hellström thomas.hellstrom@linux.intel.com
On 6/7/21 2:36 PM, Christian König wrote:
Thomas any comments on this?
Is the purpose of this now clear enough?
Thanks, Christian.
Am 01.06.21 um 14:25 schrieb Christian König:
From: Lang Yu Lang.Yu@amd.com
Sometimes drivers need to use bounce buffers to evict BOs. While those reside in some domain they are not necessarily suitable for CS.
Add a flag so that drivers can note that a bounce buffers needs
to be
reallocated during validation.
v2: add detailed comments v3 (chk): merge commits and rework commit message
Suggested-by: Christian König christian.koenig@amd.com Signed-off-by: Lang Yu Lang.Yu@amd.com Signed-off-by: Christian König christian.koenig@amd.com
drivers/gpu/drm/ttm/ttm_bo.c | 3 +++ include/drm/ttm/ttm_placement.h | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 51a94fd63bd7..6b393502198e 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -929,6 +929,9 @@ static bool ttm_bo_places_compat(const struct ttm_place *places, { unsigned i; + if (mem->placement & TTM_PL_FLAG_TEMPORARY) + return false;
for (i = 0; i < num_placement; i++) { const struct ttm_place *heap = &places[i]; diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h index aa6ba4d0cf78..8995c9e4ec1b 100644 --- a/include/drm/ttm/ttm_placement.h +++ b/include/drm/ttm/ttm_placement.h @@ -47,8 +47,11 @@ * top of the memory area, instead of the bottom. */ -#define TTM_PL_FLAG_CONTIGUOUS (1 << 19) -#define TTM_PL_FLAG_TOPDOWN (1 << 22) +#define TTM_PL_FLAG_CONTIGUOUS (1 << 0) +#define TTM_PL_FLAG_TOPDOWN (1 << 1)
+/* For multihop handling */ +#define TTM_PL_FLAG_TEMPORARY (1 << 2) /** * struct ttm_place
dri-devel@lists.freedesktop.org