All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Thomas Gleixner <tglx@linutronix.de>,
	Mike Galbraith <umgwanakikbuti@gmail.com>,
	Mario Kleiner <mario.kleiner.de@gmail.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH 1/8] drm/i915: Use preempt_disable/enable_rt() where recommended
Date: Tue,  5 Oct 2021 17:00:39 +0200	[thread overview]
Message-ID: <20211005150046.1000285-2-bigeasy@linutronix.de> (raw)
In-Reply-To: <20211005150046.1000285-1-bigeasy@linutronix.de>

From: Mike Galbraith <umgwanakikbuti@gmail.com>

Mario Kleiner suggest in commit
  ad3543ede630f ("drm/intel: Push get_scanout_position() timestamping into kms driver.")

a spots where preemption should be disabled on PREEMPT_RT. The
difference is that on PREEMPT_RT the intel_uncore::lock disables neither
preemption nor interrupts and so region remains preemptible.

The area covers only register reads and writes. The part that worries me
is:
- __intel_get_crtc_scanline() the worst case is 100us if no match is
  found.

- intel_crtc_scanlines_since_frame_timestamp() not sure how long this
  may take in the worst case.

It was in the RT queue for a while and nobody complained.
Disable preemption on PREEPMPT_RT during timestamping.

[bigeasy: patch description.]

Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Mike Galbraith <umgwanakikbuti@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/gpu/drm/i915/i915_irq.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 9bc4f4a8e12ec..547347241a47c 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -886,7 +886,8 @@ static bool i915_get_crtc_scanoutpos(struct drm_crtc *_crtc,
 	 */
 	spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
 
-	/* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */
+	if (IS_ENABLED(CONFIG_PREEMPT_RT))
+		preempt_disable();
 
 	/* Get optional system timestamp before query. */
 	if (stime)
@@ -950,7 +951,8 @@ static bool i915_get_crtc_scanoutpos(struct drm_crtc *_crtc,
 	if (etime)
 		*etime = ktime_get();
 
-	/* preempt_enable_rt() should go right here in PREEMPT_RT patchset. */
+	if (IS_ENABLED(CONFIG_PREEMPT_RT))
+		preempt_enable();
 
 	spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
 
-- 
2.33.0


WARNING: multiple messages have this Message-ID (diff)
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Thomas Gleixner <tglx@linutronix.de>,
	Mike Galbraith <umgwanakikbuti@gmail.com>,
	Mario Kleiner <mario.kleiner.de@gmail.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [Intel-gfx] [PATCH 1/8] drm/i915: Use preempt_disable/enable_rt() where recommended
Date: Tue,  5 Oct 2021 17:00:39 +0200	[thread overview]
Message-ID: <20211005150046.1000285-2-bigeasy@linutronix.de> (raw)
In-Reply-To: <20211005150046.1000285-1-bigeasy@linutronix.de>

From: Mike Galbraith <umgwanakikbuti@gmail.com>

Mario Kleiner suggest in commit
  ad3543ede630f ("drm/intel: Push get_scanout_position() timestamping into kms driver.")

a spots where preemption should be disabled on PREEMPT_RT. The
difference is that on PREEMPT_RT the intel_uncore::lock disables neither
preemption nor interrupts and so region remains preemptible.

The area covers only register reads and writes. The part that worries me
is:
- __intel_get_crtc_scanline() the worst case is 100us if no match is
  found.

- intel_crtc_scanlines_since_frame_timestamp() not sure how long this
  may take in the worst case.

It was in the RT queue for a while and nobody complained.
Disable preemption on PREEPMPT_RT during timestamping.

[bigeasy: patch description.]

Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Mike Galbraith <umgwanakikbuti@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/gpu/drm/i915/i915_irq.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 9bc4f4a8e12ec..547347241a47c 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -886,7 +886,8 @@ static bool i915_get_crtc_scanoutpos(struct drm_crtc *_crtc,
 	 */
 	spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
 
-	/* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */
+	if (IS_ENABLED(CONFIG_PREEMPT_RT))
+		preempt_disable();
 
 	/* Get optional system timestamp before query. */
 	if (stime)
@@ -950,7 +951,8 @@ static bool i915_get_crtc_scanoutpos(struct drm_crtc *_crtc,
 	if (etime)
 		*etime = ktime_get();
 
-	/* preempt_enable_rt() should go right here in PREEMPT_RT patchset. */
+	if (IS_ENABLED(CONFIG_PREEMPT_RT))
+		preempt_enable();
 
 	spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
 
-- 
2.33.0


  reply	other threads:[~2021-10-05 15:01 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05 15:00 [PATCH 0/8] drm/i915: PREEMPT_RT related fixups Sebastian Andrzej Siewior
2021-10-05 15:00 ` [Intel-gfx] " Sebastian Andrzej Siewior
2021-10-05 15:00 ` Sebastian Andrzej Siewior [this message]
2021-10-05 15:00   ` [Intel-gfx] [PATCH 1/8] drm/i915: Use preempt_disable/enable_rt() where recommended Sebastian Andrzej Siewior
2021-10-05 15:00 ` [PATCH 2/8] drm/i915: Don't disable interrupts on PREEMPT_RT during atomic updates Sebastian Andrzej Siewior
2021-10-05 15:00   ` [Intel-gfx] " Sebastian Andrzej Siewior
2021-10-06  9:16   ` Ville Syrjälä
2021-10-05 15:00 ` [PATCH 3/8] drm/i915: Disable tracing points on PREEMPT_RT Sebastian Andrzej Siewior
2021-10-05 15:00   ` [Intel-gfx] " Sebastian Andrzej Siewior
2021-10-06  9:34   ` Ville Syrjälä
2021-10-06  9:34     ` [Intel-gfx] " Ville Syrjälä
2021-10-06 10:15     ` Sebastian Andrzej Siewior
2021-10-06 10:15       ` [Intel-gfx] " Sebastian Andrzej Siewior
2021-10-06 16:46       ` Sebastian Andrzej Siewior
2021-10-06 16:46         ` [Intel-gfx] " Sebastian Andrzej Siewior
2021-10-05 15:00 ` [PATCH 4/8] drm/i915: skip DRM_I915_LOW_LEVEL_TRACEPOINTS with NOTRACE Sebastian Andrzej Siewior
2021-10-05 15:00   ` [Intel-gfx] " Sebastian Andrzej Siewior
2021-10-05 15:00 ` [PATCH 5/8] drm/i915/gt: Queue and wait for the irq_work item Sebastian Andrzej Siewior
2021-10-05 15:00   ` [Intel-gfx] " Sebastian Andrzej Siewior
2021-10-05 15:00 ` [PATCH 6/8] drm/i915/gt: Use spin_lock_irq() instead of local_irq_disable() + spin_lock() Sebastian Andrzej Siewior
2021-10-05 15:00   ` [Intel-gfx] " Sebastian Andrzej Siewior
2021-10-05 15:00 ` [PATCH 7/8] drm/i915: Drop the irqs_disabled() check Sebastian Andrzej Siewior
2021-10-05 15:00   ` [Intel-gfx] " Sebastian Andrzej Siewior
2021-10-05 15:00 ` [PATCH 8/8] drm/i915: Don't disable interrupts and pretend a lock as been acquired in __timeline_mark_lock() Sebastian Andrzej Siewior
2021-10-05 15:00   ` [Intel-gfx] " Sebastian Andrzej Siewior
2021-10-05 19:16   ` Peter Zijlstra
2021-10-05 19:16     ` [Intel-gfx] " Peter Zijlstra
2021-10-06  6:58     ` Sebastian Andrzej Siewior
2021-10-06  6:58       ` [Intel-gfx] " Sebastian Andrzej Siewior
2021-10-08  6:21   ` [drm/i915] 511e5fb0c3: WARNING:suspicious_RCU_usage kernel test robot
2021-10-08  6:21     ` kernel test robot
2021-10-08  6:21     ` [Intel-gfx] " kernel test robot
2021-10-05 16:12 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: PREEMPT_RT related fixups Patchwork
2021-10-05 16:48 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2021-10-06 17:41 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915: PREEMPT_RT related fixups. (rev2) 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=20211005150046.1000285-2-bigeasy@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=mario.kleiner.de@gmail.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=tglx@linutronix.de \
    --cc=umgwanakikbuti@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.