From: jsg Date: Fri, 21 Apr 2023 03:44:04 +0000 (+0000) Subject: drm/amdgpu: Force signal hw_fences that are embedded in non-sched jobs X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1a85ce8b6bf185d9cd1037167275e41648d7e477;p=openbsd 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 --- 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); }