From: Boris Brezillon boris.brezillon@collabora.com
mainline inclusion from mainline-v5.15-rc1 commit 3b5ac97ad468f6cfd31346821a3a2b9f13d23015 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IB3ULB
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------
The panfrost driver tries to kill in-flight jobs on FD close after destroying the FD scheduler entities. For this to work properly, we need to make sure the jobs popped from the scheduler entities have been queued at the HW level before declaring the entity idle, otherwise we might iterate over a list that doesn't contain those jobs.
Suggested-by: Lucas Stach l.stach@pengutronix.de Signed-off-by: Boris Brezillon boris.brezillon@collabora.com Cc: Lucas Stach l.stach@pengutronix.de Reviewed-by: Steven Price steven.price@arm.com Reviewed-by: Lucas Stach l.stach@pengutronix.de Link: https://patchwork.freedesktop.org/patch/msgid/20210624140850.2229697-1-boris... Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- drivers/gpu/drm/scheduler/sched_main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index 3780433e93d9..c93f75325b6c 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -895,10 +895,10 @@ static int drm_sched_main(void *param)
sched_job = drm_sched_entity_pop_job(entity);
- complete(&entity->entity_idle); - - if (!sched_job) + if (!sched_job) { + complete(&entity->entity_idle); continue; + }
s_fence = sched_job->s_fence;
@@ -907,6 +907,7 @@ static int drm_sched_main(void *param)
trace_drm_run_job(sched_job, entity); fence = sched->ops->run_job(sched_job); + complete(&entity->entity_idle); drm_sched_fence_scheduled(s_fence);
if (!IS_ERR_OR_NULL(fence)) {