Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: stop scheduler when calling hw_fini (v2)

This gurantees no more work on the ring can be submitted
to hardware in suspend/resume case, otherwise a potential
race will occur and the ring will get no chance to stay
empty before suspend.

v2: Call drm_sched_resubmit_job before drm_sched_start to
restart jobs from the pending list.

Suggested-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org

authored by

Guchun Chen and committed by
Alex Deucher
f7d6779d 156872b0

+8
+8
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
··· 552 552 if (!ring || !ring->fence_drv.initialized) 553 553 continue; 554 554 555 + if (!ring->no_scheduler) 556 + drm_sched_stop(&ring->sched, NULL); 557 + 555 558 /* You can't wait for HW to signal if it's gone */ 556 559 if (!drm_dev_is_unplugged(&adev->ddev)) 557 560 r = amdgpu_fence_wait_empty(ring); ··· 613 610 struct amdgpu_ring *ring = adev->rings[i]; 614 611 if (!ring || !ring->fence_drv.initialized) 615 612 continue; 613 + 614 + if (!ring->no_scheduler) { 615 + drm_sched_resubmit_jobs(&ring->sched); 616 + drm_sched_start(&ring->sched, true); 617 + } 616 618 617 619 /* enable the interrupt */ 618 620 if (ring->fence_drv.irq_src)