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

Sean Paul sean at poorly.run
Tue Oct 30 13:17:48 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.

Change-Id: Idb16d61f2b3f30d77084f27267f8bf5ff97ab399
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 5f992485243f..13bb33821d24 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -14871,6 +14871,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