All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/sched: Avoid infinite waits in the drm_sched_entity_destroy() path
@ 2020-10-02  6:55 Boris Brezillon
  2020-10-02  8:31 ` Christian König
  0 siblings, 1 reply; 3+ messages in thread
From: Boris Brezillon @ 2020-10-02  6:55 UTC (permalink / raw)
  To: dri-devel
  Cc: Steven Price, Rob Herring, Alyssa Rosenzweig, Boris Brezillon,
	Alex Deucher, Robin Murphy, Christian König

If we don't initialize the entity to idle and the entity is never
scheduled before being destroyed we end up with an infinite wait in the
destroy path.

v2:
- Add Steven's R-b

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
---
This is something I noticed while debugging another issue on panfrost
causing the scheduler to be in a weird state where new entities were no
longer scheduled. This was causing all userspace threads trying to close
their DRM fd to be blocked in kernel space waiting for this "entity is
idle" event. I don't know if that fix is legitimate (now that we fixed
the other bug we don't seem to end up in that state anymore), but I
thought I'd share it anyway.
---
 drivers/gpu/drm/scheduler/sched_entity.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
index 146380118962..f8ec277a6aa8 100644
--- a/drivers/gpu/drm/scheduler/sched_entity.c
+++ b/drivers/gpu/drm/scheduler/sched_entity.c
@@ -73,6 +73,9 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
 
 	init_completion(&entity->entity_idle);
 
+	/* We start in an idle state. */
+	complete(&entity->entity_idle);
+
 	spin_lock_init(&entity->rq_lock);
 	spsc_queue_init(&entity->job_queue);
 
-- 
2.26.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2020-10-02 12:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-02  6:55 [PATCH v2] drm/sched: Avoid infinite waits in the drm_sched_entity_destroy() path Boris Brezillon
2020-10-02  8:31 ` Christian König
2020-10-02 12:28   ` Boris Brezillon

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.