intel-xe.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maarten Lankhorst <dev@lankhorst.se>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/display: Make intel_crtc_get_vblank_counter safe on PREEMPT_RT
Date: Wed, 10 Sep 2025 19:03:30 +0300	[thread overview]
Message-ID: <aMGhUneEgBA11Dyl@intel.com> (raw)
In-Reply-To: <20250829131701.15607-2-dev@lankhorst.se>

On Fri, Aug 29, 2025 at 03:17:02PM +0200, Maarten Lankhorst wrote:
> drm_crtc_accurate_vblank_count takes a spinlock, which we should avoid
> in tracepoints and debug functions.
> 
> This also prevents taking the spinlock 2x during the critical
> section of pipe updates for DSI updates.
> 
> Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
> ---
>  drivers/gpu/drm/i915/display/intel_crtc.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c b/drivers/gpu/drm/i915/display/intel_crtc.c
> index a187db6df2d36..cee00aa2c79de 100644
> --- a/drivers/gpu/drm/i915/display/intel_crtc.c
> +++ b/drivers/gpu/drm/i915/display/intel_crtc.c
> @@ -84,8 +84,12 @@ u32 intel_crtc_get_vblank_counter(struct intel_crtc *crtc)
>  	if (!crtc->active)
>  		return 0;
>  
> -	if (!vblank->max_vblank_count)
> -		return (u32)drm_crtc_accurate_vblank_count(&crtc->base);
> +	if (!vblank->max_vblank_count) {
> +		if (!IS_ENABLED(CONFIG_PREEMPT_RT))

The ! seems rather pointless here when you could just swap the two
statements instead.

Could also use a comment to remind us why we're avoiding the use
of the correct function with RT kernels.

With that
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> +			return (u32)drm_crtc_accurate_vblank_count(&crtc->base);
> +		else
> +			return (u32)drm_crtc_vblank_count(&crtc->base);
> +	}
>  
>  	return crtc->base.funcs->get_vblank_counter(&crtc->base);
>  }
> -- 
> 2.50.0

-- 
Ville Syrjälä
Intel

      parent reply	other threads:[~2025-09-10 16:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-29 13:17 [PATCH] drm/i915/display: Make intel_crtc_get_vblank_counter safe on PREEMPT_RT Maarten Lankhorst
2025-08-29 14:01 ` ✓ CI.KUnit: success for " Patchwork
2025-08-29 14:45 ` ✓ Xe.CI.BAT: " Patchwork
2025-08-30  0:58 ` ✗ Xe.CI.Full: failure " Patchwork
2025-09-10 16:03 ` Ville Syrjälä [this message]

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=aMGhUneEgBA11Dyl@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dev@lankhorst.se \
    --cc=intel-gfx@lists.freedesktop.org \
    --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;
as well as URLs for NNTP newsgroup(s).