From: Philipp Stanner Date: Wed, 15 Apr 2026 14:49:56 +0000 (+0200) Subject: drm/sched: Make drm_sched_entity_kill() a public function X-Git-Tag: v7.2-rc1~141^2~26^2~61 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=2f5f05633e2229c8ec379e1d65151165c905671e;p=thirdparty%2Flinux.git drm/sched: Make drm_sched_entity_kill() a public function Some drivers do not care on teardown whether the last jobs pending in an entity are actually executed before teardown completed. For such scenarios, drm_sched_entity_flush() is not the ideal function since it's intended to wait for jobs to complete. Make drm_sched_entity_kill() public for that use-case and update the documentation. Suggested-by: Danilo Krummrich Signed-off-by: Philipp Stanner Link: https://patch.msgid.link/20260415144956.272506-2-phasta@kernel.org Signed-off-by: Danilo Krummrich --- diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c index fe174a4857be7..85aa54d51b2d7 100644 --- a/drivers/gpu/drm/scheduler/sched_entity.c +++ b/drivers/gpu/drm/scheduler/sched_entity.c @@ -228,8 +228,16 @@ static void drm_sched_entity_kill_jobs_cb(struct dma_fence *f, schedule_work(&job->work); } -/* Remove the entity from the scheduler and kill all pending jobs */ -static void drm_sched_entity_kill(struct drm_sched_entity *entity) +/** + * drm_sched_entity_kill - kill an entity's pending jobs and remove it + * @entity: the entity to remove + * + * Removes the entity from the scheduler's run queue and kills all pending jobs. + * + * This function should be used over drm_sched_entity_flush() if it is not + * desired to actually wait for all pending jobs to finish. + */ +void drm_sched_entity_kill(struct drm_sched_entity *entity) { struct drm_sched_job *job; struct dma_fence *prev; @@ -267,6 +275,7 @@ static void drm_sched_entity_kill(struct drm_sched_entity *entity) } dma_fence_put(prev); } +EXPORT_SYMBOL(drm_sched_entity_kill); /** * drm_sched_entity_flush - Flush a context entity diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index 78e07c2507c7a..609ebe389094f 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h @@ -691,6 +691,7 @@ int drm_sched_entity_init(struct drm_sched_entity *entity, unsigned int num_sched_list, atomic_t *guilty); long drm_sched_entity_flush(struct drm_sched_entity *entity, long timeout); +void drm_sched_entity_kill(struct drm_sched_entity *entity); void drm_sched_entity_fini(struct drm_sched_entity *entity); void drm_sched_entity_destroy(struct drm_sched_entity *entity); void drm_sched_entity_set_priority(struct drm_sched_entity *entity,