All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	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>
Subject: Re: [Intel-gfx] [PATCH 2/8] drm/i915: Don't disable interrupts on PREEMPT_RT during atomic updates
Date: Wed, 6 Oct 2021 12:16:45 +0300	[thread overview]
Message-ID: <YV1pfUZlbGYfe7d9@intel.com> (raw)
In-Reply-To: <20211005150046.1000285-3-bigeasy@linutronix.de>

On Tue, Oct 05, 2021 at 05:00:40PM +0200, Sebastian Andrzej Siewior wrote:
> 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]

I have my doubts about meething the deadlines here.
CONFIG_DRM_I915_DEBUG_VBLANK_EVADE should scream a bunch if it
looks like we're missing it.

That said, we already miss the deadline sometimes, esp. with
lockdep and whatnot enabled which makes the locking very expensive.

Also some ideas how to reduce the overhead:
- Try to make the mmio accesses lockless as much s possible
- Reduce the amount of work we do in the critical section

Anyways, RT hasn't really been on anyone's radar so no one
has yet spent significant amount of brain cells on this.

> 
> Signed-off-by: Mike Galbraith <umgwanakikbuti@gmail.com>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  drivers/gpu/drm/i915/display/intel_crtc.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c b/drivers/gpu/drm/i915/display/intel_crtc.c
> index 254e67141a776..7a39029b083f4 100644
> --- a/drivers/gpu/drm/i915/display/intel_crtc.c
> +++ b/drivers/gpu/drm/i915/display/intel_crtc.c
> @@ -425,7 +425,8 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)
>  	 */
>  	intel_psr_wait_for_idle(new_crtc_state);
>  
> -	local_irq_disable();
> +	if (!IS_ENABLED(CONFIG_PREEMPT_RT))
> +		local_irq_disable();
>  
>  	crtc->debug.min_vbl = min;
>  	crtc->debug.max_vbl = max;
> @@ -450,11 +451,13 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)
>  			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);
> @@ -487,7 +490,8 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_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)
> @@ -566,7 +570,8 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state)
>  		new_crtc_state->uapi.event = NULL;
>  	}
>  
> -	local_irq_enable();
> +	if (!IS_ENABLED(CONFIG_PREEMPT_RT))
> +		local_irq_enable();
>  
>  	/* Send VRR Push to terminate Vblank */
>  	intel_vrr_send_push(new_crtc_state);
> -- 
> 2.33.0

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2021-10-06  9:17 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 ` [PATCH 1/8] drm/i915: Use preempt_disable/enable_rt() where recommended Sebastian Andrzej Siewior
2021-10-05 15:00   ` [Intel-gfx] " 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ä [this message]
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=YV1pfUZlbGYfe7d9@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=bigeasy@linutronix.de \
    --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=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.