[CI 05/12] drm/i915: Hold both locks when migrating callbacks

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Tue Feb 14 09:32:32 UTC 2023


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Do both list operations under both previous and target fence locks. This
will enable replacing the open coded callback migration with a helper in
the future.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/i915/i915_active.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
index a9483aadb0ff..f268a598fe9f 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -1060,9 +1060,10 @@ __i915_active_fence_set(struct i915_active_fence *active,
 		GEM_BUG_ON(prev == fence);
 		spin_lock_nested(prev->lock, SINGLE_DEPTH_NESTING);
 		__list_del_entry(&active->cb.node);
-		spin_unlock(prev->lock); /* serialise with prev->cb_list */
 	}
 	list_add_tail(&active->cb.node, &fence->cb_list);
+	if (prev)
+		spin_unlock(prev->lock); /* serialise with prev->cb_list */
 	spin_unlock_irqrestore(fence->lock, flags);
 
 	return prev;
-- 
2.34.1



More information about the Intel-gfx-trybot mailing list