drm/amdgpu: Force-signal fence when job is submitted to killed entity
Subsystems (3)
PATCH 1/1 drm/amdgpu: Force-signal fence when job is submitted to killed entity
Issue: jobs submitted to a killed entity can still succeed, except for a dmesg error when the job is the first been pushed to the killed entity
Force-signal fence when job is submitted to killed entity
Signed-off-by Emily Deng <[email protected]>
Signed-off-by Bingxi Guo <[email protected]>
--- drivers/gpu/drm/scheduler/sched_entity.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/gpu/drm/scheduler/sched_entity.c +15 -6
@@ -570,6 +570,14 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job)bool first;ktime_t submit_ts; +spin_lock (&entity->lock); +if (entity->stopped) { +spin_unlock (&entity->lock); +DRM_ERROR ("Trying to push job to a killed entity\n" ); + goto error; + } +spin_unlock (&entity->lock); +trace_drm_sched_job_queue (sched_job, entity);if (trace_drm_sched_job_add_dep_enabled ()) {
@@ -597,12 +605,6 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job)/* Add the entity to the run queue */ spin_lock (&entity->lock); -if (entity->stopped) { -spin_unlock (&entity->lock); - -DRM_ERROR ("Trying to push to a killed entity\n" ); -return ; - } rq = entity->rq; sched = rq->sched;
@@ -618,5 +620,12 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job)drm_sched_wakeup (sched); } + +return ; + +error: +dma_fence_set_error (&sched_job->s_fence->finished, -EPERM ); +drm_sched_fence_scheduled (sched_job->s_fence,NULL ); +drm_sched_fence_finished (sched_job->s_fence, -EPERM ); }EXPORT_SYMBOL (drm_sched_entity_push_job);
Signature · 1 line
2.43.0
Quoted 5 lines · Bingxi Guo
Issue: jobs submitted to a killed entity can still succeed, except for a dmesg error when the job is the first been pushed to the killed entity
Force-signal fence when job is submitted to killed entity
Well once more absolutely clear NAK to stuff like that.
Please read up on the dma_fence documentation before touching the code because patches like that one here clearly shows that even the basic are not understood correctly.
Christian.
Quoted 52 lines
Signed-off-by Emily Deng <[email protected]>Signed-off-by Bingxi Guo <[email protected]>--- drivers/gpu/drm/scheduler/sched_entity.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)drivers/gpu/drm/scheduler/sched_entity.c +15
-6@@ -570,6 +570,14 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job)bool first;ktime_t submit_ts; +spin_lock (&entity->lock); +if (entity->stopped) { +spin_unlock (&entity->lock); +DRM_ERROR ("Trying to push job to a killed entity\n" ); + goto error; + } +spin_unlock (&entity->lock); +trace_drm_sched_job_queue (sched_job, entity);if (trace_drm_sched_job_add_dep_enabled ()) {@@ -597,12 +605,6 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job)/* Add the entity to the run queue */ spin_lock (&entity->lock); -if (entity->stopped) { -spin_unlock (&entity->lock); - -DRM_ERROR ("Trying to push to a killed entity\n" ); -return ; - } rq = entity->rq; sched = rq->sched;@@ -618,5 +620,12 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job)drm_sched_wakeup (sched); } + +return ; + +error: +dma_fence_set_error (&sched_job->s_fence->finished, -EPERM ); +drm_sched_fence_scheduled (sched_job->s_fence,NULL ); +drm_sched_fence_finished (sched_job->s_fence, -EPERM ); }EXPORT_SYMBOL (drm_sched_entity_push_job);