drm/amdgpu: stop scheduler when calling hw_fini (v2)
Subsystems (2)
PATCH 1/1 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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +8 -0
@@ -552,6 +552,9 @@ void amdgpu_fence_driver_hw_fini(struct amdgpu_device *adev)if (!ring || !ring->fence_drv.initialized)continue ; +if (!ring->no_scheduler) +drm_sched_stop (&ring->sched,NULL ); +/* You can't wait for HW to signal if it's gone */ if (!drm_dev_is_unplugged (&adev->ddev)) r =amdgpu_fence_wait_empty (ring);
@@ -611,6 +614,11 @@ void amdgpu_fence_driver_hw_init(struct amdgpu_device *adev)if (!ring || !ring->fence_drv.initialized)continue ; +if (!ring->no_scheduler) { +drm_sched_resubmit_jobs (&ring->sched); +drm_sched_start (&ring->sched, true); + } +/* enable the interrupt */ if (ring->fence_drv.irq_src) amdgpu_irq_get(adev, ring->fence_drv.irq_src,
Signature · 1 line
2.17.1
Am 30.08.21 um 08:08 schrieb Guchun Chen:
Quoted 11 lines
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_jobbeforedrm_sched_startto restart jobs from the pending list.Suggested-by Andrey Grodzovsky <[email protected]>Suggested-by Christian König <[email protected]>Signed-off-by Guchun Chen <[email protected]>
Quoted 30 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +8
-0@@ -552,6 +552,9 @@ void amdgpu_fence_driver_hw_fini(struct amdgpu_device *adev)if (!ring || !ring->fence_drv.initialized)continue ; +if (!ring->no_scheduler) +drm_sched_stop (&ring->sched,NULL ); +/* You can't wait for HW to signal if it's gone */ if (!drm_dev_is_unplugged (&adev->ddev)) r =amdgpu_fence_wait_empty (ring);@@ -611,6 +614,11 @@ void amdgpu_fence_driver_hw_init(struct amdgpu_device *adev)if (!ring || !ring->fence_drv.initialized)continue ; +if (!ring->no_scheduler) { +drm_sched_resubmit_jobs (&ring->sched); +drm_sched_start (&ring->sched, true); + } +/* enable the interrupt */ if (ring->fence_drv.irq_src) amdgpu_irq_get(adev, ring->fence_drv.irq_src,
Looks good to me too.
Andrey
Quoted 46 lines · Christian König
Am 30.08.21 um 08:08 schrieb Guchun Chen:
Quoted 11 lines
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_jobbeforedrm_sched_startto restart jobs from the pending list.Suggested-by Andrey Grodzovsky <[email protected]>Suggested-by Christian König <[email protected]>Signed-off-by Guchun Chen <[email protected]>Reviewed-by Christian König <[email protected]>Quoted 30 lines
---
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c| 8 ++++++++1 file changed, 8 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +2
-0@@ -552,6 +552,9 @@ void amdgpu_fence_driver_hw_fini(struct amdgpu_device *adev) if (!ring || !ring->fence_drv.initialized) continue; + if (!ring->no_scheduler) + drm_sched_stop(&ring->sched, NULL); + /* You can't wait for HW to signal if it's gone */ if (!drm_dev_is_unplugged(&adev->ddev))r =
amdgpu_fence_wait_empty(ring);drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +4
-0@@ -611,6 +614,11 @@ void amdgpu_fence_driver_hw_init(struct amdgpu_device *adev) if (!ring || !ring->fence_drv.initialized) continue; + if (!ring->no_scheduler) { + drm_sched_resubmit_jobs(&ring->sched); + drm_sched_start(&ring->sched, true); + } + /* enable the interrupt */ if (ring->fence_drv.irq_src)amdgpu_irq_get(adev,
ring->fence_drv.irq_src,
Quoted 6 lines · Guchun Chen
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.
Quoted 6 lines
v2: Call
drm_sched_resubmit_jobbeforedrm_sched_startto restart jobs from the pending list.Suggested-by Andrey Grodzovsky <[email protected]>Suggested-by Christian König <[email protected]>Signed-off-by Guchun Chen <[email protected]>
Maybe add:
fini in s3 test (v2)")
?
Alex
Quoted 33 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +8
-1@@ -552,6 +552,9 @@ void amdgpu_fence_driver_hw_fini(struct amdgpu_device *adev)if (!ring || !ring->fence_drv.initialized)continue ; +if (!ring->no_scheduler) +drm_sched_stop (&ring->sched,NULL ); +/* You can't wait for HW to signal if it's gone */ if (!drm_dev_is_unplugged (&adev->ddev)) r =amdgpu_fence_wait_empty (ring);@@ -611,6 +614,11 @@ void amdgpu_fence_driver_hw_init(struct amdgpu_device *adev)if (!ring || !ring->fence_drv.initialized)continue ; +if (!ring->no_scheduler) { +drm_sched_resubmit_jobs (&ring->sched); +drm_sched_start (&ring->sched, true); + } +/* enable the interrupt */ if (ring->fence_drv.irq_src) amdgpu_irq_get(adev, ring->fence_drv.irq_src, --2.17.1