All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu:fix write more dws to ring
@ 2017-01-18  6:56 Monk Liu
       [not found] ` <1484722606-14767-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Monk Liu @ 2017-01-18  6:56 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Monk Liu

Change-Id: I745512ed7d181e2cd0ce668c86ccfbb2dec80d4d
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index 9129b8c..6c24ed8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -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
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* 答复: [PATCH] drm/amdgpu:fix write more dws to ring
       [not found] ` <1484722606-14767-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
@ 2017-01-18  7:04   ` Liu, Monk
       [not found]     ` <BY2PR1201MB1110D85DD19A01E8F9090AD3847F0-O28G1zQ8oGliQkyLPkmea2rFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Liu, Monk @ 2017-01-18  7:04 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1: Type: text/plain, Size: 2126 bytes --]

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 <Monk.Liu@amd.com>
发送时间: 2017年1月18日 14:56:46
收件人: amd-gfx@lists.freedesktop.org
抄送: Liu, Monk
主题: [PATCH] drm/amdgpu:fix write more dws to ring

Change-Id: I745512ed7d181e2cd0ce668c86ccfbb2dec80d4d
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index 9129b8c..6c24ed8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -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


[-- Attachment #1.2: Type: text/html, Size: 4461 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* 答复: [PATCH] drm/amdgpu:fix write more dws to ring
       [not found]     ` <BY2PR1201MB1110D85DD19A01E8F9090AD3847F0-O28G1zQ8oGliQkyLPkmea2rFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
@ 2017-01-18  7:17       ` Liu, Monk
  0 siblings, 0 replies; 3+ messages in thread
From: Liu, Monk @ 2017-01-18  7:17 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1: Type: text/plain, Size: 2518 bytes --]

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
收件人: amd-gfx@lists.freedesktop.org
主题: 答复: [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 <Monk.Liu@amd.com>
发送时间: 2017年1月18日 14:56:46
收件人: amd-gfx@lists.freedesktop.org
抄送: Liu, Monk
主题: [PATCH] drm/amdgpu:fix write more dws to ring

Change-Id: I745512ed7d181e2cd0ce668c86ccfbb2dec80d4d
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index 9129b8c..6c24ed8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -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


[-- Attachment #1.2: Type: text/html, Size: 5526 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-18  7:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-18  6:56 [PATCH] drm/amdgpu:fix write more dws to ring Monk Liu
     [not found] ` <1484722606-14767-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-01-18  7:04   ` 答复: " Liu, Monk
     [not found]     ` <BY2PR1201MB1110D85DD19A01E8F9090AD3847F0-O28G1zQ8oGliQkyLPkmea2rFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-01-18  7:17       ` Liu, Monk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.