diff mbox series

[3/8] drm/i915: stop using seqcount for fenc pruning

Message ID 20190806150134.104222-3-christian.koenig@amd.com (mailing list archive)
State New, archived
Headers show
Series [1/8] dma-buf: fix busy wait for new shared fences | expand

Commit Message

Christian König Aug. 6, 2019, 3:01 p.m. UTC
After waiting for a reservation object use reservation_object_test_signaled_rcu
to opportunistically prune the fences on the object.

This allows removal of the seqcount handling in the reservation object.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_wait.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

Comments

Chris Wilson Aug. 6, 2019, 7:07 p.m. UTC | #1
Quoting Christian König (2019-08-06 16:01:29)
> After waiting for a reservation object use reservation_object_test_signaled_rcu
> to opportunistically prune the fences on the object.
> 
> This allows removal of the seqcount handling in the reservation object.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

I like keeping the reminder about the lack of pruning on idle objects :)
-Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_wait.c b/drivers/gpu/drm/i915/gem/i915_gem_wait.c
index 26ec6579b7cd..fa46a54bcbe7 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_wait.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_wait.c
@@ -35,7 +35,6 @@  i915_gem_object_wait_reservation(struct reservation_object *resv,
 				 unsigned int flags,
 				 long timeout)
 {
-	unsigned int seq = __read_seqcount_begin(&resv->seq);
 	struct dma_fence *excl;
 	bool prune_fences = false;
 
@@ -83,15 +82,12 @@  i915_gem_object_wait_reservation(struct reservation_object *resv,
 
 	/*
 	 * Opportunistically prune the fences iff we know they have *all* been
-	 * signaled and that the reservation object has not been changed (i.e.
-	 * no new fences have been added).
+	 * signaled.
 	 */
-	if (prune_fences && !__read_seqcount_retry(&resv->seq, seq)) {
-		if (reservation_object_trylock(resv)) {
-			if (!__read_seqcount_retry(&resv->seq, seq))
-				reservation_object_add_excl_fence(resv, NULL);
-			reservation_object_unlock(resv);
-		}
+	if (prune_fences && reservation_object_trylock(resv)) {
+		if (reservation_object_test_signaled_rcu(resv, true))
+			reservation_object_add_excl_fence(resv, NULL);
+		reservation_object_unlock(resv);
 	}
 
 	return timeout;