[PATCH] drm/sched: Qualify drm_sched_wakeup() by drm_sched_entity_is_ready()

Danilo Krummrich dakr at redhat.com
Fri Nov 10 00:03:37 UTC 2023


On 11/10/23 01:01, Luben Tuikov wrote:
> Don't "wake up" the GPU scheduler unless the entity is ready, as well as we
> can queue to the scheduler, i.e. there is no point in waking up the scheduler
> for the entity unless the entity is ready.
> 
> Signed-off-by: Luben Tuikov <ltuikov89 at gmail.com>
> Fixes: bc8d6a9df99038 ("drm/sched: Don't disturb the entity when in RR-mode scheduling")

Reviewed-by: Danilo Krummrich <dakr at redhat.com>


> ---
>   drivers/gpu/drm/scheduler/sched_entity.c | 4 ++--
>   drivers/gpu/drm/scheduler/sched_main.c   | 8 +++++---
>   include/drm/gpu_scheduler.h              | 2 +-
>   3 files changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
> index f1db63cc819812..4d42b1e4daa67f 100644
> --- a/drivers/gpu/drm/scheduler/sched_entity.c
> +++ b/drivers/gpu/drm/scheduler/sched_entity.c
> @@ -370,7 +370,7 @@ static void drm_sched_entity_wakeup(struct dma_fence *f,
>   		container_of(cb, struct drm_sched_entity, cb);
>   
>   	drm_sched_entity_clear_dep(f, cb);
> -	drm_sched_wakeup(entity->rq->sched);
> +	drm_sched_wakeup(entity->rq->sched, entity);
>   }
>   
>   /**
> @@ -602,7 +602,7 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job)
>   		if (drm_sched_policy == DRM_SCHED_POLICY_FIFO)
>   			drm_sched_rq_update_fifo(entity, submit_ts);
>   
> -		drm_sched_wakeup(entity->rq->sched);
> +		drm_sched_wakeup(entity->rq->sched, entity);
>   	}
>   }
>   EXPORT_SYMBOL(drm_sched_entity_push_job);
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index cd0dc3f81d05f0..8f5e466bd58239 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -925,10 +925,12 @@ static bool drm_sched_can_queue(struct drm_gpu_scheduler *sched)
>    *
>    * Wake up the scheduler if we can queue jobs.
>    */
> -void drm_sched_wakeup(struct drm_gpu_scheduler *sched)
> +void drm_sched_wakeup(struct drm_gpu_scheduler *sched,
> +		      struct drm_sched_entity *entity)
>   {
> -	if (drm_sched_can_queue(sched))
> -		drm_sched_run_job_queue(sched);
> +	if (drm_sched_entity_is_ready(entity))
> +		if (drm_sched_can_queue(sched))
> +			drm_sched_run_job_queue(sched);
>   }
>   
>   /**
> diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
> index 754fd2217334e5..09916c84703f59 100644
> --- a/include/drm/gpu_scheduler.h
> +++ b/include/drm/gpu_scheduler.h
> @@ -559,7 +559,7 @@ void drm_sched_entity_modify_sched(struct drm_sched_entity *entity,
>   
>   void drm_sched_tdr_queue_imm(struct drm_gpu_scheduler *sched);
>   void drm_sched_job_cleanup(struct drm_sched_job *job);
> -void drm_sched_wakeup(struct drm_gpu_scheduler *sched);
> +void drm_sched_wakeup(struct drm_gpu_scheduler *sched, struct drm_sched_entity *entity);
>   bool drm_sched_wqueue_ready(struct drm_gpu_scheduler *sched);
>   void drm_sched_wqueue_stop(struct drm_gpu_scheduler *sched);
>   void drm_sched_wqueue_start(struct drm_gpu_scheduler *sched);
> 
> base-commit: f415a6078f640ab15bae34d3c6a1d8e6071363de



More information about the dri-devel mailing list