Skip to content

Commit 92d3e3e

Browse files
mairacanalpopcornmix
authored andcommitted
drm/v3d: Don't run jobs that have errors flagged in its fence
The V3D driver still relies on `drm_sched_increase_karma()` and `drm_sched_resubmit_jobs()` for resubmissions when a timeout occurs. The function `drm_sched_increase_karma()` marks the job as guilty, while `drm_sched_resubmit_jobs()` sets an error (-ECANCELED) in the DMA fence of that guilty job. Because of this, we must check whether the job’s DMA fence has been flagged with an error before executing the job. Otherwise, the same guilty job may be resubmitted indefinitely, causing repeated GPU resets. This patch adds a check for an error on the job's fence to prevent running a guilty job that was previously flagged when the GPU timed out. Note that the CPU and CACHE_CLEAN queues do not require this check, as their jobs are executed synchronously once the DRM scheduler starts them. Cc: stable@vger.kernel.org Fixes: d223f98 ("drm/v3d: Add support for compute shader dispatch.") Fixes: 1584f16 ("drm/v3d: Add support for submitting jobs to the TFU.") Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Signed-off-by: Maíra Canal <mcanal@igalia.com>
1 parent 56247d4 commit 92d3e3e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/gpu/drm/v3d/v3d_sched.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,15 @@ v3d_tfu_job_run(struct drm_sched_job *sched_job)
327327
struct drm_device *dev = &v3d->drm;
328328
struct dma_fence *fence;
329329

330+
if (unlikely(job->base.base.s_fence->finished.error))
331+
return NULL;
332+
333+
v3d->tfu_job = job;
334+
330335
fence = v3d_fence_create(v3d, V3D_TFU);
331336
if (IS_ERR(fence))
332337
return NULL;
333338

334-
v3d->tfu_job = job;
335339
if (job->base.irq_fence)
336340
dma_fence_put(job->base.irq_fence);
337341
job->base.irq_fence = dma_fence_get(fence);
@@ -369,6 +373,9 @@ v3d_csd_job_run(struct drm_sched_job *sched_job)
369373
struct dma_fence *fence;
370374
int i, csd_cfg0_reg;
371375

376+
if (unlikely(job->base.base.s_fence->finished.error))
377+
return NULL;
378+
372379
v3d->csd_job = job;
373380

374381
v3d_invalidate_caches(v3d);

0 commit comments

Comments
 (0)