All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] dma-buf: fix dma_resv_test_signaled test_all handling
@ 2021-06-11 12:02 ` Christian König
  0 siblings, 0 replies; 28+ messages in thread
From: Christian König @ 2021-06-11 12:02 UTC (permalink / raw)
  To: daniel, dri-devel, amd-gfx

As the name implies if testing all fences is requested we
should indeed test all fences and not skip the exclusive
one because we see shared ones.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/dma-buf/dma-resv.c | 33 ++++++++++++---------------------
 1 file changed, 12 insertions(+), 21 deletions(-)

diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c
index f26c71747d43..c66bfdde9454 100644
--- a/drivers/dma-buf/dma-resv.c
+++ b/drivers/dma-buf/dma-resv.c
@@ -615,25 +615,21 @@ static inline int dma_resv_test_signaled_single(struct dma_fence *passed_fence)
  */
 bool dma_resv_test_signaled(struct dma_resv *obj, bool test_all)
 {
-	unsigned int seq, shared_count;
+	struct dma_fence *fence;
+	unsigned int seq;
 	int ret;
 
 	rcu_read_lock();
 retry:
 	ret = true;
-	shared_count = 0;
 	seq = read_seqcount_begin(&obj->seq);
 
 	if (test_all) {
 		struct dma_resv_list *fobj = dma_resv_shared_list(obj);
-		unsigned int i;
-
-		if (fobj)
-			shared_count = fobj->shared_count;
+		unsigned int i, shared_count;
 
+		shared_count = fobj ? fobj->shared_count : 0;
 		for (i = 0; i < shared_count; ++i) {
-			struct dma_fence *fence;
-
 			fence = rcu_dereference(fobj->shared[i]);
 			ret = dma_resv_test_signaled_single(fence);
 			if (ret < 0)
@@ -641,24 +637,19 @@ bool dma_resv_test_signaled(struct dma_resv *obj, bool test_all)
 			else if (!ret)
 				break;
 		}
-
-		if (read_seqcount_retry(&obj->seq, seq))
-			goto retry;
 	}
 
-	if (!shared_count) {
-		struct dma_fence *fence_excl = dma_resv_excl_fence(obj);
-
-		if (fence_excl) {
-			ret = dma_resv_test_signaled_single(fence_excl);
-			if (ret < 0)
-				goto retry;
+	fence = dma_resv_excl_fence(obj);
+	if (fence) {
+		ret = dma_resv_test_signaled_single(fence);
+		if (ret < 0)
+			goto retry;
 
-			if (read_seqcount_retry(&obj->seq, seq))
-				goto retry;
-		}
 	}
 
+	if (read_seqcount_retry(&obj->seq, seq))
+		goto retry;
+
 	rcu_read_unlock();
 	return ret;
 }
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2021-06-17 16:58 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-11 12:02 [PATCH 1/5] dma-buf: fix dma_resv_test_signaled test_all handling Christian König
2021-06-11 12:02 ` Christian König
2021-06-11 12:02 ` [PATCH 2/5] dma-buf: some dma_fence_chain improvements Christian König
2021-06-11 12:02   ` Christian König
2021-06-11 12:02 ` [PATCH 3/5] dma-buf: add dma_fence_chain_alloc/free v2 Christian König
2021-06-11 12:02   ` Christian König
2021-06-11 14:52   ` Daniel Vetter
2021-06-11 14:52     ` Daniel Vetter
2021-06-11 14:54     ` Christian König
2021-06-11 14:54       ` Christian König
2021-06-11 12:03 ` [PATCH 4/5] drm/amdgpu: unwrap fence chains in the explicit sync fence Christian König
2021-06-11 12:03   ` Christian König
2021-06-11 12:03 ` [PATCH 5/5] drm/amdgpu: rework dma_resv handling v2 Christian König
2021-06-11 12:03   ` Christian König
2021-06-11 14:56   ` Daniel Vetter
2021-06-11 14:56     ` Daniel Vetter
2021-06-11 15:10     ` Christian König
2021-06-11 15:10       ` Christian König
2021-06-11 14:47 ` [PATCH 1/5] dma-buf: fix dma_resv_test_signaled test_all handling Daniel Vetter
2021-06-11 14:47   ` Daniel Vetter
2021-06-11 14:53   ` Christian König
2021-06-11 14:53     ` Christian König
2021-06-11 14:55     ` Daniel Vetter
2021-06-11 14:55       ` Daniel Vetter
2021-06-14 17:15       ` Christian König
2021-06-14 17:15         ` Christian König
2021-06-17 16:58         ` Daniel Vetter
2021-06-17 16:58           ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.