From 738e1770d692ebcc300fdb7349df12d40ebf516b Mon Sep 17 00:00:00 2001 From: Harshdeep Dhatt Date: Fri, 28 Aug 2020 14:32:59 -0600 Subject: [PATCH] msm: kgsl: Make sure dispatch jobs are not lost due to faults Say a context has only one submission i.e. it has only one dispatch job. And say gpu encounters a fault and sets dispatcher fault. The dispatch job will be free'd and post recovery, the context will never get to the ringbuffer until it queues another submission. This behaviour holds true in cases where dispatcher is halted for example during suspend. So in either case, add back the job the the dispatcher jobs list to make sure the job is not lost. Change-Id: Iec0a0abfbdcf2535d7f82ec1e286581e1c93a3ea Signed-off-by: Harshdeep Dhatt --- drivers/gpu/msm/adreno_dispatch.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/msm/adreno_dispatch.c b/drivers/gpu/msm/adreno_dispatch.c index f6c3853e4ca2..9d0c2604d7e4 100644 --- a/drivers/gpu/msm/adreno_dispatch.c +++ b/drivers/gpu/msm/adreno_dispatch.c @@ -858,8 +858,7 @@ static void dispatcher_handle_jobs_list(struct adreno_device *adreno_dev, llist_for_each_entry_safe(job, next, list, node) { int ret; - if (adreno_gpu_stopped(adreno_dev) || - adreno_drawctxt_bad(job->drawctxt)) { + if (adreno_drawctxt_bad(job->drawctxt)) { kgsl_context_put(&job->drawctxt->base); kmem_cache_free(jobs_cache, job); continue; @@ -879,6 +878,16 @@ static void dispatcher_handle_jobs_list(struct adreno_device *adreno_dev, continue; } + /* + * If gpu is in fault or dispatcher is halted, add back the jobs + * so that they are processed after recovery or when dispatcher + * is resumed. + */ + if (adreno_gpu_stopped(adreno_dev)) { + llist_add(&job->node, &dispatcher->jobs[id]); + continue; + } + ret = dispatcher_context_sendcmds(adreno_dev, job->drawctxt); /*