From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maarten Lankhorst <dev@lankhorst.se>
Cc: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 10/10] drm/i915/display: Do not take uncore lock in i915_get_vblank_counter
Date: Fri, 10 Jul 2026 17:19:12 +0300 [thread overview]
Message-ID: <alD_YJbOxdRUJTQZ@intel.com> (raw)
In-Reply-To: <20260702072154.171324-11-dev@lankhorst.se>
On Thu, Jul 02, 2026 at 09:21:53AM +0200, Maarten Lankhorst wrote:
> This fixes a lockdep splat that occurs in the code that should be run
> with interrupts disabled. The uncore and DMC locks should not be taken
> and released repeatedly in a timing sensitive path.
>
> Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
> ---
> drivers/gpu/drm/i915/display/intel_de.h | 8 ++++++
> drivers/gpu/drm/i915/display/intel_vblank.c | 4 +--
> drivers/gpu/drm/i915/intel_uncore.h | 26 +++++++++++++------
> .../drm/xe/compat-i915-headers/intel_uncore.h | 7 +++++
> 4 files changed, 35 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_de.h b/drivers/gpu/drm/i915/display/intel_de.h
> index 1029790194296..497a308322847 100644
> --- a/drivers/gpu/drm/i915/display/intel_de.h
> +++ b/drivers/gpu/drm/i915/display/intel_de.h
> @@ -65,6 +65,14 @@ intel_de_read64_2x32(struct intel_display *display, intel_reg_t reg)
> return (u64)upper << 32 | lower;
> }
>
> +static inline u64
> +intel_de_read64_2x32_fw(struct intel_display *display,
> + i915_reg_t lower_reg, i915_reg_t upper_reg)
> +{
> + return intel_uncore_read64_2x32_fw(__to_uncore(display),
> + lower_reg, upper_reg);
> +}
> +
> static inline void
> intel_de_posting_read(struct intel_display *display, intel_reg_t reg)
> {
> diff --git a/drivers/gpu/drm/i915/display/intel_vblank.c b/drivers/gpu/drm/i915/display/intel_vblank.c
> index c0cc0a4c25dbe..5ca22899055d7 100644
> --- a/drivers/gpu/drm/i915/display/intel_vblank.c
> +++ b/drivers/gpu/drm/i915/display/intel_vblank.c
> @@ -109,8 +109,8 @@ u32 i915_get_vblank_counter(struct drm_crtc *crtc)
> * we get a low value that's stable across two reads of the high
> * register.
> */
> - frame = intel_de_read64_2x32_volatile(display, PIPEFRAMEPIXEL(display, pipe),
> - PIPEFRAME(display, pipe));
> + frame = intel_de_read64_2x32_fw(display, PIPEFRAMEPIXEL(display, pipe),
> + PIPEFRAME(display, pipe));
This is the only user of intel_de_read64_2x32_volatile() and it
doesn't need any locking/wakelocks/etc so we should just convert
intel_de_read64_2x32_volatile() into intel_de_read64_2x32_volatile_fw().
And we should just skip the uncore dependency (so that we'll have one
less thing to worry about later) so I'd just implement it directly in
intel_de.[ch] in terms of intel_de_read_fw().
>
> pixel = frame & PIPE_PIXEL_MASK;
> frame = (frame >> PIPE_FRAME_LOW_SHIFT) & 0xffffff;
> diff --git a/drivers/gpu/drm/i915/intel_uncore.h b/drivers/gpu/drm/i915/intel_uncore.h
> index fafc2ca9a2376..507398a562649 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.h
> +++ b/drivers/gpu/drm/i915/intel_uncore.h
> @@ -449,13 +449,28 @@ static inline void intel_uncore_rmw_fw(struct intel_uncore *uncore,
> intel_uncore_write_fw(uncore, reg, val);
> }
>
> +static inline u64
> +intel_uncore_read64_2x32_fw(struct intel_uncore *uncore,
> + i915_reg_t lower_reg, i915_reg_t upper_reg)
> +{
> + u32 upper, lower, old_upper, loop = 0;
> + upper = intel_uncore_read_fw(uncore, upper_reg);
> + do {
> + old_upper = upper;
> + lower = intel_uncore_read_fw(uncore, lower_reg);
> + upper = intel_uncore_read_fw(uncore, upper_reg);
> + } while (upper != old_upper && loop++ < 2);
> +
> + return (u64)upper << 32 | lower;
> +}
> +
> static inline u64
> intel_uncore_read64_2x32(struct intel_uncore *uncore,
> i915_reg_t lower_reg, i915_reg_t upper_reg)
> {
> - u32 upper, lower, old_upper, loop = 0;
> enum forcewake_domains fw_domains;
> unsigned long flags;
> + u64 ret;
>
> fw_domains = intel_uncore_forcewake_for_reg(uncore, lower_reg,
> FW_REG_READ);
> @@ -466,17 +481,12 @@ intel_uncore_read64_2x32(struct intel_uncore *uncore,
> spin_lock_irqsave(&uncore->lock, flags);
> intel_uncore_forcewake_get__locked(uncore, fw_domains);
>
> - upper = intel_uncore_read_fw(uncore, upper_reg);
> - do {
> - old_upper = upper;
> - lower = intel_uncore_read_fw(uncore, lower_reg);
> - upper = intel_uncore_read_fw(uncore, upper_reg);
> - } while (upper != old_upper && loop++ < 2);
> + ret = intel_uncore_read64_2x32_fw(uncore, lower_reg, upper_reg);
>
> intel_uncore_forcewake_put__locked(uncore, fw_domains);
> spin_unlock_irqrestore(&uncore->lock, flags);
>
> - return (u64)upper << 32 | lower;
> + return ret;
> }
>
> static inline int intel_uncore_write_and_verify(struct intel_uncore *uncore,
> diff --git a/drivers/gpu/drm/xe/compat-i915-headers/intel_uncore.h b/drivers/gpu/drm/xe/compat-i915-headers/intel_uncore.h
> index 08d7ab9336725..764bc94044537 100644
> --- a/drivers/gpu/drm/xe/compat-i915-headers/intel_uncore.h
> +++ b/drivers/gpu/drm/xe/compat-i915-headers/intel_uncore.h
> @@ -74,6 +74,13 @@ intel_uncore_read64_2x32(struct intel_uncore *uncore,
> return (u64)upper << 32 | lower;
> }
>
> +static inline u64
> +intel_uncore_read64_2x32_fw(struct intel_uncore *uncore,
> + i915_reg_t i915_lower_reg, i915_reg_t i915_upper_reg)
> +{
> + return intel_uncore_read64_2x32(uncore, i915_lower_reg, i915_upper_reg);
> +}
> +
> static inline void intel_uncore_posting_read(struct intel_uncore *uncore,
> i915_reg_t i915_reg)
> {
> --
> 2.53.0
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2026-07-10 14:19 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 7:21 [PATCH 00/10] drm/intel/display: Changes required to make vblank evasion PREEMPT_RT safe Maarten Lankhorst
2026-07-02 7:21 ` [PATCH 01/10] drm/vblank_work: Add methods to schedule vblank_work in 2 stages Maarten Lankhorst
2026-07-02 7:32 ` sashiko-bot
2026-07-02 7:21 ` [PATCH 02/10] drm/vblank: Add a 2-stage version of drm_crtc_arm_vblank_event Maarten Lankhorst
2026-07-02 7:35 ` sashiko-bot
2026-07-02 7:21 ` [PATCH 03/10] drm/intel/display: Make intel_crtc_arm_vblank_event static Maarten Lankhorst
2026-07-10 14:20 ` Ville Syrjälä
2026-07-02 7:21 ` [PATCH 04/10] drm/intel/display: Convert vblank event handling to 2-stage arming Maarten Lankhorst
2026-07-02 7:37 ` sashiko-bot
2026-07-02 7:21 ` [PATCH 05/10] drm/i915/display: Move vblank put until after critical section Maarten Lankhorst
2026-07-02 7:34 ` sashiko-bot
2026-07-02 7:21 ` [PATCH 06/10] drm/i915/display: Remove locking from intel_vblank_evade " Maarten Lankhorst
2026-07-02 7:36 ` sashiko-bot
2026-07-02 7:21 ` [PATCH 07/10] drm/i915/display: Handle vlv dsi workaround in scanline_in_safe_range too Maarten Lankhorst
2026-07-02 7:30 ` sashiko-bot
2026-07-02 7:21 ` [PATCH 08/10] drm/i915: Use preempt_disable/enable_rt() where recommended Maarten Lankhorst
2026-07-02 7:36 ` sashiko-bot
2026-07-02 7:21 ` [PATCH 09/10] drm/i915/display: Make get_vblank_counter use intel_de_read_fw() Maarten Lankhorst
2026-07-02 7:43 ` sashiko-bot
2026-07-10 14:34 ` Ville Syrjälä
2026-07-02 7:21 ` [PATCH 10/10] drm/i915/display: Do not take uncore lock in i915_get_vblank_counter Maarten Lankhorst
2026-07-10 14:19 ` Ville Syrjälä [this message]
2026-07-02 7:56 ` ✗ CI.checkpatch: warning for drm/intel/display: Changes required to make vblank evasion PREEMPT_RT safe Patchwork
2026-07-02 7:58 ` ✓ CI.KUnit: success " Patchwork
2026-07-02 8:33 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-02 10:04 ` ✓ i915.CI.BAT: " Patchwork
2026-07-03 2:09 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-07-03 2:17 ` ✗ i915.CI.Full: " Patchwork
2026-07-10 14:43 ` [PATCH 00/10] " Ville Syrjälä
2026-07-13 10:59 ` 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=alD_YJbOxdRUJTQZ@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=dev@lankhorst.se \
--cc=dri-devel@lists.freedesktop.org \
--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 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.