Lines Matching full:entity
44 * The jobs in a entity are always scheduled in the order that they were pushed.
47 * hardware, i.e. the pending queue, the entity must not be referenced anymore
48 * through the jobs entity pointer.
88 static inline void drm_sched_rq_remove_fifo_locked(struct drm_sched_entity *entity) in drm_sched_rq_remove_fifo_locked() argument
90 struct drm_sched_rq *rq = entity->rq; in drm_sched_rq_remove_fifo_locked()
92 if (!RB_EMPTY_NODE(&entity->rb_tree_node)) { in drm_sched_rq_remove_fifo_locked()
93 rb_erase_cached(&entity->rb_tree_node, &rq->rb_tree_root); in drm_sched_rq_remove_fifo_locked()
94 RB_CLEAR_NODE(&entity->rb_tree_node); in drm_sched_rq_remove_fifo_locked()
98 void drm_sched_rq_update_fifo(struct drm_sched_entity *entity, ktime_t ts) in drm_sched_rq_update_fifo() argument
101 * Both locks need to be grabbed, one to protect from entity->rq change in drm_sched_rq_update_fifo()
102 * for entity from within concurrent drm_sched_entity_select_rq and the in drm_sched_rq_update_fifo()
105 spin_lock(&entity->rq_lock); in drm_sched_rq_update_fifo()
106 spin_lock(&entity->rq->lock); in drm_sched_rq_update_fifo()
108 drm_sched_rq_remove_fifo_locked(entity); in drm_sched_rq_update_fifo()
110 entity->oldest_job_waiting = ts; in drm_sched_rq_update_fifo()
112 rb_add_cached(&entity->rb_tree_node, &entity->rq->rb_tree_root, in drm_sched_rq_update_fifo()
115 spin_unlock(&entity->rq->lock); in drm_sched_rq_update_fifo()
116 spin_unlock(&entity->rq_lock); in drm_sched_rq_update_fifo()
138 * drm_sched_rq_add_entity - add an entity
141 * @entity: scheduler entity
143 * Adds a scheduler entity to the run queue.
146 struct drm_sched_entity *entity) in drm_sched_rq_add_entity() argument
148 if (!list_empty(&entity->list)) in drm_sched_rq_add_entity()
154 list_add_tail(&entity->list, &rq->entities); in drm_sched_rq_add_entity()
160 * drm_sched_rq_remove_entity - remove an entity
163 * @entity: scheduler entity
165 * Removes a scheduler entity from the run queue.
168 struct drm_sched_entity *entity) in drm_sched_rq_remove_entity() argument
170 if (list_empty(&entity->list)) in drm_sched_rq_remove_entity()
176 list_del_init(&entity->list); in drm_sched_rq_remove_entity()
178 if (rq->current_entity == entity) in drm_sched_rq_remove_entity()
182 drm_sched_rq_remove_fifo_locked(entity); in drm_sched_rq_remove_entity()
188 * drm_sched_rq_select_entity_rr - Select an entity which could provide a job to run
192 * Try to find a ready entity, returns NULL if none found.
197 struct drm_sched_entity *entity; in drm_sched_rq_select_entity_rr() local
201 entity = rq->current_entity; in drm_sched_rq_select_entity_rr()
202 if (entity) { in drm_sched_rq_select_entity_rr()
203 list_for_each_entry_continue(entity, &rq->entities, list) { in drm_sched_rq_select_entity_rr()
204 if (drm_sched_entity_is_ready(entity)) { in drm_sched_rq_select_entity_rr()
205 rq->current_entity = entity; in drm_sched_rq_select_entity_rr()
206 reinit_completion(&entity->entity_idle); in drm_sched_rq_select_entity_rr()
208 return entity; in drm_sched_rq_select_entity_rr()
213 list_for_each_entry(entity, &rq->entities, list) { in drm_sched_rq_select_entity_rr()
215 if (drm_sched_entity_is_ready(entity)) { in drm_sched_rq_select_entity_rr()
216 rq->current_entity = entity; in drm_sched_rq_select_entity_rr()
217 reinit_completion(&entity->entity_idle); in drm_sched_rq_select_entity_rr()
219 return entity; in drm_sched_rq_select_entity_rr()
222 if (entity == rq->current_entity) in drm_sched_rq_select_entity_rr()
232 * drm_sched_rq_select_entity_fifo - Select an entity which provides a job to run
236 * Find oldest waiting ready entity, returns NULL if none found.
245 struct drm_sched_entity *entity; in drm_sched_rq_select_entity_fifo() local
247 entity = rb_entry(rb, struct drm_sched_entity, rb_tree_node); in drm_sched_rq_select_entity_fifo()
248 if (drm_sched_entity_is_ready(entity)) { in drm_sched_rq_select_entity_fifo()
249 rq->current_entity = entity; in drm_sched_rq_select_entity_fifo()
250 reinit_completion(&entity->entity_idle); in drm_sched_rq_select_entity_fifo()
615 * @entity: scheduler entity to use
625 * has died, which can mean that there's no valid runqueue for a @entity.
632 struct drm_sched_entity *entity, in drm_sched_job_init() argument
635 if (!entity->rq) in drm_sched_job_init()
646 job->entity = entity; in drm_sched_job_init()
647 job->s_fence = drm_sched_fence_alloc(entity, owner); in drm_sched_job_init()
675 struct drm_sched_entity *entity = job->entity; in drm_sched_job_arm() local
677 BUG_ON(!entity); in drm_sched_job_arm()
678 drm_sched_entity_select_rq(entity); in drm_sched_job_arm()
679 sched = entity->rq->sched; in drm_sched_job_arm()
682 job->s_priority = entity->rq - sched->sched_rq; in drm_sched_job_arm()
685 drm_sched_fence_init(job->s_fence, job->entity); in drm_sched_job_arm()
883 * drm_sched_select_entity - Select next entity to process
887 * Returns the entity to process or NULL if none are found.
892 struct drm_sched_entity *entity; in drm_sched_select_entity() local
900 entity = drm_sched_policy == DRM_SCHED_POLICY_FIFO ? in drm_sched_select_entity()
903 if (entity) in drm_sched_select_entity()
907 return entity; in drm_sched_select_entity()
1021 struct drm_sched_entity *entity = NULL; in drm_sched_main() local
1030 (entity = drm_sched_select_entity(sched))) || in drm_sched_main()
1036 if (!entity) in drm_sched_main()
1039 sched_job = drm_sched_entity_pop_job(entity); in drm_sched_main()
1042 complete_all(&entity->entity_idle); in drm_sched_main()
1051 trace_drm_run_job(sched_job, entity); in drm_sched_main()
1053 complete_all(&entity->entity_idle); in drm_sched_main()
1180 * limit of the scheduler then the respective sched entity is marked guilty and
1187 struct drm_sched_entity *entity; in drm_sched_increase_karma() local
1202 list_for_each_entry_safe(entity, tmp, &rq->entities, list) { in drm_sched_increase_karma()
1204 entity->fence_context) { in drm_sched_increase_karma()
1205 if (entity->guilty) in drm_sched_increase_karma()
1206 atomic_set(entity->guilty, 1); in drm_sched_increase_karma()
1211 if (&entity->list != &rq->entities) in drm_sched_increase_karma()