Lines Matching full:job
32 * backend operations to the scheduler like submitting a job to hardware run queue,
33 * returning the dependencies of a job etc.
46 * Note that once a job was taken from the entities queue and pushed to the
61 * Once a job is executed (but not yet finished), the job's credits contribute
62 * to the scheduler's credit count until the job is finished. If by executing
63 * one more job the scheduler's credit count would exceed the scheduler's
64 * credit limit, the job won't be executed. Instead, the scheduler will wait
69 * struct drm_sched_backend_ops to update the job's credits dynamically. The
70 * scheduler executes this callback every time the scheduler considers a job for
71 * execution and subsequently checks whether the job fits the scheduler's credit
118 * Return true if we can push at least one more job from @entity, false
134 "Jobs with zero credits bypass job-flow control.\n"); in drm_sched_can_queue()
137 /* If a job exceeds the credit limit, truncate it to the credit limit in drm_sched_can_queue()
256 * drm_sched_rq_select_entity_rr - Select an entity which could provide a job to run
265 * its job; return NULL, if no ready entity was found.
321 * drm_sched_rq_select_entity_fifo - Select an entity which provides a job to run
330 * its job; return NULL, if no ready entity was found.
363 * drm_sched_run_job_queue - enqueue run-job work
373 * __drm_sched_run_free_queue - enqueue free-job work
383 * drm_sched_run_free_queue - enqueue free-job work if ready
388 struct drm_sched_job *job; in drm_sched_run_free_queue() local
391 job = list_first_entry_or_null(&sched->pending_list, in drm_sched_run_free_queue()
393 if (job && dma_fence_is_signaled(&job->s_fence->finished)) in drm_sched_run_free_queue()
399 * drm_sched_job_done - complete a job
400 * @s_job: pointer to the job which is done
402 * Finish the job's fence and wake up the worker thread.
421 * drm_sched_job_done_cb - the callback for a done job
456 * drm_sched_tdr_queue_imm: - immediately start job timeout handler
486 * drm_sched_suspend_timeout - Suspend scheduler job timeout
516 * drm_sched_resume_timeout - Resume scheduler job timeout
550 struct drm_sched_job *job; in drm_sched_job_timedout() local
557 job = list_first_entry_or_null(&sched->pending_list, in drm_sched_job_timedout()
560 if (job) { in drm_sched_job_timedout()
562 * Remove the bad job so it cannot be freed by concurrent in drm_sched_job_timedout()
566 list_del_init(&job->list); in drm_sched_job_timedout()
569 status = job->sched->ops->timedout_job(job); in drm_sched_job_timedout()
572 * Guilty job did complete and hence needs to be manually removed in drm_sched_job_timedout()
576 job->sched->ops->free_job(job); in drm_sched_job_timedout()
591 * @bad: job which caused the time out
594 * Note: bad job will not be freed as it might be used later and so it's
606 * Reinsert back the bad job here - now it's safe as in drm_sched_stop()
608 * bad job at this point - we parked (waited for) any in progress in drm_sched_stop()
615 * job extracted. in drm_sched_stop()
620 * Iterate the job list from later to earlier one and either deactive in drm_sched_stop()
635 * remove job from pending_list. in drm_sched_stop()
643 * Wait for job's HW fence callback to finish using s_job in drm_sched_stop()
646 * Job is still alive so fence refcount at least 1 in drm_sched_stop()
651 * We must keep bad job alive for later use during in drm_sched_stop()
653 * that the guilty job must be released. in drm_sched_stop()
723 * recovery after a job timeout.
771 * drm_sched_job_init - init a scheduler job
772 * @job: scheduler job to init
774 * @credits: the number of credits this job contributes to the schedulers
776 * @owner: job owner for debugging
782 * successfully, even when @job is aborted before drm_sched_job_arm() is called.
791 int drm_sched_job_init(struct drm_sched_job *job, in drm_sched_job_init() argument
800 drm_err(job->sched, "%s: entity has no rq!\n", __func__); in drm_sched_job_init()
809 job->entity = entity; in drm_sched_job_init()
810 job->credits = credits; in drm_sched_job_init()
811 job->s_fence = drm_sched_fence_alloc(entity, owner); in drm_sched_job_init()
812 if (!job->s_fence) in drm_sched_job_init()
815 INIT_LIST_HEAD(&job->list); in drm_sched_job_init()
817 xa_init_flags(&job->dependencies, XA_FLAGS_ALLOC); in drm_sched_job_init()
824 * drm_sched_job_arm - arm a scheduler job for execution
825 * @job: scheduler job to arm
827 * This arms a scheduler job for execution. Specifically it initializes the
828 * &drm_sched_job.s_fence of @job, so that it can be attached to struct dma_resv
829 * or other places that need to track the completion of this job.
836 void drm_sched_job_arm(struct drm_sched_job *job) in drm_sched_job_arm() argument
839 struct drm_sched_entity *entity = job->entity; in drm_sched_job_arm()
845 job->sched = sched; in drm_sched_job_arm()
846 job->s_priority = entity->priority; in drm_sched_job_arm()
847 job->id = atomic64_inc_return(&sched->job_id_count); in drm_sched_job_arm()
849 drm_sched_fence_init(job->s_fence, job->entity); in drm_sched_job_arm()
854 * drm_sched_job_add_dependency - adds the fence as a job dependency
855 * @job: scheduler job to add the dependencies to
863 int drm_sched_job_add_dependency(struct drm_sched_job *job, in drm_sched_job_add_dependency() argument
878 xa_for_each(&job->dependencies, index, entry) { in drm_sched_job_add_dependency()
884 xa_store(&job->dependencies, index, fence, GFP_KERNEL); in drm_sched_job_add_dependency()
891 ret = xa_alloc(&job->dependencies, &id, fence, xa_limit_32b, GFP_KERNEL); in drm_sched_job_add_dependency()
900 * drm_sched_job_add_syncobj_dependency - adds a syncobj's fence as a job dependency
901 * @job: scheduler job to add the dependencies to
906 * This adds the fence matching the given syncobj to @job.
911 int drm_sched_job_add_syncobj_dependency(struct drm_sched_job *job, in drm_sched_job_add_syncobj_dependency() argument
923 return drm_sched_job_add_dependency(job, fence); in drm_sched_job_add_syncobj_dependency()
928 * drm_sched_job_add_resv_dependencies - add all fences from the resv to the job
929 * @job: scheduler job to add the dependencies to
933 * This adds all fences matching the given usage from @resv to @job.
939 int drm_sched_job_add_resv_dependencies(struct drm_sched_job *job, in drm_sched_job_add_resv_dependencies() argument
952 ret = drm_sched_job_add_dependency(job, fence); in drm_sched_job_add_resv_dependencies()
963 * drm_sched_job_add_implicit_dependencies - adds implicit dependencies as job
965 * @job: scheduler job to add the dependencies to
967 * @write: whether the job might write the object (so we need to depend on
971 * GEM objects used in the job but before updating the reservations with your
977 int drm_sched_job_add_implicit_dependencies(struct drm_sched_job *job, in drm_sched_job_add_implicit_dependencies() argument
981 return drm_sched_job_add_resv_dependencies(job, obj->resv, in drm_sched_job_add_implicit_dependencies()
987 * drm_sched_job_cleanup - clean up scheduler job resources
988 * @job: scheduler job to clean up
992 * Drivers should call this from their error unwind code if @job is aborted
995 * After that point of no return @job is committed to be executed by the
999 void drm_sched_job_cleanup(struct drm_sched_job *job) in drm_sched_job_cleanup() argument
1004 if (kref_read(&job->s_fence->finished.refcount)) { in drm_sched_job_cleanup()
1006 dma_fence_put(&job->s_fence->finished); in drm_sched_job_cleanup()
1008 /* aborted job before committing to run it */ in drm_sched_job_cleanup()
1009 drm_sched_fence_free(job->s_fence); in drm_sched_job_cleanup()
1012 job->s_fence = NULL; in drm_sched_job_cleanup()
1014 xa_for_each(&job->dependencies, index, fence) { in drm_sched_job_cleanup()
1017 xa_destroy(&job->dependencies); in drm_sched_job_cleanup()
1067 * drm_sched_get_finished_job - fetch the next finished job to be destroyed
1071 * Returns the next finished job from the pending list (if there is one)
1077 struct drm_sched_job *job, *next; in drm_sched_get_finished_job() local
1081 job = list_first_entry_or_null(&sched->pending_list, in drm_sched_get_finished_job()
1084 if (job && dma_fence_is_signaled(&job->s_fence->finished)) { in drm_sched_get_finished_job()
1085 /* remove job from pending_list */ in drm_sched_get_finished_job()
1086 list_del_init(&job->list); in drm_sched_get_finished_job()
1088 /* cancel this job's TO timer */ in drm_sched_get_finished_job()
1098 dma_fence_timestamp(&job->s_fence->finished); in drm_sched_get_finished_job()
1099 /* start TO timer for next job */ in drm_sched_get_finished_job()
1103 job = NULL; in drm_sched_get_finished_job()
1108 return job; in drm_sched_get_finished_job()
1150 * @w: free job work
1156 struct drm_sched_job *job; in drm_sched_free_job_work() local
1161 job = drm_sched_get_finished_job(sched); in drm_sched_free_job_work()
1162 if (job) in drm_sched_free_job_work()
1163 sched->ops->free_job(job); in drm_sched_free_job_work()
1172 * @w: run job work
1187 /* Find entity with a ready job */ in drm_sched_run_job_work()
1237 * @hang_limit: number of times to allow a job to hang before dropping it
1375 * @bad: The job guilty of time out
1377 * Increment on every hang caused by the 'bad' job. If this exceeds the hang