From: "Pan, Xinhui" <Xinhui.Pan@amd.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linaro-mm-sig@lists.linaro.org" <linaro-mm-sig@lists.linaro.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>
Cc: "sumit.semwal@linaro.org" <sumit.semwal@linaro.org>,
"Koenig, Christian" <Christian.Koenig@amd.com>,
Daniel Vetter <daniel@ffwll.ch>
Subject: [PATCH V2] dma-buf: Fix missing excl fence waiting
Date: Sun, 23 Feb 2020 12:04:10 +0000 [thread overview]
Message-ID: <18BF034E-CF71-402E-82D9-2B60C83791D3@amd.com> (raw)
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>
---
change from v1:
init left correctly
---
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..82e4b4f63bef 100644
--- a/drivers/dma-buf/dma-resv.c
+++ b/drivers/dma-buf/dma-resv.c
@@ -632,13 +632,13 @@ 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;
+ left = shared_count = 0;
seq = read_seqcount_begin(&obj->seq);
if (test_all) {
@@ -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)
reply other threads:[~2020-02-23 12:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18BF034E-CF71-402E-82D9-2B60C83791D3@amd.com \
--to=xinhui.pan@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=sumit.semwal@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).