Message ID | 20210428151207.1212258-14-andrey.grodzovsky@amd.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | RFC Support hot device unplug in amdgpu | expand |
Filizing the fences? You mean finishing the fences, don't you? :) Am 28.04.21 um 17:11 schrieb Andrey Grodzovsky: > No point calling amdgpu_fence_wait_empty before stopping the > SW scheduler otherwise there is always a chance another job sneaked > in after the wait. > > Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c > index 34d51e962799..fd9282637549 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c > @@ -533,6 +533,12 @@ void amdgpu_fence_driver_fini_hw(struct amdgpu_device *adev) > > if (!ring || !ring->fence_drv.initialized) > continue; > + > + /* Stop any new job submissions from sched before flushing the ring */ > + /* TODO Handle amdgpu_job_submit_direct and amdgpu_amdkfd_submit_ib */ > + if (!ring->no_scheduler) > + drm_sched_fini(&ring->sched); > + > r = amdgpu_fence_wait_empty(ring); > if (r) { > /* no need to trigger GPU reset as we are unloading */ > @@ -541,8 +547,7 @@ void amdgpu_fence_driver_fini_hw(struct amdgpu_device *adev) > if (ring->fence_drv.irq_src) > amdgpu_irq_put(adev, ring->fence_drv.irq_src, > ring->fence_drv.irq_type); > - if (!ring->no_scheduler) > - drm_sched_fini(&ring->sched); > + > del_timer_sync(&ring->fence_drv.fallback_timer); > } > }
On 2021-04-29 3:15 a.m., Christian König wrote: > > Filizing the fences? You mean finishing the fences, don't you? :) Yes, my bad. Andrey > > Am 28.04.21 um 17:11 schrieb Andrey Grodzovsky: >> No point calling amdgpu_fence_wait_empty before stopping the >> SW scheduler otherwise there is always a chance another job sneaked >> in after the wait. >> >> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> >> --- >> drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 9 +++++++-- >> 1 file changed, 7 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c >> b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c >> index 34d51e962799..fd9282637549 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c >> @@ -533,6 +533,12 @@ void amdgpu_fence_driver_fini_hw(struct >> amdgpu_device *adev) >> if (!ring || !ring->fence_drv.initialized) >> continue; >> + >> + /* Stop any new job submissions from sched before flushing >> the ring */ >> + /* TODO Handle amdgpu_job_submit_direct and >> amdgpu_amdkfd_submit_ib */ >> + if (!ring->no_scheduler) >> + drm_sched_fini(&ring->sched); >> + >> r = amdgpu_fence_wait_empty(ring); >> if (r) { >> /* no need to trigger GPU reset as we are unloading */ >> @@ -541,8 +547,7 @@ void amdgpu_fence_driver_fini_hw(struct >> amdgpu_device *adev) >> if (ring->fence_drv.irq_src) >> amdgpu_irq_put(adev, ring->fence_drv.irq_src, >> ring->fence_drv.irq_type); >> - if (!ring->no_scheduler) >> - drm_sched_fini(&ring->sched); >> + >> del_timer_sync(&ring->fence_drv.fallback_timer); >> } >> } >
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c index 34d51e962799..fd9282637549 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c @@ -533,6 +533,12 @@ void amdgpu_fence_driver_fini_hw(struct amdgpu_device *adev) if (!ring || !ring->fence_drv.initialized) continue; + + /* Stop any new job submissions from sched before flushing the ring */ + /* TODO Handle amdgpu_job_submit_direct and amdgpu_amdkfd_submit_ib */ + if (!ring->no_scheduler) + drm_sched_fini(&ring->sched); + r = amdgpu_fence_wait_empty(ring); if (r) { /* no need to trigger GPU reset as we are unloading */ @@ -541,8 +547,7 @@ void amdgpu_fence_driver_fini_hw(struct amdgpu_device *adev) if (ring->fence_drv.irq_src) amdgpu_irq_put(adev, ring->fence_drv.irq_src, ring->fence_drv.irq_type); - if (!ring->no_scheduler) - drm_sched_fini(&ring->sched); + del_timer_sync(&ring->fence_drv.fallback_timer); } }
No point calling amdgpu_fence_wait_empty before stopping the SW scheduler otherwise there is always a chance another job sneaked in after the wait. Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)