All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: execute amdgpu_ring_patch_cond_exec() only for valid job
@ 2018-07-09 10:30 Shirish S
       [not found] ` <1531132214-26906-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Shirish S @ 2018-07-09 10:30 UTC (permalink / raw)
  To: Monk.Liu-5C7GfCeVMHo, alexander.deucher-5C7GfCeVMHo,
	christian.koenig-5C7GfCeVMHo
  Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Shirish S

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.

Signed-off-by: Shirish S <shirish.s@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index 31f8170..3381ada 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -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
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: execute amdgpu_ring_patch_cond_exec() only for valid job
       [not found] ` <1531132214-26906-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org>
@ 2018-07-09 10:39   ` Qu, Jim
  2018-07-09 11:27   ` Christian König
  1 sibling, 0 replies; 3+ messages in thread
From: Qu, Jim @ 2018-07-09 10:39 UTC (permalink / raw)
  To: S, Shirish, Liu, Monk, Deucher, Alexander, Koenig, Christian
  Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

it should be omited when coding.
Reviewed-by: Jim Qu <Jim.Qu@amd.com>

Thanks
JimQu

________________________________________
发件人: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> 代表 Shirish S <shirish.s@amd.com>
发送时间: 2018年7月9日 18:30:14
收件人: Liu, Monk; Deucher, Alexander; Koenig, Christian
抄送: amd-gfx@lists.freedesktop.org; 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.

Signed-off-by: Shirish S <shirish.s@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index 31f8170..3381ada 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -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
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
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

* Re: [PATCH] drm/amdgpu: execute amdgpu_ring_patch_cond_exec() only for valid job
       [not found] ` <1531132214-26906-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org>
  2018-07-09 10:39   ` 答复: " Qu, Jim
@ 2018-07-09 11:27   ` Christian König
  1 sibling, 0 replies; 3+ messages in thread
From: Christian König @ 2018-07-09 11:27 UTC (permalink / raw)
  To: Shirish S, Monk.Liu-5C7GfCeVMHo, alexander.deucher-5C7GfCeVMHo
  Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Am 09.07.2018 um 12:30 schrieb Shirish S:
> 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.
>
> Signed-off-by: Shirish S <shirish.s@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> index 31f8170..3381ada 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> @@ -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.

>   		amdgpu_ring_patch_cond_exec(ring, patch_offset);
>   
>   	ring->current_ctx = fence_ctx;

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

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

end of thread, other threads:[~2018-07-09 11:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-09 10:30 [PATCH] drm/amdgpu: execute amdgpu_ring_patch_cond_exec() only for valid job Shirish S
     [not found] ` <1531132214-26906-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org>
2018-07-09 10:39   ` 答复: " Qu, Jim
2018-07-09 11:27   ` Christian König

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.