[Intel-gfx] [PATCH 1/3] drm/i915: Handle i915_active_fence_set() with the same fence

Chris Wilson chris at chris-wilson.co.uk
Wed Nov 6 15:48:08 UTC 2019


If the caller wants to overwrite the currently tracked fence, with
itself, as far as the tracking is concerned it is a no-op, so simply
allow it.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/i915/i915_active.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
index 207383dda84d..cde984744f20 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -759,7 +759,9 @@ __i915_active_fence_set(struct i915_active_fence *active,
 
 	prev = rcu_dereference_protected(active->fence, active_is_held(active));
 	if (prev) {
-		GEM_BUG_ON(prev == fence);
+		if (unlikely(prev == fence))
+			goto unlock;
+
 		spin_lock_nested(prev->lock, SINGLE_DEPTH_NESTING);
 		__list_del_entry(&active->cb.node);
 		spin_unlock(prev->lock); /* serialise with prev->cb_list */
@@ -781,6 +783,7 @@ __i915_active_fence_set(struct i915_active_fence *active,
 	rcu_assign_pointer(active->fence, fence);
 	list_add_tail(&active->cb.node, &fence->cb_list);
 
+unlock:
 	spin_unlock_irqrestore(fence->lock, flags);
 
 	return prev;
-- 
2.24.0



More information about the Intel-gfx mailing list