Skip to contentSkip to conversation

drm/amdgpu: execute amdgpu_ring_patch_cond_exec() only for valid job

PATCH NAK Shirish S 3 participants 3 messages Jul 9, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Shirish S

author
#0 lore raw

PATCH 1/1 drm/amdgpu: execute amdgpu_ring_patch_cond_exec() only for valid job

issue:
BUG_ON(ring->ring[offset] != 0x55aa55aa) is hit on resume from S3 state.

fix & analysis:

fix is to check for valid job, which in continuation to the below patch:
113890e drm/amdgpu: cond_exec only for schedule with a job

Since cond_exec is not initialised if there is no job, 0x55aa55aa is not written to ring, as a result in patch_cond_exec callback, BUG_ON is hit where it checks for the same 0x55aa55aa value in register.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -1
index 31f8170..3381ada 100644
@@ -249,7 +249,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 				       fence_flags | AMDGPU_FENCE_FLAG_64BIT);
 	}
 
-	if (patch_offset != ~0 && ring->funcs->patch_cond_exec)
+	if (job && patch_offset != ~0 && ring->funcs->patch_cond_exec)
 		amdgpu_ring_patch_cond_exec(ring, patch_offset);
 
 	ring->current_ctx = fence_ctx;
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): 1531132214-26906-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org

Reviewed-by Jim Qu
#2 lore raw

it should be omited when coding.

Thanks
JimQu

________________________________________
发件人: amd-gfx <[email protected]> 代表 Shirish S <[email protected]> 发送时间: 2018年7月9日 18:30:14
收件人: Liu, Monk; Deucher, Alexander; Koenig, Christian
抄送: [email protected]; S, Shirish
主题: [PATCH] drm/amdgpu: execute amdgpu_ring_patch_cond_exec() only for valid job

issue:
BUG_ON(ring->ring[offset] != 0x55aa55aa) is hit on resume from S3 state.

fix & analysis:

fix is to check for valid job, which in continuation to the below patch:
113890e drm/amdgpu: cond_exec only for schedule with a job

Since cond_exec is not initialised if there is no job, 0x55aa55aa is not written to ring, as a result in patch_cond_exec callback, BUG_ON is hit where it checks for the same 0x55aa55aa value in register.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -1
index 31f8170..3381ada 100644
@@ -249,7 +249,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
                                       fence_flags | AMDGPU_FENCE_FLAG_64BIT);
        }
 
-       if (patch_offset != ~0 && ring->funcs->patch_cond_exec)
+       if (job && patch_offset != ~0 && ring->funcs->patch_cond_exec)
                amdgpu_ring_patch_cond_exec(ring, patch_offset);
 
        ring->current_ctx = fence_ctx;

--
2.7.4

_______________________________________________
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

#3 lore raw
In reply to a message not in the archive

Am 09.07.2018 um 12:30 schrieb Shirish S:

Quoted 24 lines

issue:
BUG_ON(ring->ring[offset] != 0x55aa55aa) is hit on resume from S3 state.

fix & analysis:

fix is to check for valid job, which in continuation to the below patch:
113890e drm/amdgpu: cond_exec only for schedule with a job

Since cond_exec is not initialised if there is no job, 0x55aa55aa is not written to ring, as a result in patch_cond_exec callback, BUG_ON is hit where it checks for the same 0x55aa55aa value in register.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0 -0
index 31f8170..3381ada 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, · line 252

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -1
@@ -249,7 +249,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
  				       fence_flags | AMDGPU_FENCE_FLAG_64BIT);
  	}
 
-	if (patch_offset != ~0 && ring->funcs->patch_cond_exec)
+	if (job && patch_offset != ~0 && ring->funcs->patch_cond_exec)

NAK, when not patch condition is emitted the patch_offset shouldn't be zero.

So you rational to explain why testing the job doesn't make sense (but we could drop testing patch_offset alltogether).

Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, · line 255

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0 -0
  		amdgpu_ring_patch_cond_exec(ring, patch_offset);
 
  	ring->current_ctx = fence_ctx;

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