Skip to content

Commit 31499b0

Browse files
committed
drm/nouveau: sched: fix leaking memory of timedout job
Always stop and re-start the scheduler in order to let the scheduler free up the timedout job in case it got signaled. In case of exec jobs the job type specific callback will take care to signal all fences and tear down the channel. Fixes: b88baab ("drm/nouveau: implement new VM_BIND uAPI") Signed-off-by: Danilo Krummrich <dakr@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230916162835.5719-1-dakr@redhat.com
1 parent 7ece3fc commit 31499b0

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

drivers/gpu/drm/nouveau/nouveau_exec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ nouveau_exec_job_timeout(struct nouveau_job *job)
213213

214214
nouveau_sched_entity_fini(job->entity);
215215

216-
return DRM_GPU_SCHED_STAT_ENODEV;
216+
return DRM_GPU_SCHED_STAT_NOMINAL;
217217
}
218218

219219
static struct nouveau_job_ops nouveau_exec_job_ops = {

drivers/gpu/drm/nouveau/nouveau_sched.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,14 +375,20 @@ nouveau_sched_run_job(struct drm_sched_job *sched_job)
375375
static enum drm_gpu_sched_stat
376376
nouveau_sched_timedout_job(struct drm_sched_job *sched_job)
377377
{
378+
struct drm_gpu_scheduler *sched = sched_job->sched;
378379
struct nouveau_job *job = to_nouveau_job(sched_job);
380+
enum drm_gpu_sched_stat stat = DRM_GPU_SCHED_STAT_NOMINAL;
379381

380-
NV_PRINTK(warn, job->cli, "Job timed out.\n");
382+
drm_sched_stop(sched, sched_job);
381383

382384
if (job->ops->timeout)
383-
return job->ops->timeout(job);
385+
stat = job->ops->timeout(job);
386+
else
387+
NV_PRINTK(warn, job->cli, "Generic job timeout.\n");
388+
389+
drm_sched_start(sched, true);
384390

385-
return DRM_GPU_SCHED_STAT_ENODEV;
391+
return stat;
386392
}
387393

388394
static void

0 commit comments

Comments
 (0)