drm/amdgpu: dont schedule jobs while in reset
Subsystems (2)
PATCH 1/1 drm/amdgpu: dont schedule jobs while in reset
[Why]
doing kthread_park()/unpark() from drm_sched_entity_fini while GPU reset is in progress defeats all the purpose of drm_sched_stop->kthread_park.
If drm_sched_entity_fini->kthread_unpark() happens AFTER drm_sched_stop->kthread_park nothing prevents from another (third) thread to keep submitting job to HW which will be picked up by the unparked scheduler thread and try to submit to HW but fail because the HW ring is deactivated.
[How]
grab the reset lock before calling drm_sched_entity_fini()
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +4 -1
@@ -604,8 +604,11 @@ void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr)continue ; } -for (i =0 ; i < num_entities; i++) +for (i =0 ; i < num_entities; i++) { +mutex_lock (&ctx->adev->lock_reset);drm_sched_entity_fini (&ctx->entities[0 ][i].entity); +mutex_unlock (&ctx->adev->lock_reset); + } } }
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): 1572426811-30618-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org
Am 30.10.19 um 10:13 schrieb S, Shirish:
Quoted 11 lines
[Why]
doing kthread_park()/unpark() from
drm_sched_entity_finiwhile GPU reset is in progress defeats all the purpose ofdrm_sched_stop->kthread_park.
Ifdrm_sched_entity_fini->kthread_unpark()happens AFTERdrm_sched_stop->kthread_parknothing prevents from another (third) thread to keep submitting job to HW which will be picked up by the unparked scheduler thread and try to submit to HW but fail because the HW ring is deactivated.
Quoted 5 lines
[How]
grab the reset lock before callingdrm_sched_entity_fini()Signed-off-by Shirish S <[email protected]>Suggested-by Christian König <[email protected]>
Patch itself is Reviewed-by: Christian König <[email protected]>
Does that also fix the problems you have been seeing?
Thanks,
Christian.
Quoted 11 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +0
-0@@ -604,8 +604,11 @@ void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr)continue ; }
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr) · line 614
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +4
-1-for (i =0 ; i < num_entities; i++) +for (i =0 ; i < num_entities; i++) { +mutex_lock (&ctx->adev->lock_reset);drm_sched_entity_fini (&ctx->entities[0 ][i].entity); +mutex_unlock (&ctx->adev->lock_reset); + } } }
_______________________________________________
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): bfefc5cb-c560-868a-7b03-90f4e5118451-5C7GfCeVMHo@public.gmane.org
Quoted 12 lines · Christian
Am 30.10.19 um 10:13 schrieb S, Shirish:
Quoted 11 lines
[Why]
doing kthread_park()/unpark() from
drm_sched_entity_finiwhile GPU reset is in progress defeats all the purpose ofdrm_sched_stop->kthread_park.
Ifdrm_sched_entity_fini->kthread_unpark()happens AFTERdrm_sched_stop->kthread_parknothing prevents from another (third) thread to keep submitting job to HW which will be picked up by the unparked scheduler thread and try to submit to HW but fail because the HW ring is deactivated.
Quoted 8 lines
Quoted 5 lines
[How]
grab the reset lock before callingdrm_sched_entity_fini()Signed-off-by Shirish S <[email protected]>Suggested-by Christian König <[email protected]>Patch itself is Reviewed-by: Christian König <[email protected]>
Does that also fix the problems you have been seeing?
Yes Christian.
Regards,
Shirish S
Quoted 25 lines
Thanks,
Christian.Quoted 21 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +4
-1@@ -604,8 +604,11 @@ void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr)continue ; } -for (i =0 ; i < num_entities; i++) +for (i =0 ; i < num_entities; i++) { +mutex_lock (&ctx->adev->lock_reset);drm_sched_entity_fini (&ctx->entities[0 ][i].entity); +mutex_unlock (&ctx->adev->lock_reset); + } } }
Signature · 7 lines
Regards, Shirish S _______________________________________________ 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): 58085e1d-39f4-1907-4495-71a13c52b825-5C7GfCeVMHo@public.gmane.org
Quoted 18 lines · Shirish
Quoted 17 lines · Christian
Am 30.10.19 um 10:13 schrieb S, Shirish:
Quoted 16 lines
[Why]
doing kthread_park()/unpark() from
drm_sched_entity_finiwhile GPU reset is in progress defeats all the purpose ofdrm_sched_stop->kthread_park.
Ifdrm_sched_entity_fini->kthread_unpark()happens AFTERdrm_sched_stop->kthread_parknothing prevents from another (third) thread to keep submitting job to HW which will be picked up by the unparked scheduler thread and try to submit to HW but fail because the HW ring is deactivated.[How]
grab the reset lock before callingdrm_sched_entity_fini()Signed-off-by Shirish S <[email protected]>Suggested-by Christian König <[email protected]>
Quoted 8 lines
Quoted 3 lines
Patch itself is Reviewed-by: Christian König <[email protected]>
Does that also fix the problems you have been seeing?
Yes Christian.
Regards,
Shirish S
Missed that one, why don't we fix it within scheduler code - the race is within scheduler ?
Andrey
Quoted 16 lines
Quoted 16 lines
Thanks,
Christian.Quoted 12 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +0
-0@@ -604,8 +604,11 @@ void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr)continue ; }
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr) · line 614
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +4
-1-for (i =0 ; i < num_entities; i++) +for (i =0 ; i < num_entities; i++) { +mutex_lock (&ctx->adev->lock_reset);drm_sched_entity_fini (&ctx->entities[0 ][i].entity); +mutex_unlock (&ctx->adev->lock_reset); + } } }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Grodzovsky, Andrey
Reviewed-by Andrey GrodzovskyAndrey
Quoted 36 lines · Christian
Am 30.10.19 um 10:13 schrieb S, Shirish:
Quoted 11 lines
[Why]
doing kthread_park()/unpark() from
drm_sched_entity_finiwhile GPU reset is in progress defeats all the purpose ofdrm_sched_stop->kthread_park.
Ifdrm_sched_entity_fini->kthread_unpark()happens AFTERdrm_sched_stop->kthread_parknothing prevents from another (third) thread to keep submitting job to HW which will be picked up by the unparked scheduler thread and try to submit to HW but fail because the HW ring is deactivated.Quoted 5 lines
[How]
grab the reset lock before callingdrm_sched_entity_fini()Signed-off-by Shirish S <[email protected]>Suggested-by Christian König <[email protected]>Patch itself is Reviewed-by: Christian König <[email protected]>
Does that also fix the problems you have been seeing?
Thanks,
Christian.Quoted 12 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +0
-0@@ -604,8 +604,11 @@ void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr)continue ; }
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr) · line 614
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +4
-1-for (i =0 ; i < num_entities; i++) +for (i =0 ; i < num_entities; i++) { +mutex_lock (&ctx->adev->lock_reset);drm_sched_entity_fini (&ctx->entities[0 ][i].entity); +mutex_unlock (&ctx->adev->lock_reset); + } } }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx