Skip to contentSkip to conversation

drm/amdgpu: fix usable gart size calculation

PATCH In review Nirmoy Das 3 participants 3 messages Nov 13, 2020 – Nov 14, 2020

Subsystems (2)
lore
Share & tools
lore

Nirmoy Das

author
#0 lore raw

PATCH 1/1 drm/amdgpu: fix usable gart size calculation

amdgpu_do_test_moves() is failing because of wrong usable gart size calculation and throwing:

[drm:amdgpu_do_test_moves [amdgpu]] *ERROR* 0000000020bdc9f3 bind failed

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c +4 -9
index 6042b3b81a4c..7b230bcbf2c6 100644
@@ -42,16 +42,11 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
 	size = 1024 * 1024;
 
 	/* Number of tests =
-	 * (Total GTT - IB pool - writeback page - ring buffers) / test size
+	 * (Total GTT - gart_pin_size - (2 transfer windows for buffer moves)) / test size
 	 */
-	n = adev->gmc.gart_size - AMDGPU_IB_POOL_SIZE;
-	for (i = 0; i < AMDGPU_MAX_RINGS; ++i)
-		if (adev->rings[i])
-			n -= adev->rings[i]->ring_size;
-	if (adev->wb.wb_obj)
-		n -= AMDGPU_GPU_PAGE_SIZE;
-	if (adev->irq.ih.ring_obj)
-		n -= adev->irq.ih.ring_size;
+	n = adev->gmc.gart_size - atomic64_read(&adev->gart_pin_size);
+	n -= AMDGPU_GTT_MAX_TRANSFER_SIZE * AMDGPU_GTT_NUM_TRANSFER_WINDOWS *
+		AMDGPU_GPU_PAGE_SIZE;
 	n /= size;
 
 	gtt_obj = kcalloc(n, sizeof(*gtt_obj), GFP_KERNEL);
Signature · 6 lines
2.29.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Nirmoy Das

amdgpu_do_test_moves() is failing because of wrong usable gart size calculation and throwing:

[drm:amdgpu_do_test_moves [amdgpu]] *ERROR* 0000000020bdc9f3 bind failed

Quoted 32 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c +4 -10
index 6042b3b81a4c..7b230bcbf2c6 100644
@@ -42,16 +42,11 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
        size = 1024 * 1024;
 
        /* Number of tests =
-        * (Total GTT - IB pool - writeback page - ring buffers) / test size
+        * (Total GTT - gart_pin_size - (2 transfer windows for buffer moves)) / test size
         */
-       n = adev->gmc.gart_size - AMDGPU_IB_POOL_SIZE;
-       for (i = 0; i < AMDGPU_MAX_RINGS; ++i)
-               if (adev->rings[i])
-                       n -= adev->rings[i]->ring_size;
-       if (adev->wb.wb_obj)
-               n -= AMDGPU_GPU_PAGE_SIZE;
-       if (adev->irq.ih.ring_obj)
-               n -= adev->irq.ih.ring_size;
+       n = adev->gmc.gart_size - atomic64_read(&adev->gart_pin_size);
+       n -= AMDGPU_GTT_MAX_TRANSFER_SIZE * AMDGPU_GTT_NUM_TRANSFER_WINDOWS *
+               AMDGPU_GPU_PAGE_SIZE;
        n /= size;
 
        gtt_obj = kcalloc(n, sizeof(*gtt_obj), GFP_KERNEL);
--

2.29.0

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

Reviewed-by on v1 1/1
#2 lore raw
In reply to Nirmoy Das

Am 13.11.20 um 18:33 schrieb Nirmoy Das:

Quoted 6 lines

amdgpu_do_test_moves() is failing because of wrong usable gart size calculation and throwing:

[drm:amdgpu_do_test_moves [amdgpu]] *ERROR* 0000000020bdc9f3 bind failed

Quoted 19 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 13 ++++---------
  1 file changed, 4 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c +1 -5
index 6042b3b81a4c..7b230bcbf2c6 100644
@@ -42,16 +42,11 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
  	size = 1024 * 1024;
 
  	/* Number of tests =
-	 * (Total GTT - IB pool - writeback page - ring buffers) / test size
+	 * (Total GTT - gart_pin_size - (2 transfer windows for buffer moves)) / test size
  	 */
-	n = adev->gmc.gart_size - AMDGPU_IB_POOL_SIZE;
-	for (i = 0; i < AMDGPU_MAX_RINGS; ++i)
-		if (adev->rings[i])
-			n -= adev->rings[i]->ring_size;

drivers/gpu/drm/amd/amdgpu/amdgpu_test.c static void amdgpu_do_test_moves(struct amdgpu_device *adev) · line 52

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c +3 -4
-	if (adev->wb.wb_obj)
-		n -= AMDGPU_GPU_PAGE_SIZE;
-	if (adev->irq.ih.ring_obj)
-		n -= adev->irq.ih.ring_size;
+	n = adev->gmc.gart_size - atomic64_read(&adev->gart_pin_size);
+	n -= AMDGPU_GTT_MAX_TRANSFER_SIZE * AMDGPU_GTT_NUM_TRANSFER_WINDOWS *
+		AMDGPU_GPU_PAGE_SIZE;
  	n /= size;
 
  	gtt_obj = kcalloc(n, sizeof(*gtt_obj), GFP_KERNEL);

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