[PATCH 07/12] drm/amdgpu: add amd_sched_job_recovery

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 30.06.2016 um 11:34 schrieb Chunming Zhou:
> Which is to recovery hw jobs when gpu reset.
>
> Change-Id: I8e554d34c9e477ea255e0ed2a936397aa5f665e7
> Signed-off-by: Chunming Zhou <David1.Zhou at amd.com>

Reviewed-by: Christian König <christian.koenig at amd.com>

> ---
>   drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 33 +++++++++++++++++++++++++++
>   drivers/gpu/drm/amd/scheduler/gpu_scheduler.h |  1 +
>   2 files changed, 34 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
> index cf2d64b..70ff09d 100644
> --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
> +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
> @@ -32,6 +32,7 @@
>   
>   static bool amd_sched_entity_is_ready(struct amd_sched_entity *entity);
>   static void amd_sched_wakeup(struct amd_gpu_scheduler *sched);
> +static void amd_sched_process_job(struct fence *f, struct fence_cb *cb);
>   
>   struct kmem_cache *sched_fence_slab;
>   atomic_t sched_fence_slab_ref = ATOMIC_INIT(0);
> @@ -395,6 +396,38 @@ void amd_sched_hw_job_reset(struct amd_gpu_scheduler *sched)
>   	spin_unlock(&sched->job_list_lock);
>   }
>   
> +void amd_sched_job_recovery(struct amd_gpu_scheduler *sched)
> +{
> +	struct amd_sched_job *s_job;
> +	int r;
> +
> +	spin_lock(&sched->job_list_lock);
> +	s_job = list_first_entry_or_null(&sched->ring_mirror_list,
> +					 struct amd_sched_job, node);
> +	if (s_job)
> +		schedule_delayed_work(&s_job->work_tdr, sched->timeout);
> +
> +	list_for_each_entry(s_job, &sched->ring_mirror_list, node) {
> +		struct amd_sched_fence *s_fence = s_job->s_fence;
> +		struct fence *fence = sched->ops->run_job(s_job);
> +		if (fence) {
> +			s_fence->parent = fence_get(fence);
> +			r = fence_add_callback(fence, &s_fence->cb,
> +					       amd_sched_process_job);
> +			if (r == -ENOENT)
> +				amd_sched_process_job(fence, &s_fence->cb);
> +			else if (r)
> +				DRM_ERROR("fence add callback failed (%d)\n",
> +					  r);
> +			fence_put(fence);
> +		} else {
> +			DRM_ERROR("Failed to run job!\n");
> +			amd_sched_process_job(NULL, &s_fence->cb);
> +		}
> +	}
> +	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 0924773..7f978777 100644
> --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
> +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
> @@ -158,4 +158,5 @@ int amd_sched_job_init(struct amd_sched_job *job,
>   		       struct amd_sched_entity *entity,
>   		       void *owner);
>   void amd_sched_hw_job_reset(struct amd_gpu_scheduler *sched);
> +void amd_sched_job_recovery(struct amd_gpu_scheduler *sched);
>   #endif



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux