Skip to contentSkip to conversation

drm/amdgpu: Fix size calculation when init onchip memory

PATCH In review xinhui pan 3 participants 4 messages Oct 23, 2020 – Oct 26, 2020

Subsystems (2)
lore
Share & tools
lore

xinhui pan

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Fix size calculation when init onchip memory

Size is page count here.

---
 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
index 4a85f8cedd77..11dd3d9eac15 100644
@@ -65,11 +65,11 @@
 
 static int amdgpu_ttm_init_on_chip(struct amdgpu_device *adev,
 				    unsigned int type,
-				    uint64_t size)
+				    uint64_t size_in_page)
 {
 	return ttm_range_man_init(&adev->mman.bdev, type,
 				  TTM_PL_FLAG_UNCACHED, TTM_PL_FLAG_UNCACHED,
-				  false, size >> PAGE_SHIFT);
+				  false, size_in_page);
 }
 
 /**
Signature · 6 lines
2.25.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
maintainer
#1 lore raw

Am 23.10.20 um 07:41 schrieb xinhui pan:

Quoted 3 lines

Size is page count here.

Ah yes that one again. At some point we really need to clean that up.

Patch is Reviewed-by: Christian König <[email protected]>

Quoted 12 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -0
index 4a85f8cedd77..11dd3d9eac15 100644
@@ -65,11 +65,11 @@
 
  static int amdgpu_ttm_init_on_chip(struct amdgpu_device *adev,
  				    unsigned int type,

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c line 75

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -2
-				    uint64_t size)
+				    uint64_t size_in_page)
  {
  	return ttm_range_man_init(&adev->mman.bdev, type,
  				  TTM_PL_FLAG_UNCACHED, TTM_PL_FLAG_UNCACHED,
-				  false, size >> PAGE_SHIFT);
+				  false, size_in_page);
  }
 
  /**

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#2 lore raw
Quoted 19 lines · Christian König

Am 23.10.20 um 07:41 schrieb xinhui pan:

Quoted 3 lines

Size is page count here.

Ah yes that one again. At some point we really need to clean that up.

Patch is Reviewed-by: Christian König <[email protected]>

Quoted 10 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -0
index 4a85f8cedd77..11dd3d9eac15 100644
@@ -65,11 +65,11 @@
 
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c line 72

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -2
  static int amdgpu_ttm_init_on_chip(struct amdgpu_device *adev,
  				    unsigned int type,
-				    uint64_t size)
+				    uint64_t size_in_page)
  {
  	return ttm_range_man_init(&adev->mman.bdev, type,
  				  TTM_PL_FLAG_UNCACHED, TTM_PL_FLAG_UNCACHED,
-				  false, size >> PAGE_SHIFT);
+				  false, size_in_page);

Why don't we call this "page_count" or "num_pages"? "size_in_page" is really confusing and not something people say and use in English.

Regards,
Luben

Quoted 9 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

maintainer
#3 lore raw

Am 24.10.20 um 01:19 schrieb Luben Tuikov:

Quoted 19 lines · Christian König
Quoted 18 lines

Am 23.10.20 um 07:41 schrieb xinhui pan:

Quoted 3 lines

Size is page count here.

Ah yes that one again. At some point we really need to clean that up.

Patch is Reviewed-by: Christian König <[email protected]>

Quoted 10 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++--
   1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -0
index 4a85f8cedd77..11dd3d9eac15 100644
@@ -65,11 +65,11 @@
 
Quoted 12 lines
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c line 72

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -2
   static int amdgpu_ttm_init_on_chip(struct amdgpu_device *adev,
   				    unsigned int type,
-				    uint64_t size)
+				    uint64_t size_in_page)
   {
   	return ttm_range_man_init(&adev->mman.bdev, type,
   				  TTM_PL_FLAG_UNCACHED, TTM_PL_FLAG_UNCACHED,
-				  false, size >> PAGE_SHIFT);
+				  false, size_in_page);

Why don't we call this "page_count" or "num_pages"? "size_in_page" is really confusing and not something people say and use in English.

Thinking more about it it would even better if we just stick with size, cause this is a size in arbitrary units (and NOT pages!).

It's just TTM which misinterprets that as number of pages which is something Dave and I are trying to fix right now.

Regards,
Christian.

Quoted 12 lines

Regards,
Luben

Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx