Skip to content

Commit 44d2f31

Browse files
author
Philipp Stanner
committed
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. Reviewed-by: Tvrtko Ursulin <[email protected]> Signed-off-by: Philipp Stanner <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent c82734f commit 44d2f31

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/gpu/drm/scheduler/sched_main.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,11 +1015,13 @@ EXPORT_SYMBOL(drm_sched_job_has_dependency);
10151015
* Cleans up the resources allocated with drm_sched_job_init().
10161016
*
10171017
* Drivers should call this from their error unwind code if @job is aborted
1018-
* before drm_sched_job_arm() is called.
1018+
* before it was submitted to an entity with drm_sched_entity_push_job().
10191019
*
1020-
* After that point of no return @job is committed to be executed by the
1021-
* scheduler, and this function should be called from the
1022-
* &drm_sched_backend_ops.free_job callback.
1020+
* Since calling drm_sched_job_arm() causes the job's fences to be initialized,
1021+
* it is up to the driver to ensure that fences that were exposed to external
1022+
* parties get signaled. drm_sched_job_cleanup() does not ensure this.
1023+
*
1024+
* This function must also be called in &struct drm_sched_backend_ops.free_job
10231025
*/
10241026
void drm_sched_job_cleanup(struct drm_sched_job *job)
10251027
{
@@ -1030,7 +1032,7 @@ void drm_sched_job_cleanup(struct drm_sched_job *job)
10301032
/* drm_sched_job_arm() has been called */
10311033
dma_fence_put(&job->s_fence->finished);
10321034
} else {
1033-
/* aborted job before committing to run it */
1035+
/* aborted job before arming */
10341036
drm_sched_fence_free(job->s_fence);
10351037
}
10361038

0 commit comments

Comments
 (0)