drm/amdgpu:add hang_limit for sched(v2)
authorMonk Liu <Monk.Liu@amd.com>
Tue, 17 Oct 2017 05:40:54 +0000 (13:40 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 4 Dec 2017 21:33:08 +0000 (16:33 -0500)
since gpu_scheduler source domain cannot access amdgpu variable
so need create the hang_limit membewr for sched, and it can
refer it for the upcoming GPU RESET patches

v2:
make hang_limit a parameter of sched_init()

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Chunming Zhou <David1.Zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
drivers/gpu/drm/amd/scheduler/gpu_scheduler.h

index 219c15f79a5d936ed83a959e2eb4da1370636dfe..72e8eacc2c03ad719ff89885c8ab21b22a2d0349 100644 (file)
@@ -446,7 +446,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
                        timeout = MAX_SCHEDULE_TIMEOUT;
                }
                r = amd_sched_init(&ring->sched, &amdgpu_sched_ops,
-                                  num_hw_submission,
+                                  num_hw_submission, amdgpu_job_hang_limit,
                                   timeout, ring->name);
                if (r) {
                        DRM_ERROR("Failed to create scheduler on ring %s.\n",
index 9061c88e3e0cf857127b0d3a987761a0f1776cff..5a1ece2774b50cf0949ada76f3074508331ccc6f 100644 (file)
@@ -676,13 +676,17 @@ static int amd_sched_main(void *param)
 */
 int amd_sched_init(struct amd_gpu_scheduler *sched,
                   const struct amd_sched_backend_ops *ops,
-                  unsigned hw_submission, long timeout, const char *name)
+                  unsigned hw_submission,
+                  unsigned hang_limit,
+                  long timeout,
+                  const char *name)
 {
        int i;
        sched->ops = ops;
        sched->hw_submission_limit = hw_submission;
        sched->name = name;
        sched->timeout = timeout;
+       sched->hang_limit = hang_limit;
        for (i = AMD_SCHED_PRIORITY_MIN; i < AMD_SCHED_PRIORITY_MAX; i++)
                amd_sched_rq_init(&sched->sched_rq[i]);
 
index 3f75b45ed95861e695e8d9823152b937a48174c5..3ea75a2f35d4722d3ddcf668629587b90810a19a 100644 (file)
@@ -144,11 +144,12 @@ struct amd_gpu_scheduler {
        struct task_struct              *thread;
        struct list_head        ring_mirror_list;
        spinlock_t                      job_list_lock;
+       int hang_limit;
 };
 
 int amd_sched_init(struct amd_gpu_scheduler *sched,
                   const struct amd_sched_backend_ops *ops,
-                  uint32_t hw_submission, long timeout, const char *name);
+                  uint32_t hw_submission, unsigned hang_limit, long timeout, const char *name);
 void amd_sched_fini(struct amd_gpu_scheduler *sched);
 
 int amd_sched_entity_init(struct amd_gpu_scheduler *sched,