From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: intel-gfx@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org,
chris@chris-wilson.co.uk
Subject: [PATCH 4/5] dma-buf: simplify reservation_object_get_fences_rcu a bit
Date: Mon, 5 Aug 2019 17:45:53 +0200 [thread overview]
Message-ID: <20190805154554.3476-4-christian.koenig@amd.com> (raw)
In-Reply-To: <20190805154554.3476-1-christian.koenig@amd.com>
We can add the exclusive fence to the list after making sure we got
a consistent state.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/dma-buf/reservation.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
index 6eaca469005f..69c826553c72 100644
--- a/drivers/dma-buf/reservation.c
+++ b/drivers/dma-buf/reservation.c
@@ -426,13 +426,6 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj,
if (!dma_fence_get_rcu(shared[i]))
break;
}
-
- if (!pfence_excl && fence_excl) {
- shared[i] = fence_excl;
- fence_excl = NULL;
- ++i;
- ++shared_count;
- }
}
if (i != shared_count || read_seqcount_retry(&obj->seq, seq)) {
@@ -447,6 +440,11 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj,
rcu_read_unlock();
} while (ret);
+ if (pfence_excl)
+ *pfence_excl = fence_excl;
+ else if (fence_excl)
+ shared[++shared_count] = fence_excl;
+
if (!shared_count) {
kfree(shared);
shared = NULL;
@@ -454,9 +452,6 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj,
*pshared_count = shared_count;
*pshared = shared;
- if (pfence_excl)
- *pfence_excl = fence_excl;
-
return ret;
}
EXPORT_SYMBOL_GPL(reservation_object_get_fences_rcu);
--
2.17.1
next prev parent reply other threads:[~2019-08-05 15:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-05 15:45 [PATCH 1/5] drm/i915: stop pruning reservation object after wait Christian König
2019-08-05 15:45 ` [PATCH 2/5] dma-buf: fix busy wait for new shared fences Christian König
2019-08-05 15:45 ` [PATCH 3/5] dma-buf: further relax reservation_object_add_shared_fence Christian König
2019-08-05 15:45 ` Christian König [this message]
2019-08-05 15:45 ` [PATCH 5/5] dma-buf: nuke reservation_object seq number Christian König
2019-08-05 16:07 ` Chris Wilson
2019-08-05 16:41 ` [Intel-gfx] " Daniel Vetter
2019-08-05 15:58 ` [PATCH 1/5] drm/i915: stop pruning reservation object after wait Chris Wilson
2019-08-05 16:54 ` Chris Wilson
2019-08-06 8:05 ` Christian König
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=20190805154554.3476-4-christian.koenig@amd.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=chris@chris-wilson.co.uk \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-media@vger.kernel.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