Skip to contentSkip to conversation

drm/lima: fix sched context destroy

PATCH Applied Erico Nunes 4 participants 4 messages Jun 6, 2023 – Jun 7, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/lima: fix sched context destroy

The drm sched entity must be flushed before finishing, to account for jobs potentially still in flight at that time.
Lima did not do this flush until now, so switch the destroy call to the drm_sched_entity_destroy() wrapper which will take care of that.

This fixes a regression on lima which started since the rework in commit 2fdb8a8f07c2 ("drm/scheduler: rework entity flush, kill and fini") where some specific types of applications may hang indefinitely.

Fixes 2fdb8a8f07c2 ("drm/scheduler: rework entity flush, kill and fini")
---
 drivers/gpu/drm/lima/lima_sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/lima/lima_sched.c +1 -1
index ff003403fbbc..ffd91a5ee299 100644
@@ -165,7 +165,7 @@ int lima_sched_context_init(struct lima_sched_pipe *pipe,
 void lima_sched_context_fini(struct lima_sched_pipe *pipe,
 			     struct lima_sched_context *context)
 {
-	drm_sched_entity_fini(&context->base);
+	drm_sched_entity_destroy(&context->base);
 }
 
 struct dma_fence *lima_sched_context_queue_task(struct lima_sched_task *task)
Signature · 1 line
2.40.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Erico Nunes

The drm sched entity must be flushed before finishing, to account for jobs potentially still in flight at that time.
Lima did not do this flush until now, so switch the destroy call to the drm_sched_entity_destroy() wrapper which will take care of that.

Quoted 6 lines

This fixes a regression on lima which started since the rework in commit 2fdb8a8f07c2 ("drm/scheduler: rework entity flush, kill and fini") where some specific types of applications may hang indefinitely.

Fixes 2fdb8a8f07c2 ("drm/scheduler: rework entity flush, kill and fini")
Quoted 20 lines
---
 drivers/gpu/drm/lima/lima_sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/lima/lima_sched.c +1 -2
index ff003403fbbc..ffd91a5ee299 100644
@@ -165,7 +165,7 @@ int lima_sched_context_init(struct lima_sched_pipe *pipe,
 void lima_sched_context_fini(struct lima_sched_pipe *pipe,
                             struct lima_sched_context *context)
 {
-       drm_sched_entity_fini(&context->base);
+       drm_sched_entity_destroy(&context->base);
 }
 
 struct dma_fence *lima_sched_context_queue_task(struct lima_sched_task *task)
--

2.40.1

maintainer Reviewed-by Applied
#2 lore raw

Applied to drm-misc-fixes.

Quoted 37 lines · Vasily Khoruzhick
Quoted 6 lines · Erico Nunes

The drm sched entity must be flushed before finishing, to account for jobs potentially still in flight at that time.
Lima did not do this flush until now, so switch the destroy call to the drm_sched_entity_destroy() wrapper which will take care of that.

Quoted 6 lines

This fixes a regression on lima which started since the rework in commit 2fdb8a8f07c2 ("drm/scheduler: rework entity flush, kill and fini") where some specific types of applications may hang indefinitely.

Fixes 2fdb8a8f07c2 ("drm/scheduler: rework entity flush, kill and fini")
Quoted 20 lines
---
 drivers/gpu/drm/lima/lima_sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/lima/lima_sched.c +1 -2
index ff003403fbbc..ffd91a5ee299 100644
@@ -165,7 +165,7 @@ int lima_sched_context_init(struct lima_sched_pipe *pipe,
 void lima_sched_context_fini(struct lima_sched_pipe *pipe,
                             struct lima_sched_context *context)
 {
-       drm_sched_entity_fini(&context->base);
+       drm_sched_entity_destroy(&context->base);
 }
 
 struct dma_fence *lima_sched_context_queue_task(struct lima_sched_task *task)
--

2.40.1

#3 lore raw

While you are at it: It's beneficial for drivers to implement the flush callback on the file descriptor.

This way you can still send a SIGKILL when a terminating application waits for the entity to be flushed out to the hardware and all the pending jobs are canceled.

Regards,
Christian.

Am 07.06.23 um 06:04 schrieb Qiang Yu:

Quoted 39 lines

Applied to drm-misc-fixes.

Quoted 34 lines · Vasily Khoruzhick
Quoted 11 lines · Erico Nunes

The drm sched entity must be flushed before finishing, to account for jobs potentially still in flight at that time.
Lima did not do this flush until now, so switch the destroy call to the drm_sched_entity_destroy() wrapper which will take care of that.

This fixes a regression on lima which started since the rework in commit 2fdb8a8f07c2 ("drm/scheduler: rework entity flush, kill and fini") where some specific types of applications may hang indefinitely.

Fixes 2fdb8a8f07c2 ("drm/scheduler: rework entity flush, kill and fini")
Quoted 20 lines
---
  drivers/gpu/drm/lima/lima_sched.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/lima/lima_sched.c +1 -2
index ff003403fbbc..ffd91a5ee299 100644
@@ -165,7 +165,7 @@ int lima_sched_context_init(struct lima_sched_pipe *pipe,
  void lima_sched_context_fini(struct lima_sched_pipe *pipe,
                              struct lima_sched_context *context)
  {
-       drm_sched_entity_fini(&context->base);
+       drm_sched_entity_destroy(&context->base);
  }
 
  struct dma_fence *lima_sched_context_queue_task(struct lima_sched_task *task)
--

2.40.1