[PATCH 04/10] drm/amd: add amd_sched_hw_job_reset
Christian König
deathsimple at vodafone.de
Thu Jun 30 07:44:53 UTC 2016
Am 30.06.2016 um 09:09 schrieb Chunming Zhou:
> amd_sched_hw_job_reset will remove callback from hw fence.
>
> Change-Id: I592153debad43cba3468504fe041ca439c0a5ec2
> Signed-off-by: Chunming Zhou <David1.Zhou at amd.com>
> ---
> drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 12 ++++++++++++
> drivers/gpu/drm/amd/scheduler/gpu_scheduler.h | 1 +
> 2 files changed, 13 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
> index 3794691..9dd64ee 100644
> --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
> +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
> @@ -381,6 +381,18 @@ static void amd_sched_job_timedout(struct work_struct *work)
> job->sched->ops->timedout_job(job);
> }
>
> +void amd_sched_hw_job_reset(struct amd_gpu_scheduler *sched)
> +{
> + struct amd_sched_job *s_job, *tmp;
> +
> + spin_lock(&sched->job_list_lock);
> + list_for_each_entry_safe(s_job, tmp, &sched->ring_mirror_list, node) {
> + if (fence_remove_callback(s_job->s_fence->parent, &s_job->s_fence->cb))
> + fence_put(s_job->s_fence->parent);
Might be a good idea to set the parent fence to NULL here as well.
Additional to that new jobs are put on the end of the list, right? So we
unregister the callback from oldest to newest, correct?
Probably better to do it the other way around (e.g. use
list_for_each_entry_reverse() here), just in case a job decides to
completes while unregistering the callback.
By the way, no need for the _safe variant here, we only unregister the
callback and don't remove anything from the list.
Regards,
Christian.
> + }
> + spin_unlock(&sched->job_list_lock);
> +}
> +
> /**
> * Submit a job to the job queue
> *
> diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
> index 0a9f086..edb408f 100644
> --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
> +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
> @@ -157,4 +157,5 @@ int amd_sched_job_init(struct amd_sched_job *job,
> struct amd_gpu_scheduler *sched,
> struct amd_sched_entity *entity,
> void *owner, struct fence **fence);
> +void amd_sched_hw_job_reset(struct amd_gpu_scheduler *sched);
> #endif
More information about the amd-gfx
mailing list