drm/amdgpu: Force signal hw_fences that are embedded in non-sched jobs
authorjsg <jsg@openbsd.org>
Fri, 21 Apr 2023 03:44:04 +0000 (03:44 +0000)
committerjsg <jsg@openbsd.org>
Fri, 21 Apr 2023 03:44:04 +0000 (03:44 +0000)
From YuBiao Wang
b4efb6af93ca755f5469114adfd7f26bb944962c in linux-6.1.y/6.1.25
033c56474acf567a450f8bafca50e0b610f2b716 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_fence.c

index b06a0f0..605b4c1 100644 (file)
@@ -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);
                }