Skip to content

Commit 5258ca4

Browse files
mairacanalpelwell
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.") Signed-off-by: Maíra Canal <mcanal@igalia.com>
1 parent 32c319b commit 5258ca4

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

drivers/gpu/drm/v3d/v3d_sched.c

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

295+
if (unlikely(job->base.base.s_fence->finished.error))
296+
return NULL;
297+
298+
v3d->tfu_job = job;
299+
295300
fence = v3d_fence_create(v3d, V3D_TFU);
296301
if (IS_ERR(fence))
297302
return NULL;
298303

299-
v3d->tfu_job = job;
300304
if (job->base.irq_fence)
301305
dma_fence_put(job->base.irq_fence);
302306
job->base.irq_fence = dma_fence_get(fence);
@@ -333,6 +337,9 @@ v3d_csd_job_run(struct drm_sched_job *sched_job)
333337
struct dma_fence *fence;
334338
int i, csd_cfg0_reg, csd_cfg_reg_count;
335339

340+
if (unlikely(job->base.base.s_fence->finished.error))
341+
return NULL;
342+
336343
v3d->csd_job = job;
337344

338345
v3d_invalidate_caches(v3d);

0 commit comments

Comments
 (0)