drm/amdgpu: stop scheduler when calling hw_fini
Subsystems (2)
PATCH 1/1 drm/amdgpu: stop scheduler when calling hw_fini
This gurantees no more work on the ring can be submitted to hardware in suspend/resume case, otherwise the ring will not be empty before suspend.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +6 -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,9 @@ void amdgpu_fence_driver_hw_init(struct amdgpu_device *adev)if (!ring || !ring->fence_drv.initialized)continue ; +if (!ring->no_scheduler) +drm_sched_start (&ring->sched, false); +/* enable the interrupt */ if (ring->fence_drv.irq_src) amdgpu_irq_get(adev, ring->fence_drv.irq_src,
Signature · 1 line
2.17.1
Christian König
maintainerIn general that looks good to me, but what could be is that we now try to stop/start the scheduler during reset twice.
Andrey what do you think?
Christian.
Am 27.08.21 um 12:40 schrieb Guchun Chen:
Quoted 34 lines
This gurantees no more work on the ring can be submitted to hardware in suspend/resume case, otherwise the ring will not be empty before suspend.
Suggested-by Christian König <[email protected]>Signed-off-by Guchun Chen <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +6
-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,9 @@ void amdgpu_fence_driver_hw_init(struct amdgpu_device *adev)if (!ring || !ring->fence_drv.initialized)continue ; +if (!ring->no_scheduler) +drm_sched_start (&ring->sched, false); +/* enable the interrupt */ if (ring->fence_drv.irq_src) amdgpu_irq_get(adev, ring->fence_drv.irq_src,
I don't think it will start/stop twice because amdgpu_fence_driver_hw_fini/inint is not called during reset.
I am worried about calling drm_sched_start without calling drm_sched_resubmit_job first since that the place where the jobs are actually restarted. Also calling drm_sched_start with false flag wrong here since it skips all the pending list handling.
Andrey
Quoted 42 lines · Christian König
In general that looks good to me, but what could be is that we now try to stop/start the scheduler during reset twice.
Andrey what do you think?
Christian.
Am 27.08.21 um 12:40 schrieb Guchun Chen:
Quoted 34 lines
This gurantees no more work on the ring can be submitted to hardware in suspend/resume case, otherwise the ring will not be empty before suspend.
Suggested-by Christian König <[email protected]>Signed-off-by Guchun Chen <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c| 6 ++++++1 file changed, 6 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 +2
-0@@ -611,6 +614,9 @@ void amdgpu_fence_driver_hw_init(struct amdgpu_device *adev) if (!ring || !ring->fence_drv.initialized) continue; + if (!ring->no_scheduler) + drm_sched_start(&ring->sched, false); + /* enable the interrupt */ if (ring->fence_drv.irq_src)amdgpu_irq_get(adev,
ring->fence_drv.irq_src,
[Public]
Hi Andrey and Christian,
Thanks for your comment, I will send out a new patch set later on after I verify it.
Regards,
Guchun
-----Original Message-----
From: Grodzovsky, Andrey <[email protected]>
Sent: Saturday, August 28, 2021 2:28 AM
To: Koenig, Christian <[email protected]>; Chen, Guchun <[email protected]>; [email protected]; Zhang, Hawking <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: stop scheduler when calling hw_fini
I don't think it will start/stop twice because amdgpu_fence_driver_hw_fini/inint is not called during reset.
I am worried about calling drm_sched_start without calling drm_sched_resubmit_job first since that the place where the jobs are actually restarted. Also calling drm_sched_start with false flag wrong here since it skips all the pending list handling.
Andrey
Quoted 44 lines · Christian König
In general that looks good to me, but what could be is that we now try to stop/start the scheduler during reset twice.
Andrey what do you think?
Christian.
Am 27.08.21 um 12:40 schrieb Guchun Chen:
Quoted 35 lines
This gurantees no more work on the ring can be submitted to hardware in suspend/resume case, otherwise the ring will not be empty before suspend.
Suggested-by Christian König <[email protected]>Signed-off-by Guchun Chen <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c| 6 ++++++1 file changed, 6 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); @@ -611,6 +614,9 @@ void amdgpu_fence_driver_hw_init(structamdgpu_device*adev)
if (!ring || !ring->fence_drv.initialized) continue;
+ if (!ring->no_scheduler)
+drm_sched_start(&ring->sched, false);
+
/* enable the interrupt */
if (ring->fence_drv.irq_src) amdgpu_irq_get(adev,ring->fence_drv.irq_src,