aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
diff options
context:
space:
mode:
authorAndrey Grodzovsky <andrey.grodzovsky@amd.com>2018-12-04 16:56:14 -0500
committerAlex Deucher <alexander.deucher@amd.com>2019-01-25 16:15:36 -0500
commit222b5f044159877504dbac9bc1910f89a74136e2 (patch)
tree4a983bae8c0688b62f350c2bafd5a6b5c38fbdf2 /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
parent713b64a58e88acec4ab97782086061fd012de7aa (diff)
drm/sched: Refactor ring mirror list handling.
Decauple sched threads stop and start and ring mirror list handling from the policy of what to do about the guilty jobs. When stoppping the sched thread and detaching sched fences from non signaled HW fenes wait for all signaled HW fences to complete before rerunning the jobs. v2: Fix resubmission of guilty job into HW after refactoring. v4: Full restart for all the jobs, not only from guilty ring. Extract karma increase into standalone function. v5: Rework waiting for signaled jobs without relying on the job struct itself as those might already be freed for non 'guilty' job's schedulers. Expose karma increase to drivers. v6: Use list_for_each_entry_safe_continue and drm_sched_process_job in case fence already signaled. Call drm_sched_increase_karma only once for amdgpu and add documentation. v7: Wait only for the latest job's fence. Suggested-by: Christian Koenig <Christian.Koenig@amd.com> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index e20dce438d37..d7dddb936f84 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -3313,17 +3313,15 @@ static int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
3313 if (!ring || !ring->sched.thread) 3313 if (!ring || !ring->sched.thread)
3314 continue; 3314 continue;
3315 3315
3316 kthread_park(ring->sched.thread); 3316 drm_sched_stop(&ring->sched);
3317
3318 if (job && job->base.sched != &ring->sched)
3319 continue;
3320
3321 drm_sched_hw_job_reset(&ring->sched, job ? &job->base : NULL);
3322 3317
3323 /* after all hw jobs are reset, hw fence is meaningless, so force_completion */ 3318 /* after all hw jobs are reset, hw fence is meaningless, so force_completion */
3324 amdgpu_fence_driver_force_completion(ring); 3319 amdgpu_fence_driver_force_completion(ring);
3325 } 3320 }
3326 3321
3322 if(job)
3323 drm_sched_increase_karma(&job->base);
3324
3327 3325
3328 3326
3329 if (!amdgpu_sriov_vf(adev)) { 3327 if (!amdgpu_sriov_vf(adev)) {
@@ -3469,14 +3467,10 @@ static void amdgpu_device_post_asic_reset(struct amdgpu_device *adev,
3469 if (!ring || !ring->sched.thread) 3467 if (!ring || !ring->sched.thread)
3470 continue; 3468 continue;
3471 3469
3472 /* only need recovery sched of the given job's ring 3470 if (!adev->asic_reset_res)
3473 * or all rings (in the case @job is NULL) 3471 drm_sched_resubmit_jobs(&ring->sched);
3474 * after above amdgpu_reset accomplished
3475 */
3476 if ((!job || job->base.sched == &ring->sched) && !adev->asic_reset_res)
3477 drm_sched_job_recovery(&ring->sched);
3478 3472
3479 kthread_unpark(ring->sched.thread); 3473 drm_sched_start(&ring->sched, !adev->asic_reset_res);
3480 } 3474 }
3481 3475
3482 if (!amdgpu_device_has_dc_support(adev)) { 3476 if (!amdgpu_device_has_dc_support(adev)) {