drm/sched: drm_sched_job_cleanup(): correct false doc
Subsystems (3)
Philipp Stanner
maintainerPATCH v2 1/1 drm/sched: drm_sched_job_cleanup(): correct false doc
drm_sched_job_cleanup()'s documentation claims that calling drm_sched_job_arm() is a "point of no return", implying that afterwards a job cannot be cancelled anymore.
This is not correct, as proven by the function's code itself, which takes a previous call to drm_sched_job_arm() into account. In truth, the decisive factors are whether fences have been shared (e.g., with other processes) and if the job has been submitted to an entity already.
Correct the wrong docstring.
---
Changes in v2:
- Also adjust comment about arm inside function's body. (Tvrtko)
--- drivers/gpu/drm/scheduler/sched_main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/scheduler/sched_main.c +7 -5
@@ -1013,11 +1013,13 @@ EXPORT_SYMBOL(drm_sched_job_has_dependency);* Cleans up the resources allocated with drm_sched_job_init(). * * Drivers should call this from their error unwind code if @job is aborted -* before drm_sched_job_arm() is called. +* before it was submitted to an entity with drm_sched_entity_push_job(). * -* After that point of no return @job is committed to be executed by the -* scheduler, and this function should be called from the -* &drm_sched_backend_ops.free_job callback. +* Since calling drm_sched_job_arm() causes the job's fences to be initialized, +* it is up to the driver to ensure that fences that were exposed to external +* parties get signaled. drm_sched_job_cleanup() does not ensure this. +* +* This function must also be called in &struct drm_sched_backend_ops.free_job */ void drm_sched_job_cleanup (struct drm_sched_job *job) {
@@ -1028,7 +1030,7 @@ void drm_sched_job_cleanup(struct drm_sched_job *job)/* drm_sched_job_arm() has been called */ dma_fence_put (&job->s_fence->finished); }else { -/* aborted job before committing to run it */ +/* aborted job before arming */ drm_sched_fence_free (job->s_fence); }
Signature · 1 line
2.48.1
Philipp Stanner
AppliedQuoted 12 lines · Philipp Stanner
drm_sched_job_cleanup()'s documentation claims that calling
drm_sched_job_arm()is a "point of no return", implying that afterwards
a job cannot be cancelled anymore.This is not correct, as proven by the function's code itself, which takes a previous call to
drm_sched_job_arm()into account. In truth, the
decisive factors are whether fences have been shared (e.g., with other
processes) and if the job has been submitted to an entity already.
Quoted 4 lines
Correct the wrong docstring.
Signed-off-by Philipp Stanner <[email protected]>Reviewed-by Tvrtko Ursulin <[email protected]>
Applied to drm-misc-next.
P.
Quoted 47 lines
---
Changes in v2:
- Also adjust comment about arm inside function's body. (Tvrtko)
---
drivers/gpu/drm/scheduler/sched_main.c | 12 +++++++-----1 file changed, 7 insertions(+), 5 deletions(-)drivers/gpu/drm/scheduler/sched_main.c +0
-0@@ -1013,11 +1013,13 @@ EXPORT_SYMBOL(drm_sched_job_has_dependency); * Cleans up the resources allocated with drm_sched_job_init(). * * Drivers should call this from their error unwind code if @job isaborted
- * beforedrm_sched_job_arm()is called.
+ * before it was submitted to an entity withdrm_sched_entity_push_job().
*
- * After that point of no return @job is committed to be executed by the
- * scheduler, and this function should be called from the
- * &drm_sched_backend_ops.free_job callback.
+ * Since callingdrm_sched_job_arm()causes the job's fences to be initialized,
+ * it is up to the driver to ensure that fences that were exposed to external
+ * parties get signaled.drm_sched_job_cleanup()does not ensure this.
+ *
+ * This function must also be called in &struct drm_sched_backend_ops.free_job
*/
voiddrm_sched_job_cleanup(struct drm_sched_job *job)
{drivers/gpu/drm/scheduler/sched_main.c +1
-1@@ -1028,7 +1030,7 @@ void drm_sched_job_cleanup(struct drm_sched_job *job) /* drm_sched_job_arm() has been called */ dma_fence_put(&job->s_fence->finished); } else { -/* aborted job before committing to run it */ +/* aborted job before arming */ drm_sched_fence_free(job->s_fence); }
Am 04.03.25 um 15:13 schrieb Philipp Stanner:
Quoted 9 lines
drm_sched_job_cleanup()'s documentation claims that calling
drm_sched_job_arm()is a "point of no return", implying that afterwards a job cannot be cancelled anymore.This is not correct, as proven by the function's code itself, which takes a previous call to
drm_sched_job_arm()into account. In truth, the decisive factors are whether fences have been shared (e.g., with other processes) and if the job has been submitted to an entity already.
Quoted 4 lines
Correct the wrong docstring.
Signed-off-by Philipp Stanner <[email protected]>Reviewed-by Tvrtko Ursulin <[email protected]>
Quoted 38 lines
---
Changes in v2:
- Also adjust comment about arm inside function's body. (Tvrtko)--- drivers/gpu/drm/scheduler/sched_main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)drivers/gpu/drm/scheduler/sched_main.c +7
-5@@ -1013,11 +1013,13 @@ EXPORT_SYMBOL(drm_sched_job_has_dependency);* Cleans up the resources allocated with drm_sched_job_init(). * * Drivers should call this from their error unwind code if @job is aborted -* before drm_sched_job_arm() is called. +* before it was submitted to an entity with drm_sched_entity_push_job(). * -* After that point of no return @job is committed to be executed by the -* scheduler, and this function should be called from the -* &drm_sched_backend_ops.free_job callback. +* Since calling drm_sched_job_arm() causes the job's fences to be initialized, +* it is up to the driver to ensure that fences that were exposed to external +* parties get signaled. drm_sched_job_cleanup() does not ensure this. +* +* This function must also be called in &struct drm_sched_backend_ops.free_job */ void drm_sched_job_cleanup (struct drm_sched_job *job) {@@ -1028,7 +1030,7 @@ void drm_sched_job_cleanup(struct drm_sched_job *job)/* drm_sched_job_arm() has been called */ dma_fence_put (&job->s_fence->finished); }else { -/* aborted job before committing to run it */ +/* aborted job before arming */ drm_sched_fence_free (job->s_fence); }