Skip to contentSkip to conversation

drm/amdgpu: add gtt print like vram when dump mm table V2

PATCH In review Chunming Zhou 3 participants 6 messages Apr 20, 2017 – Apr 21, 2017 4 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amdgpu: add gtt print like vram when dump mm table V2

Change-Id If0474e24e14d237d2d55731871c5ceb11e5a3601
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c |  9 +++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 10 +++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +9 -0
index 69ab2ee..f586cb7 100644
@@ -136,6 +136,15 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man,
 	return r;
 }
 
+void amdgpu_gtt_mgr_print(struct seq_file *m, struct ttm_mem_type_manager *man)
+{
+	struct amdgpu_device *adev = amdgpu_ttm_adev(man->bdev);
+	struct amdgpu_gtt_mgr *mgr = man->priv;
+
+	seq_printf(m, "man size:%llu pages, gtt available:%llu pages, usage:%lluMB\n",
+		   man->size, mgr->available, (u64)atomic64_read(&adev->gtt_usage) >> 20);
+
+}
 /**
  * amdgpu_gtt_mgr_new - allocate a new node
  *
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +9 -1
index c3112b6..2b402d2 100644
@@ -1540,6 +1540,8 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo,
 
 #if defined(CONFIG_DEBUG_FS)
 
+extern void amdgpu_gtt_mgr_print(struct seq_file *m, struct ttm_mem_type_manager
+				 *man);
 static int amdgpu_mm_dump_table(struct seq_file *m, void *data)
 {
 	struct drm_info_node *node = (struct drm_info_node *)m->private;
@@ -1553,11 +1555,17 @@ static int amdgpu_mm_dump_table(struct seq_file *m, void *data)
 	spin_lock(&glob->lru_lock);
 	ret = drm_mm_dump_table(m, mm);
 	spin_unlock(&glob->lru_lock);
-	if (ttm_pl == TTM_PL_VRAM)
+	switch (ttm_pl) {
+	case TTM_PL_VRAM:
 		seq_printf(m, "man size:%llu pages, ram usage:%lluMB, vis usage:%lluMB\n",
 			   adev->mman.bdev.man[ttm_pl].size,
 			   (u64)atomic64_read(&adev->vram_usage) >> 20,
 			   (u64)atomic64_read(&adev->vram_vis_usage) >> 20);
+		break;
+	case TTM_PL_TT:
+		amdgpu_gtt_mgr_print(m, &adev->mman.bdev.man[TTM_PL_TT]);
+		break;
+	}
 	return ret;
 }
 
Signature · 6 lines
1.9.1

_______________________________________________
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): 1492660056-11346-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 2/2 drm/amdgpu: increase gtt size to 3GB by default

Change-Id Icdf2486a2d1116e71dc8958cda679a4a83838489
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -1
index d74a406..8f201a3 100644
@@ -65,7 +65,7 @@
 #define KMS_DRIVER_PATCHLEVEL	0
 
 int amdgpu_vram_limit = 0;
-int amdgpu_gart_size = -1; /* auto */
+int amdgpu_gart_size = 3072; /* 3GB by default */
 int amdgpu_moverate = -1; /* auto */
 int amdgpu_benchmarking = 0;
 int amdgpu_testing = 0;
Signature · 6 lines
1.9.1

_______________________________________________
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): 1492660056-11346-2-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org

#4 lore raw

Re: [PATCH 2/2] drm/amdgpu: increase gtt size to 3GB by default

Quoted 11 lines · Chunming Zhou
Change-Id Icdf2486a2d1116e71dc8958cda679a4a83838489
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index d74a406..8f201a3 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c line 68

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -1
@@ -65,7 +65,7 @@
 #define KMS_DRIVER_PATCHLEVEL  0
 
 int amdgpu_vram_limit = 0;
-int amdgpu_gart_size = -1; /* auto */
+int amdgpu_gart_size = 3072; /* 3GB by default */

This breaks the auto setting. Please add a global define for gtt size (e.g., AMDGPU_DEFAULT_GTT_SIZE_MB) and switch the gmc modules to use that rather than the hardcoded 1024ULL.

Alex

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -1
 int amdgpu_moverate = -1; /* auto */
 int amdgpu_benchmarking = 0;
 int amdgpu_testing = 0;
--

1.9.1

_______________________________________________
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): CADnq5_P+Cb8-LF0b=LwueCGfTsdBvczeTcMgB2W85Kv7s1G20w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw

Re: [PATCH 2/2] drm/amdgpu: increase gtt size to 3GB by default

Am 20.04.2017 um 14:43 schrieb Alex Deucher:

Quoted 14 lines · Chunming Zhou
Quoted 13 lines
Change-Id Icdf2486a2d1116e71dc8958cda679a4a83838489
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index d74a406..8f201a3 100644
@@ -65,7 +65,7 @@
  #define KMS_DRIVER_PATCHLEVEL  0
 
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c line 68

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -1
  int amdgpu_vram_limit = 0;
-int amdgpu_gart_size = -1; /* auto */
+int amdgpu_gart_size = 3072; /* 3GB by default */

This breaks the auto setting. Please add a global define for gtt size (e.g., AMDGPU_DEFAULT_GTT_SIZE_MB) and switch the gmc modules to use that rather than the hardcoded 1024ULL.

I think this change isn't necessary any more.

Looks like I've found and fixed the root cause of the issue with "drm/amdgpu: fix amdgpu_ttm_bo_eviction_valuable".

Please test that patch if your test case now works without any additional changes.

Christian.

Quoted 9 lines

Alex

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -1
  int amdgpu_moverate = -1; /* auto */
  int amdgpu_benchmarking = 0;
  int amdgpu_testing = 0;
--

1.9.1

Quoted 8 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

_______________________________________________
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): c82c2217-8008-c449-7ad0-8c97d8cc6e39-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

author
#8 lore raw

Re: [PATCH 2/2] drm/amdgpu: increase gtt size to 3GB by default

Quoted 22 lines · Christian König

Am 20.04.2017 um 14:43 schrieb Alex Deucher:

Quoted 14 lines · Chunming Zhou
Quoted 13 lines
Change-Id Icdf2486a2d1116e71dc8958cda679a4a83838489
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index d74a406..8f201a3 100644
@@ -65,7 +65,7 @@
  #define KMS_DRIVER_PATCHLEVEL  0
 
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c line 68

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -1
  int amdgpu_vram_limit = 0;
-int amdgpu_gart_size = -1; /* auto */
+int amdgpu_gart_size = 3072; /* 3GB by default */

This breaks the auto setting. Please add a global define for gtt size (e.g., AMDGPU_DEFAULT_GTT_SIZE_MB) and switch the gmc modules to use that rather than the hardcoded 1024ULL.

Quoted 5 lines

I think this change isn't necessary any more.

Looks like I've found and fixed the root cause of the issue with "drm/amdgpu: fix amdgpu_ttm_bo_eviction_valuable".

Please test that patch if your test case now works without any additional changes.

the result is same, since game needs more than 2GB memory totally.

Regards,
David Zhou

Quoted 22 lines

Christian.

Quoted 17 lines

Alex

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
  int amdgpu_moverate = -1; /* auto */
  int amdgpu_benchmarking = 0;
  int amdgpu_testing = 0;
Signature · 6 lines
1.9.1

_______________________________________________
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

Reviewed-by
#9 lore raw
In reply to a message not in the archive
Quoted 3 lines · Chunming Zhou
Change-Id If0474e24e14d237d2d55731871c5ceb11e5a3601
Quoted 60 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c |  9 +++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 10 +++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +9 -0
index 69ab2ee..f586cb7 100644
@@ -136,6 +136,15 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man,
        return r;
 }
 
+void amdgpu_gtt_mgr_print(struct seq_file *m, struct ttm_mem_type_manager *man)
+{
+       struct amdgpu_device *adev = amdgpu_ttm_adev(man->bdev);
+       struct amdgpu_gtt_mgr *mgr = man->priv;
+
+       seq_printf(m, "man size:%llu pages, gtt available:%llu pages, usage:%lluMB\n",
+                  man->size, mgr->available, (u64)atomic64_read(&adev->gtt_usage) >> 20);
+
+}
 /**
  * amdgpu_gtt_mgr_new - allocate a new node
  *
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +9 -2
index c3112b6..2b402d2 100644
@@ -1540,6 +1540,8 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo,
 
 #if defined(CONFIG_DEBUG_FS)
 
+extern void amdgpu_gtt_mgr_print(struct seq_file *m, struct ttm_mem_type_manager
+                                *man);
 static int amdgpu_mm_dump_table(struct seq_file *m, void *data)
 {
        struct drm_info_node *node = (struct drm_info_node *)m->private;
@@ -1553,11 +1555,17 @@ static int amdgpu_mm_dump_table(struct seq_file *m, void *data)
        spin_lock(&glob->lru_lock);
        ret = drm_mm_dump_table(m, mm);
        spin_unlock(&glob->lru_lock);
-       if (ttm_pl == TTM_PL_VRAM)
+       switch (ttm_pl) {
+       case TTM_PL_VRAM:
                seq_printf(m, "man size:%llu pages, ram usage:%lluMB, vis usage:%lluMB\n",
                           adev->mman.bdev.man[ttm_pl].size,
                           (u64)atomic64_read(&adev->vram_usage) >> 20,
                           (u64)atomic64_read(&adev->vram_vis_usage) >> 20);
+               break;
+       case TTM_PL_TT:
+               amdgpu_gtt_mgr_print(m, &adev->mman.bdev.man[TTM_PL_TT]);
+               break;
+       }
        return ret;
 }
 
--

1.9.1

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