diff options
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.19.8/1722-drm-amdgpu-fix-old-fence-check-in-amdgpu_fence_emit.patch')
-rw-r--r-- | common/recipes-kernel/linux/linux-yocto-4.19.8/1722-drm-amdgpu-fix-old-fence-check-in-amdgpu_fence_emit.patch | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.19.8/1722-drm-amdgpu-fix-old-fence-check-in-amdgpu_fence_emit.patch b/common/recipes-kernel/linux/linux-yocto-4.19.8/1722-drm-amdgpu-fix-old-fence-check-in-amdgpu_fence_emit.patch new file mode 100644 index 00000000..3b3aba9a --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto-4.19.8/1722-drm-amdgpu-fix-old-fence-check-in-amdgpu_fence_emit.patch @@ -0,0 +1,67 @@ +From 34ec99975b25bdd5db7dbd6f7c9aad644982fe1d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com> +Date: Fri, 29 Mar 2019 19:30:23 +0100 +Subject: [PATCH 1722/2940] drm/amdgpu: fix old fence check in + amdgpu_fence_emit +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +We don't hold a reference to the old fence, so it can go away +any time we are waiting for it to signal. + +Signed-off-by: Christian König <christian.koenig@amd.com> +Reviewed-by: Chunming Zhou <david1.zhou@amd.com> +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 24 ++++++++++++++++------- + 1 file changed, 17 insertions(+), 7 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +index 43a98d13df1a..9bc70ed19829 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +@@ -136,8 +136,9 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f, + { + struct amdgpu_device *adev = ring->adev; + struct amdgpu_fence *fence; +- struct dma_fence *old, **ptr; ++ struct dma_fence __rcu **ptr; + uint32_t seq; ++ int r; + + fence = kmem_cache_alloc(amdgpu_fence_slab, GFP_KERNEL); + if (fence == NULL) +@@ -153,15 +154,24 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f, + seq, flags | AMDGPU_FENCE_FLAG_INT); + + ptr = &ring->fence_drv.fences[seq & ring->fence_drv.num_fences_mask]; ++ if (unlikely(rcu_dereference_protected(*ptr, 1))) { ++ struct dma_fence *old; ++ ++ rcu_read_lock(); ++ old = dma_fence_get_rcu_safe(ptr); ++ rcu_read_unlock(); ++ ++ if (old) { ++ r = dma_fence_wait(old, false); ++ dma_fence_put(old); ++ if (r) ++ return r; ++ } ++ } ++ + /* This function can't be called concurrently anyway, otherwise + * emitting the fence would mess up the hardware ring buffer. + */ +- old = rcu_dereference_protected(*ptr, 1); +- if (old && !dma_fence_is_signaled(old)) { +- DRM_INFO("rcu slot is busy\n"); +- dma_fence_wait(old, false); +- } +- + rcu_assign_pointer(*ptr, dma_fence_get(&fence->base)); + + *f = &fence->base; +-- +2.17.1 + |