linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma-buf: Fix missing excl fence waiting
@ 2020-02-23 11:56 Pan, Xinhui
  2020-02-23 12:00 ` Pan, Xinhui
  2020-02-23 12:04 ` Christian König
  0 siblings, 2 replies; 9+ messages in thread
From: Pan, Xinhui @ 2020-02-23 11:56 UTC (permalink / raw)
  To: linux-kernel, linaro-mm-sig, dri-devel, linux-media
  Cc: sumit.semwal, daniel.vetter, Koenig, Christian

If shared fence list is not empty, even we want to test all fences, excl fence is ignored.
That is abviously wrong, so fix it.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
---
 drivers/dma-buf/dma-resv.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c
index 4264e64788c4..44dc64c547c6 100644
--- a/drivers/dma-buf/dma-resv.c
+++ b/drivers/dma-buf/dma-resv.c
@@ -632,14 +632,14 @@ static inline int dma_resv_test_signaled_single(struct dma_fence *passed_fence)
  */
 bool dma_resv_test_signaled_rcu(struct dma_resv *obj, bool test_all)
 {
-	unsigned seq, shared_count;
+	unsigned int seq, shared_count, left;
 	int ret;
 
 	rcu_read_lock();
 retry:
 	ret = true;
 	shared_count = 0;
-	seq = read_seqcount_begin(&obj->seq);
+	left = seq = read_seqcount_begin(&obj->seq);
 
 	if (test_all) {
 		unsigned i;
@@ -647,7 +647,7 @@ bool dma_resv_test_signaled_rcu(struct dma_resv *obj, bool test_all)
 		struct dma_resv_list *fobj = rcu_dereference(obj->fence);
 
 		if (fobj)
-			shared_count = fobj->shared_count;
+			left = shared_count = fobj->shared_count;
 
 		for (i = 0; i < shared_count; ++i) {
 			struct dma_fence *fence = rcu_dereference(fobj->shared[i]);
@@ -657,13 +657,14 @@ bool dma_resv_test_signaled_rcu(struct dma_resv *obj, bool test_all)
 				goto retry;
 			else if (!ret)
 				break;
+			left--;
 		}
 
 		if (read_seqcount_retry(&obj->seq, seq))
 			goto retry;
 	}
 
-	if (!shared_count) {
+	if (!left) {
 		struct dma_fence *fence_excl = rcu_dereference(obj->fence_excl);
 
 		if (fence_excl) {
-- 
2.21.0 (Apple Git-122)



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

end of thread, other threads:[~2020-02-28  6:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-23 11:56 [PATCH] dma-buf: Fix missing excl fence waiting Pan, Xinhui
2020-02-23 12:00 ` Pan, Xinhui
2020-02-23 12:04 ` Christian König
2020-02-23 12:21   ` Pan, Xinhui
2020-02-23 12:12     ` Christian König
2020-02-25 17:23   ` Daniel Vetter
2020-02-25 19:11     ` Christian König
2020-02-28  5:45       ` Pan, Xinhui
2020-02-28  6:08         ` Pan, Xinhui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).