[PATCH 1/4] drm/i915: Restore state->acquire_ctx in sanitize_watermarks

Sean Paul sean at poorly.run
Thu Oct 25 14:48:26 UTC 2018


From: Sean Paul <seanpaul at chromium.org>

sanitize_watermarks() grabs all of the modeset locks with a new
function-scoped acquire context, and then duplicates the current state.
However, it doesn't attach the context in which it's grabbed the modeset
locks to the state. When intel_atomic_check is called, the state has no
context and modeset locks are re-acquired with NULL ctx, which causes
lock recursion.

This patch attaches the proper context to state before calling
atomic_check. When check re-acquires the locks, they're already held and
everyone is happy.

Signed-off-by: Sean Paul <seanpaul at chromium.org>
---
 drivers/gpu/drm/i915/intel_display.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index d2951096bca0..b0f3cae3ef9c 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -15073,6 +15073,13 @@ static void sanitize_watermarks(struct drm_device *dev)
 	if (WARN_ON(IS_ERR(state)))
 		goto fail;
 
+	/*
+	 * When we duplicate the state, the acquire ctx isn't carried over. We
+	 * need to restore the context here to avoid lock recursion on the
+	 * modeset locks in atomic_check below.
+	 */
+	state->acquire_ctx = &ctx;
+
 	intel_state = to_intel_atomic_state(state);
 
 	/*
-- 
Sean Paul, Software Engineer, Google / Chromium OS



More information about the Intel-gfx-trybot mailing list