drm/amd/amdgpu: set gtt size according to system memory size only
Subsystems (2)
PATCH 1/1 drm/amd/amdgpu: set gtt size according to system memory size only
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +11 -5
@@ -1328,13 +1328,19 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)if (amdgpu_gtt_size ==-1 ) {struct sysinfo si; +uint64_t sys_mem_size;si_meminfo (&si); - gtt_size =min (max ((AMDGPU_DEFAULT_GTT_SIZE_MB <<20 ), - adev->mc.mc_vram_size), - ((uint64_t )si.totalram * si.mem_unit *3 /4 )); - } -else + sys_mem_size = (uint64_t )si.totalram * si.mem_unit; + gtt_size =AMDGPU_DEFAULT_GTT_SIZE_MB <<20 ; + +/* leave 2GB for OS to work with */ +if (sys_mem_size > (2ULL <<30 )) { + gtt_size =max (gtt_size, sys_mem_size - (2ULL <<30 )); + }else +DRM_INFO ("amdgpu: Too small system memory %llu MB\n" , + sys_mem_size >>20 ); + }else gtt_size = (uint64_t )amdgpu_gtt_size <<20 ; r =ttm_bo_init_mm (&adev->mman.bdev,TTM_PL_TT , gtt_size >>PAGE_SHIFT );if (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): 1511862059-14173-1-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org
Am 28.11.2017 um 10:40 schrieb Roger He:
Quoted 19 lines
Change-Id Ib634375b90d875fe04a890fc82fb1e3b7112676aSigned-off-by Roger He <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-2@@ -1328,13 +1328,19 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)if (amdgpu_gtt_size ==-1 ) {struct sysinfo si; +uint64_t sys_mem_size;si_meminfo (&si); - gtt_size = min(max((AMDGPU_DEFAULT_GTT_SIZE_MB << 20), - adev->mc.mc_vram_size),
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_ttm_init(struct amdgpu_device *adev) · line 1340
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +7
-3- ((uint64_t)si.totalram * si.mem_unit * 3/4)); - } -else + sys_mem_size = (uint64_t )si.totalram * si.mem_unit; + gtt_size =AMDGPU_DEFAULT_GTT_SIZE_MB <<20 ; + +/* leave 2GB for OS to work with */ +if (sys_mem_size > (2ULL <<30 )) { + gtt_size =max (gtt_size, sys_mem_size - (2ULL <<30 )); + }else
No need for the "{}" here.
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_ttm_init(struct amdgpu_device *adev) · line 1343
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3
-0+DRM_INFO ("amdgpu: Too small system memory %llu MB\n" , + sys_mem_size >>20 ); + }else
I have a preference to stick with the 75% rule similar to how TTM does things, but that isn't a hard opinion if you have a good argument.
Regards,
Christian.
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_ttm_init(struct amdgpu_device *adev) · line 1346
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0gtt_size = (uint64_t )amdgpu_gtt_size <<20 ; r =ttm_bo_init_mm (&adev->mman.bdev,TTM_PL_TT , gtt_size >>PAGE_SHIFT );if (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): 7029b2bb-03be-6d74-578d-63fc48982b6e-5C7GfCeVMHo@public.gmane.org
-----Original Message-----
From: Koenig, Christian
Sent: Tuesday, November 28, 2017 6:01 PM
To: He, Roger <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amd/amdgpu: set gtt size according to system memory size only
Am 28.11.2017 um 10:40 schrieb Roger He:
Quoted 21 lines
Change-Id Ib634375b90d875fe04a890fc82fb1e3b7112676aSigned-off-by Roger He <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-2@@ -1328,13 +1328,19 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)if (amdgpu_gtt_size ==-1 ) {struct sysinfo si; +uint64_t sys_mem_size;si_meminfo (&si); - gtt_size = min(max((AMDGPU_DEFAULT_GTT_SIZE_MB << 20), - adev->mc.mc_vram_size),
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_ttm_init(struct amdgpu_device · line 1341
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +7
-3- ((uint64_t)si.totalram * si.mem_unit * 3/4)); - } -else + sys_mem_size = (uint64_t )si.totalram * si.mem_unit; + gtt_size =AMDGPU_DEFAULT_GTT_SIZE_MB <<20 ; + +/* leave 2GB for OS to work with */ +if (sys_mem_size > (2ULL <<30 )) { + gtt_size =max (gtt_size, sys_mem_size - (2ULL <<30 )); + }else
No need for the "{}" here.
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_ttm_init(struct amdgpu_device *adev) · line 1343
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3
-0+DRM_INFO ("amdgpu: Too small system memory %llu MB\n" , + sys_mem_size >>20 ); + }else
I have a preference to stick with the 75% rule similar to how TTM does things, but that isn't a hard opinion if you have a good argument.
[Roger]: originally I used the 75% rule as well. But for a special test case, test failed. Anyway, let's keep 75% here since seems it is more reasonable. And for the special test case, will use module parameter to change GTT size temporarily.
Thanks
Roger(Hongbo.He)
Regards,
Christian.
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0gtt_size = (uint64_t )amdgpu_gtt_size <<20 ; r =ttm_bo_init_mm (&adev->mman.bdev,TTM_PL_TT , gtt_size >>PAGE_SHIFT );if (r) {
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx