summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2023-04-21 03:44:05 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2023-04-21 03:44:05 +0000
commit865e18a437607228af72d21cbd38b6671c9b49a1 (patch)
treee8260a05a65f47401a58173eb6b45efdfe392b3e
parent86431f25a6b6317469e7b8df5d2ef0c4b498dca9 (diff)
drm/amdgpu: Force signal hw_fences that are embedded in non-sched jobs
From YuBiao Wang b4efb6af93ca755f5469114adfd7f26bb944962c in linux-6.1.y/6.1.25 033c56474acf567a450f8bafca50e0b610f2b716 in mainline linux
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/amdgpu_fence.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_fence.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_fence.c
index b06a0f06800..605b4c1b25e 100644
--- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_fence.c
+++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_fence.c
@@ -644,6 +644,15 @@ void amdgpu_fence_driver_clear_job_fences(struct amdgpu_ring *ring)
ptr = &ring->fence_drv.fences[i];
old = rcu_dereference_protected(*ptr, 1);
if (old && old->ops == &amdgpu_job_fence_ops) {
+ struct amdgpu_job *job;
+
+ /* For non-scheduler bad job, i.e. failed ib test, we need to signal
+ * it right here or we won't be able to track them in fence_drv
+ * and they will remain unsignaled during sa_bo free.
+ */
+ job = container_of(old, struct amdgpu_job, hw_fence);
+ if (!job->base.s_fence && !dma_fence_is_signaled(old))
+ dma_fence_signal(old);
RCU_INIT_POINTER(*ptr, NULL);
dma_fence_put(old);
}