Skip to contentSkip to conversation

drm/amdgpu:fix write more dws to ring

PATCH In review Monk Liu 1 participant 3 messages Jan 18, 2017 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Monk Liu

author
#0 lore raw

PATCH 1/1 drm/amdgpu:fix write more dws to ring

Change-Id I745512ed7d181e2cd0ce668c86ccfbb2dec80d4d
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +2 -5
index 9129b8c..6c24ed8 100644
@@ -125,7 +125,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 	unsigned patch_offset = ~0;
 	struct amdgpu_vm *vm;
 	uint64_t fence_ctx;
-	uint32_t status = 0, alloc_size;
+	uint32_t status = 0;
 
 	unsigned i;
 	int r = 0;
@@ -152,10 +152,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 		return -EINVAL;
 	}
 
-	alloc_size = ring->funcs->emit_frame_size + num_ibs *
-		ring->funcs->emit_ib_size;
-
-	r = amdgpu_ring_alloc(ring, alloc_size);
+	r = amdgpu_ring_alloc(ring, ring->funcs.align_mask + 1);
 	if (r) {
 		dev_err(adev->dev, "scheduling IB failed (%d).\n", r);
 		return 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): 1484722606-14767-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

Hi Alex

previous patch is just for showing what I want to express :

I found "emit_frame_size" is not doable anymore for gfx ring ...

we already set "funcs->align_mask" to 0xff which means "amdgpu_ring_commit" call will automatically insert some NOP to make each submission 256 dword aligned (and will be 512 if we used above 256 DWs), so at least we need 256 dw per submit.

but (emit_frame_size + ib_count * emit_ib_size) is always less than 256 , and if we pass it to amdgpu_ring_alloc, we'll run into this issue:

[drm:amdgpu_ring_insert_nop [amdgpu]] *ERROR* amdgpu: writing more dwords to the ring than expected!

any comments ?

BR Monk

________________________________
发件人: Monk Liu <[email protected]>
发送时间: 2017年1月18日 14:56:46
收件人: [email protected]
抄送: Liu, Monk
主题: [PATCH] drm/amdgpu:fix write more dws to ring

Change-Id I745512ed7d181e2cd0ce668c86ccfbb2dec80d4d
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +2 -5
index 9129b8c..6c24ed8 100644
@@ -125,7 +125,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
         unsigned patch_offset = ~0;
         struct amdgpu_vm *vm;
         uint64_t fence_ctx;
-       uint32_t status = 0, alloc_size;
+       uint32_t status = 0;
 
         unsigned i;
         int r = 0;
@@ -152,10 +152,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
                 return -EINVAL;
         }
 
-       alloc_size = ring->funcs->emit_frame_size + num_ibs *
-               ring->funcs->emit_ib_size;
-
-       r = amdgpu_ring_alloc(ring, alloc_size);
+       r = amdgpu_ring_alloc(ring, ring->funcs.align_mask + 1);
         if (r) {
                 dev_err(adev->dev, "scheduling IB failed (%d).\n", r);
                 return r;

--
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): BY2PR1201MB1110D85DD19A01E8F9090AD3847F0-O28G1zQ8oGliQkyLPkmea2rFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]

author
#4 lore raw

sorry, I see we already have padding inside ring_alloc, I'll see why I still get

[drm:amdgpu_ring_insert_nop [amdgpu]] *ERROR* amdgpu: writing more dwords to the ring than expected!

BR Monk

________________________________
发件人: Liu, Monk
发送时间: 2017年1月18日 15:04:57
收件人: [email protected]
主题: 答复: [PATCH] drm/amdgpu:fix write more dws to ring

Hi Alex

previous patch is just for showing what I want to express :

I found "emit_frame_size" is not doable anymore for gfx ring ...

we already set "funcs->align_mask" to 0xff which means "amdgpu_ring_commit" call will automatically insert some NOP to make each submission 256 dword aligned (and will be 512 if we used above 256 DWs), so at least we need 256 dw per submit.

but (emit_frame_size + ib_count * emit_ib_size) is always less than 256 , and if we pass it to amdgpu_ring_alloc, we'll run into this issue:

[drm:amdgpu_ring_insert_nop [amdgpu]] *ERROR* amdgpu: writing more dwords to the ring than expected!

any comments ?

BR Monk

________________________________
发件人: Monk Liu <[email protected]>
发送时间: 2017年1月18日 14:56:46
收件人: [email protected]
抄送: Liu, Monk
主题: [PATCH] drm/amdgpu:fix write more dws to ring

Change-Id I745512ed7d181e2cd0ce668c86ccfbb2dec80d4d
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +2 -5
index 9129b8c..6c24ed8 100644
@@ -125,7 +125,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
         unsigned patch_offset = ~0;
         struct amdgpu_vm *vm;
         uint64_t fence_ctx;
-       uint32_t status = 0, alloc_size;
+       uint32_t status = 0;
 
         unsigned i;
         int r = 0;
@@ -152,10 +152,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
                 return -EINVAL;
         }
 
-       alloc_size = ring->funcs->emit_frame_size + num_ibs *
-               ring->funcs->emit_ib_size;
-
-       r = amdgpu_ring_alloc(ring, alloc_size);
+       r = amdgpu_ring_alloc(ring, ring->funcs.align_mask + 1);
         if (r) {
                 dev_err(adev->dev, "scheduling IB failed (%d).\n", r);
                 return r;

--
2.7.4

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