Skip to content

Commit a20c75d

Browse files
mbrost05rodrigovivi
authored andcommitted
drm/xe: Call __guc_exec_queue_fini_async direct for KERNEL exec_queues
Usually we call __guc_exec_queue_fini_async via a worker as the exec_queue fini can be done from within the GPU scheduler which creates a circular dependency without a worker. Kernel exec_queues are fini'd at driver unload (not from within the GPU scheduler) so it is safe to directly call __guc_exec_queue_fini_async. Suggested-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent ca8656a commit a20c75d

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

drivers/gpu/drm/xe/xe_guc_submit.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -956,27 +956,19 @@ static void __guc_exec_queue_fini_async(struct work_struct *w)
956956
xe_sched_entity_fini(&ge->entity);
957957
xe_sched_fini(&ge->sched);
958958

959-
if (!(q->flags & EXEC_QUEUE_FLAG_KERNEL)) {
960-
kfree(ge);
961-
xe_exec_queue_fini(q);
962-
}
959+
kfree(ge);
960+
xe_exec_queue_fini(q);
963961
}
964962

965963
static void guc_exec_queue_fini_async(struct xe_exec_queue *q)
966964
{
967-
bool kernel = q->flags & EXEC_QUEUE_FLAG_KERNEL;
968-
969965
INIT_WORK(&q->guc->fini_async, __guc_exec_queue_fini_async);
970-
queue_work(system_wq, &q->guc->fini_async);
971966

972967
/* We must block on kernel engines so slabs are empty on driver unload */
973-
if (kernel) {
974-
struct xe_guc_exec_queue *ge = q->guc;
975-
976-
flush_work(&ge->fini_async);
977-
kfree(ge);
978-
xe_exec_queue_fini(q);
979-
}
968+
if (q->flags & EXEC_QUEUE_FLAG_KERNEL)
969+
__guc_exec_queue_fini_async(&q->guc->fini_async);
970+
else
971+
queue_work(system_wq, &q->guc->fini_async);
980972
}
981973

982974
static void __guc_exec_queue_fini(struct xe_guc *guc, struct xe_exec_queue *q)

0 commit comments

Comments
 (0)