In the amdgpu_userq_evict function, after signaling the eviction fence, we need to ensure it's processed before scheduling the resume work. This prevents potential race conditions where the resume work might start before the eviction fence has been fully handled, leading to inconsistent state in user queues.
Signed-off-by: Jesse Zhang <[email protected]> --- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c index 2f97f35e0af5..ed744b2edc61 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c @@ -1238,6 +1238,10 @@ amdgpu_userq_evict(struct amdgpu_userq_mgr *uq_mgr, return; } + /* Wait for eviction fence to be processed before schedule a resume work */ + if (dma_fence_wait_timeout(&ev_fence->base, false, msecs_to_jiffies(100)) <= 0) { + dev_warn(adev->dev, "Eviction fence wait timed out\n"); + } /* Schedule a resume work */ schedule_delayed_work(&uq_mgr->resume_work, 0); } -- 2.49.0
