[PATCH] drm/amdgpu: stop scheduler when calling hw_fini (v2)
Andrey Grodzovsky
andrey.grodzovsky at amd.com
Tue Aug 31 02:45:17 UTC 2021
Looks good to me too.
Andrey
On 2021-08-30 2:17 a.m., Christian König wrote:
> Am 30.08.21 um 08:08 schrieb 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.
>>
>> v2: Call drm_sched_resubmit_job before drm_sched_start to
>> restart jobs from the pending list.
>>
>> Suggested-by: Andrey Grodzovsky <andrey.grodzovsky at amd.com>
>> Suggested-by: Christian König <christian.koenig at amd.com>
>> Signed-off-by: Guchun Chen <guchun.chen at amd.com>
>
> Reviewed-by: Christian König <christian.koenig at amd.com>
>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>> index b439eb7d4177..fd4ba076ff8a 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>> @@ -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,
>
More information about the amd-gfx
mailing list