Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <dev@lankhorst.se>
To: intel-xe@lists.freedesktop.org
Subject: [FOR CI 3/5] drm/i915: Don't disable interrupts on PREEMPT_RT during atomic updates
Date: Thu, 23 Oct 2025 10:55:59 +0200	[thread overview]
Message-ID: <20251023085601.90831-4-dev@lankhorst.se> (raw)
In-Reply-To: <20251023085601.90831-1-dev@lankhorst.se>

From: Mike Galbraith <umgwanakikbuti@gmail.com>

Commit
   8d7849db3eab7 ("drm/i915: Make sprite updates atomic")

started disabling interrupts across atomic updates. This breaks on PREEMPT_RT
because within this section the code attempt to acquire spinlock_t locks which
are sleeping locks on PREEMPT_RT.

According to the comment the interrupts are disabled to avoid random delays and
not required for protection or synchronisation.
If this needs to happen with disabled interrupts on PREEMPT_RT, and the
whole section is restricted to register access then all sleeping locks
need to be acquired before interrupts are disabled and some function
maybe moved after enabling interrupts again.
This includes:
- prepare_to_wait() + finish_wait() due its wake queue.
- drm_crtc_vblank_put() -> vblank_disable_fn() drm_device::vbl_lock.
- skl_pfit_enable(), intel_update_plane(), vlv_atomic_update_fifo() and
  maybe others due to intel_uncore::lock
- drm_crtc_arm_vblank_event() due to drm_device::event_lock and
  drm_device::vblank_time_lock.

Don't disable interrupts on PREEMPT_RT during atomic updates.

[bigeasy: drop local locks, commit message]

Signed-off-by: Mike Galbraith <umgwanakikbuti@gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
---
 drivers/gpu/drm/i915/display/intel_crtc.c   | 9 ++++++---
 drivers/gpu/drm/i915/display/intel_cursor.c | 9 ++++++---
 drivers/gpu/drm/i915/display/intel_vblank.c | 6 ++++--
 3 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c b/drivers/gpu/drm/i915/display/intel_crtc.c
index d300ba1dcd2c4..f34745b5ea497 100644
--- a/drivers/gpu/drm/i915/display/intel_crtc.c
+++ b/drivers/gpu/drm/i915/display/intel_crtc.c
@@ -567,7 +567,8 @@ void intel_pipe_update_start(struct intel_atomic_state *state,
 	 */
 	intel_psr_wait_for_idle_locked(new_crtc_state);
 
-	local_irq_disable();
+	if (!IS_ENABLED(CONFIG_PREEMPT_RT))
+		local_irq_disable();
 
 	crtc->debug.min_vbl = evade.min;
 	crtc->debug.max_vbl = evade.max;
@@ -585,7 +586,8 @@ void intel_pipe_update_start(struct intel_atomic_state *state,
 	return;
 
 irq_disable:
-	local_irq_disable();
+	if (!IS_ENABLED(CONFIG_PREEMPT_RT))
+		local_irq_disable();
 }
 
 #if IS_ENABLED(CONFIG_DRM_I915_DEBUG_VBLANK_EVADE)
@@ -731,7 +733,8 @@ void intel_pipe_update_end(struct intel_atomic_state *state,
 	if (!state->base.legacy_cursor_update)
 		intel_vrr_send_push(NULL, new_crtc_state);
 
-	local_irq_enable();
+	if (!IS_ENABLED(CONFIG_PREEMPT_RT))
+		local_irq_enable();
 
 	if (intel_vgpu_active(dev_priv))
 		goto out;
diff --git a/drivers/gpu/drm/i915/display/intel_cursor.c b/drivers/gpu/drm/i915/display/intel_cursor.c
index c47c849358714..780fcae77a984 100644
--- a/drivers/gpu/drm/i915/display/intel_cursor.c
+++ b/drivers/gpu/drm/i915/display/intel_cursor.c
@@ -919,13 +919,15 @@ intel_legacy_cursor_update(struct drm_plane *_plane,
 		 */
 		intel_psr_wait_for_idle_locked(crtc_state);
 
-		local_irq_disable();
+		if (!IS_ENABLED(CONFIG_PREEMPT_RT))
+			local_irq_disable();
 
 		intel_vblank_evade(&evade);
 
 		drm_crtc_vblank_put(&crtc->base);
 	} else {
-		local_irq_disable();
+		if (!IS_ENABLED(CONFIG_PREEMPT_RT))
+			local_irq_disable();
 	}
 
 	if (new_plane_state->uapi.visible) {
@@ -935,7 +937,8 @@ intel_legacy_cursor_update(struct drm_plane *_plane,
 		intel_plane_disable_arm(NULL, plane, crtc_state);
 	}
 
-	local_irq_enable();
+	if (!IS_ENABLED(CONFIG_PREEMPT_RT))
+		local_irq_enable();
 
 	intel_psr_unlock(crtc_state);
 
diff --git a/drivers/gpu/drm/i915/display/intel_vblank.c b/drivers/gpu/drm/i915/display/intel_vblank.c
index 5206a81f85554..7826f29619a14 100644
--- a/drivers/gpu/drm/i915/display/intel_vblank.c
+++ b/drivers/gpu/drm/i915/display/intel_vblank.c
@@ -761,11 +761,13 @@ int intel_vblank_evade(struct intel_vblank_evade_ctx *evade)
 			break;
 		}
 
-		local_irq_enable();
+		if (!IS_ENABLED(CONFIG_PREEMPT_RT))
+			local_irq_enable();
 
 		timeout = schedule_timeout(timeout);
 
-		local_irq_disable();
+		if (!IS_ENABLED(CONFIG_PREEMPT_RT))
+			local_irq_disable();
 	}
 
 	finish_wait(wq, &wait);
-- 
2.51.0


  parent reply	other threads:[~2025-10-23  8:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-23  8:55 [FOR CI 0/5] Testing PREEMPT_RT with disabling interrupts in the most critical section Maarten Lankhorst
2025-10-23  8:55 ` [FOR CI 1/5] drm/xe: Bump xe_device_l2_flush even higher Maarten Lankhorst
2025-10-23  8:55 ` [FOR CI 2/5] drm/i915: Use preempt_disable/enable_rt() where recommended Maarten Lankhorst
2025-10-23  8:55 ` Maarten Lankhorst [this message]
2025-10-23  8:56 ` [FOR CI 4/5] drm/xe/display: Disable preemption in the most critical section Maarten Lankhorst
2025-10-23  8:56 ` [FOR CI 5/5] PREEMPT_RT injection Maarten Lankhorst
2025-10-23 13:38 ` ✗ CI.checkpatch: warning for Testing PREEMPT_RT with disabling interrupts in the most critical section. (rev2) Patchwork
2025-10-23 13:39 ` ✓ CI.KUnit: success " Patchwork
2025-10-23 14:00 ` ✗ CI.checksparse: warning " Patchwork
2025-10-23 22:15 ` ✗ Xe.CI.Full: failure " Patchwork
2025-10-27 10:03 ` ✗ CI.checkpatch: warning for Testing PREEMPT_RT with disabling interrupts in the most critical section. (rev3) Patchwork
2025-10-27 10:04 ` ✓ CI.KUnit: success " Patchwork
2025-10-27 10:18 ` ✗ CI.checksparse: warning " Patchwork
2025-10-27 10:47 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-10-27 12:52 ` ✗ Xe.CI.Full: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2025-10-29  9:59 [FOR CI 0/5] Testing PREEMPT_RT with disabling preemption in the most critical section Maarten Lankhorst
2025-10-29  9:59 ` [FOR CI 3/5] drm/i915: Don't disable interrupts on PREEMPT_RT during atomic updates Maarten Lankhorst
2025-10-23 15:34 [FOR CI 0/5] drm/xe/display: Test series with PREEMPT_RT and preemption disable Maarten Lankhorst
2025-10-23 15:34 ` [FOR CI 3/5] drm/i915: Don't disable interrupts on PREEMPT_RT during atomic updates Maarten Lankhorst
2025-10-22 12:13 [FOR CI 0/5] drm/xe/display: Test series with PREEMPT_RT and preemption disable Maarten Lankhorst
2025-10-22 12:13 ` [FOR CI 3/5] drm/i915: Don't disable interrupts on PREEMPT_RT during atomic updates Maarten Lankhorst
2025-10-21 12:43 [FOR CI 0/5] drm/xe/display: Disable migration for the critical Maarten Lankhorst
2025-10-21 12:43 ` [FOR CI 3/5] drm/i915: Don't disable interrupts on PREEMPT_RT during atomic updates Maarten Lankhorst
2025-10-17 15:37 [FOR CI 0/5] Testing PREEMPT_RT with disabling interrupts in the most critical section Maarten Lankhorst
2025-10-17 15:37 ` [FOR CI 3/5] drm/i915: Don't disable interrupts on PREEMPT_RT during atomic updates Maarten Lankhorst
2025-10-17 11:57 [FOR CI 0/5] Test PREEMPT_RT with irqs disabled Maarten Lankhorst
2025-10-17 11:57 ` [FOR CI 3/5] drm/i915: Don't disable interrupts on PREEMPT_RT during atomic updates Maarten Lankhorst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251023085601.90831-4-dev@lankhorst.se \
    --to=dev@lankhorst.se \
    --cc=intel-xe@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox