Panfrost can skip the reset if TDR has fired before the IRQ handler.
Currently, since Panfrost doesn't take any action on these scenarios, the
job is being leaked, considering that `free_job()` won't be called.

To avoid such leaks, use the DRM_GPU_SCHED_STAT_RUNNING status to skip the
reset and rearm the timer.

Signed-off-by: Maíra Canal <mca...@igalia.com>
---
 drivers/gpu/drm/panfrost/panfrost_job.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c 
b/drivers/gpu/drm/panfrost/panfrost_job.c
index 
5657106c2f7d0a0ca6162850767f58f3200cce13..2948d5c02115544a0e0babffd850f1506152849d
 100644
--- a/drivers/gpu/drm/panfrost/panfrost_job.c
+++ b/drivers/gpu/drm/panfrost/panfrost_job.c
@@ -751,11 +751,11 @@ static enum drm_gpu_sched_stat 
panfrost_job_timedout(struct drm_sched_job
        int js = panfrost_job_get_slot(job);
 
        /*
-        * If the GPU managed to complete this jobs fence, the timeout is
-        * spurious. Bail out.
+        * If the GPU managed to complete this jobs fence, TDR has fired before
+        * IRQ and the timeout is spurious. Bail out.
         */
        if (dma_fence_is_signaled(job->done_fence))
-               return DRM_GPU_SCHED_STAT_NOMINAL;
+               return DRM_GPU_SCHED_STAT_RUNNING;
 
        /*
         * Panfrost IRQ handler may take a long time to process an interrupt
@@ -770,7 +770,7 @@ static enum drm_gpu_sched_stat panfrost_job_timedout(struct 
drm_sched_job
 
        if (dma_fence_is_signaled(job->done_fence)) {
                dev_warn(pfdev->dev, "unexpectedly high interrupt latency\n");
-               return DRM_GPU_SCHED_STAT_NOMINAL;
+               return DRM_GPU_SCHED_STAT_RUNNING;
        }
 
        dev_err(pfdev->dev, "gpu sched timeout, js=%d, config=0x%x, 
status=0x%x, head=0x%x, tail=0x%x, sched_job=%p",

-- 
2.49.0

Reply via email to