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 4/5] drm/xe/display: Disable migration in the most critical section
Date: Tue, 21 Oct 2025 14:43:08 +0200	[thread overview]
Message-ID: <20251021124309.130121-5-dev@lankhorst.se> (raw)
In-Reply-To: <20251021124309.130121-1-dev@lankhorst.se>

Lets see what happens if we only disable migration in the critical
section to ensure we do run as fast as possible without disabling
too much.

First attempt: Only disable migration.

Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
---
 drivers/gpu/drm/i915/display/intel_crtc.c   | 14 ++++++++++++++
 drivers/gpu/drm/i915/display/intel_cursor.c | 18 +++++++++++++++++-
 drivers/gpu/drm/i915/display/intel_dmc.c    |  4 ++--
 drivers/gpu/drm/i915/display/intel_vblank.c | 13 ++++++++++---
 4 files changed, 43 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c b/drivers/gpu/drm/i915/display/intel_crtc.c
index f34745b5ea497..6972850a1f7db 100644
--- a/drivers/gpu/drm/i915/display/intel_crtc.c
+++ b/drivers/gpu/drm/i915/display/intel_crtc.c
@@ -569,6 +569,10 @@ void intel_pipe_update_start(struct intel_atomic_state *state,
 
 	if (!IS_ENABLED(CONFIG_PREEMPT_RT))
 		local_irq_disable();
+#ifndef I915
+	else
+		migrate_disable();
+#endif
 
 	crtc->debug.min_vbl = evade.min;
 	crtc->debug.max_vbl = evade.max;
@@ -588,6 +592,11 @@ void intel_pipe_update_start(struct intel_atomic_state *state,
 irq_disable:
 	if (!IS_ENABLED(CONFIG_PREEMPT_RT))
 		local_irq_disable();
+#ifndef I915
+	else
+		migrate_disable();
+#endif
+
 }
 
 #if IS_ENABLED(CONFIG_DRM_I915_DEBUG_VBLANK_EVADE)
@@ -733,8 +742,13 @@ void intel_pipe_update_end(struct intel_atomic_state *state,
 	if (!state->base.legacy_cursor_update)
 		intel_vrr_send_push(NULL, new_crtc_state);
 
+	/* Re-enable irqs here for !RT */
 	if (!IS_ENABLED(CONFIG_PREEMPT_RT))
 		local_irq_enable();
+#ifndef I915
+	else
+		migrate_enable();
+#endif
 
 	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 780fcae77a984..08d56b9ea2526 100644
--- a/drivers/gpu/drm/i915/display/intel_cursor.c
+++ b/drivers/gpu/drm/i915/display/intel_cursor.c
@@ -912,6 +912,7 @@ intel_legacy_cursor_update(struct drm_plane *_plane,
 
 	intel_psr_lock(crtc_state);
 
+	bool vblanked = false;
 	if (!drm_WARN_ON(display->drm, drm_crtc_vblank_get(&crtc->base))) {
 		/*
 		 * TODO: maybe check if we're still in PSR
@@ -921,13 +922,21 @@ intel_legacy_cursor_update(struct drm_plane *_plane,
 
 		if (!IS_ENABLED(CONFIG_PREEMPT_RT))
 			local_irq_disable();
+#ifndef I915
+		else
+			migrate_disable();
+#endif
 
 		intel_vblank_evade(&evade);
 
-		drm_crtc_vblank_put(&crtc->base);
+		vblanked = true;
 	} else {
 		if (!IS_ENABLED(CONFIG_PREEMPT_RT))
 			local_irq_disable();
+#ifndef I915
+		else
+			migrate_disable();
+#endif
 	}
 
 	if (new_plane_state->uapi.visible) {
@@ -939,6 +948,10 @@ intel_legacy_cursor_update(struct drm_plane *_plane,
 
 	if (!IS_ENABLED(CONFIG_PREEMPT_RT))
 		local_irq_enable();
+#ifndef I915
+	else
+		migrate_enable();
+#endif
 
 	intel_psr_unlock(crtc_state);
 
@@ -955,6 +968,9 @@ intel_legacy_cursor_update(struct drm_plane *_plane,
 		intel_plane_unpin_fb(old_plane_state);
 	}
 
+	if (vblanked)
+		drm_crtc_vblank_put(&crtc->base);
+
 out_free:
 	if (new_crtc_state)
 		intel_crtc_destroy_state(&crtc->base, &new_crtc_state->uapi);
diff --git a/drivers/gpu/drm/i915/display/intel_dmc.c b/drivers/gpu/drm/i915/display/intel_dmc.c
index be6d37ea1139a..239b6565105ea 100644
--- a/drivers/gpu/drm/i915/display/intel_dmc.c
+++ b/drivers/gpu/drm/i915/display/intel_dmc.c
@@ -604,7 +604,7 @@ static void dmc_load_program(struct intel_display *display, enum intel_dmc_id dm
 
 	disable_all_event_handlers(display, dmc_id);
 
-	preempt_disable();
+	migrate_disable();
 
 	for (i = 0; i < dmc->dmc_info[dmc_id].dmc_fw_size; i++) {
 		intel_de_write_fw(display,
@@ -612,7 +612,7 @@ static void dmc_load_program(struct intel_display *display, enum intel_dmc_id dm
 				  dmc->dmc_info[dmc_id].payload[i]);
 	}
 
-	preempt_enable();
+	migrate_enable();
 
 	dmc_load_mmio(display, dmc_id);
 }
diff --git a/drivers/gpu/drm/i915/display/intel_vblank.c b/drivers/gpu/drm/i915/display/intel_vblank.c
index 7826f29619a14..6576088a6c6d8 100644
--- a/drivers/gpu/drm/i915/display/intel_vblank.c
+++ b/drivers/gpu/drm/i915/display/intel_vblank.c
@@ -387,7 +387,7 @@ static bool i915_get_crtc_scanoutpos(struct drm_crtc *_crtc,
 	intel_vblank_section_enter_irqf(display, &irqflags);
 
 	if (IS_ENABLED(CONFIG_PREEMPT_RT))
-		preempt_disable();
+		migrate_disable();
 
 	/* Get optional system timestamp before query. */
 	if (stime)
@@ -452,7 +452,7 @@ static bool i915_get_crtc_scanoutpos(struct drm_crtc *_crtc,
 		*etime = ktime_get();
 
 	if (IS_ENABLED(CONFIG_PREEMPT_RT))
-		preempt_enable();
+		migrate_enable();
 
 	intel_vblank_section_exit_irqf(display, irqflags);
 
@@ -763,11 +763,18 @@ int intel_vblank_evade(struct intel_vblank_evade_ctx *evade)
 
 		if (!IS_ENABLED(CONFIG_PREEMPT_RT))
 			local_irq_enable();
+#ifndef I915
+		else
+			migrate_enable();
+#endif
 
 		timeout = schedule_timeout(timeout);
-
 		if (!IS_ENABLED(CONFIG_PREEMPT_RT))
 			local_irq_disable();
+#ifndef I915
+		else
+			migrate_disable();
+#endif
 	}
 
 	finish_wait(wq, &wait);
-- 
2.51.0


  parent reply	other threads:[~2025-10-21 12:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 1/5] drm/xe: Bump xe_device_l2_flush even higher Maarten Lankhorst
2025-10-21 12:43 ` [FOR CI 2/5] drm/i915: Use preempt_disable/enable_rt() where recommended 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-21 12:43 ` Maarten Lankhorst [this message]
2025-10-21 12:43 ` [FOR CI 5/5] [FOR-CI] PREEMPT_RT injection Maarten Lankhorst
2025-10-21 15:08 ` ✗ CI.checkpatch: warning for drm/xe/display: Disable migration for the critical Patchwork
2025-10-21 15:08 ` ✗ CI.KUnit: failure " Patchwork

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=20251021124309.130121-5-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