[PATCH v2 2/2] drm/i915/active: Make lockdep happy

Janusz Krzysztofik janusz.krzysztofik at linux.intel.com
Wed Jul 19 07:56:40 UTC 2023


Pre-merge results indicate a lockdep issue.  Assume that's a false
positive and try to make the code that disables IRQs more explicit.

Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
---
 drivers/gpu/drm/i915/i915_active.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
index 53c2c669ad003..26cfe50a2991a 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -1064,7 +1064,8 @@ __i915_active_fence_set(struct i915_active_fence *active,
 	 * nesting rules for the fence->lock; the inner lock is always the
 	 * older lock.
 	 */
-	spin_lock_irqsave(fence->lock, flags);
+	local_irq_save(flags);
+	spin_lock(fence->lock);
 	if (prev)
 		spin_lock_nested(prev->lock, SINGLE_DEPTH_NESTING);
 
@@ -1083,12 +1084,14 @@ __i915_active_fence_set(struct i915_active_fence *active,
 			spin_unlock(prev->lock);
 			dma_fence_put(prev);
 		}
-		spin_unlock_irqrestore(fence->lock, flags);
+		spin_unlock(fence->lock);
+		local_irq_restore(flags);
 
 		prev = i915_active_fence_get(active);
 		GEM_BUG_ON(prev == fence);
 
-		spin_lock_irqsave(fence->lock, flags);
+		local_irq_save(flags);
+		spin_lock(fence->lock);
 		if (prev)
 			spin_lock_nested(prev->lock, SINGLE_DEPTH_NESTING);
 	}
@@ -1110,7 +1113,8 @@ __i915_active_fence_set(struct i915_active_fence *active,
 		spin_unlock(prev->lock); /* serialise with prev->cb_list */
 	}
 	list_add_tail(&active->cb.node, &fence->cb_list);
-	spin_unlock_irqrestore(fence->lock, flags);
+	spin_unlock(fence->lock);
+	local_irq_restore(flags);
 
 	return prev;
 }
-- 
2.41.0



More information about the Intel-gfx-trybot mailing list