Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ville Syrjala" <ville.syrjala@linux.intel.com>
Cc: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 12/13] drm/i915/dsb: Add tracepoints for DSB commit
Date: Wed, 09 Sep 2026 16:34:49 +0000	[thread overview]
Message-ID: <20260909163450.000EE1F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260909161730.12969-13-ville.syrjala@linux.intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Calling `intel_get_crtc_scanline()` inside the tracepoint's `TP_fast_assign` block acquires a sleeping lock while in atomic context, causing a kernel panic on PREEMPT_RT.
- [Medium] The `intel_dsb_done` tracepoint is conditionally called only when a userspace vblank event is present, leading to unbalanced commit/done trace events for background updates.
--

commit b6804a525207ea31e82f537e553534efcdaa5b8f
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>

drm/i915/dsb: Add tracepoints for DSB commit
    
This commit adds new tracepoints intel_dsb_commit and intel_dsb_done to track
when the display state buffer performs operations on the hardware.

> diff --git a/drivers/gpu/drm/i915/display/intel_display_trace.h b/drivers/gpu/drm/i915/display/intel_display_trace.h
> index 504d105935bc0..06cf662931fe3 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_trace.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_trace.h
[ ... ]
> @@ -681,6 +682,56 @@ TRACE_EVENT(intel_fbc_nuke,
>  		      __entry->frame, __entry->scanline)
>  );
>  
> +TRACE_EVENT(intel_dsb_commit,
> +	    TP_PROTO(struct intel_crtc *crtc, enum intel_dsb_id dsb_id),
> +	    TP_ARGS(crtc, dsb_id),
> +
> +	    TP_STRUCT__entry(
> +			     __string(dev, __dev_name_kms(crtc))
> +			     __field(char, pipe_name)
> +			     __field(u32, dsb_id)
> +			     __field(u32, frame)
> +			     __field(u32, scanline)
> +			     ),
> +
> +	    TP_fast_assign(
> +			   __assign_str(dev);
> +			   __entry->pipe_name = pipe_name(crtc->pipe);
> +			   __entry->dsb_id = dsb_id;
> +			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
> +			   __entry->scanline = intel_get_crtc_scanline(crtc);

[Severity: High]
Does calling intel_get_crtc_scanline() from within a TP_fast_assign block
cause issues on preempt-rt kernels?

When this tracepoint is active, TP_fast_assign executes in an atomic
context (RCU read-side critical section with preemption disabled).
intel_get_crtc_scanline() eventually acquires uncore->lock:

intel_get_crtc_scanline()
  intel_vblank_section_enter()
    uncore->lock (spinlock_t)

On preempt-rt, spinlock_t becomes a sleepable rt_mutex, which will cause a
scheduling while atomic panic.

> +			   ),
> +
> +	    TP_printk("dev %s, pipe %c, DSB %d, frame=%u, scanline=%u",
> +		      __get_str(dev), __entry->pipe_name, __entry->dsb_id,
> +		      __entry->frame, __entry->scanline)
> +);
> +
> +TRACE_EVENT(intel_dsb_done,
> +	    TP_PROTO(struct intel_crtc *crtc, enum intel_dsb_id dsb_id),
> +	    TP_ARGS(crtc, dsb_id),
> +
> +	    TP_STRUCT__entry(
> +			     __string(dev, __dev_name_kms(crtc))
> +			     __field(char, pipe_name)
> +			     __field(u32, dsb_id)
> +			     __field(u32, frame)
> +			     __field(u32, scanline)
> +			     ),
> +
> +	    TP_fast_assign(
> +			   __assign_str(dev);
> +			   __entry->pipe_name = pipe_name(crtc->pipe);
> +			   __entry->dsb_id = dsb_id;
> +			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
> +			   __entry->scanline = intel_get_crtc_scanline(crtc);

[Severity: High]
This appears to have the same preempt-rt issue as the intel_dsb_commit
tracepoint where it acquires a sleeping lock while in atomic context.

> +			   ),
> +
> +	    TP_printk("dev %s, pipe %c, DSB %d, frame=%u, scanline=%u",
> +		      __get_str(dev), __entry->pipe_name, __entry->dsb_id,
> +		      __entry->frame, __entry->scanline)
> +);
> +
[ ... ]
> diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c b/drivers/gpu/drm/i915/display/intel_dsb.c
> index 8e01e1eed291e..299d778520a22 100644
> --- a/drivers/gpu/drm/i915/display/intel_dsb.c
> +++ b/drivers/gpu/drm/i915/display/intel_dsb.c
[ ... ]
> @@ -1124,6 +1127,8 @@ void intel_dsb_irq_handler(struct intel_display *display,
>  		spin_lock(&display->drm->event_lock);
>  
>  		if (crtc->dsb_event) {
> +			trace_intel_dsb_done(crtc, dsb_id);
> +

[Severity: Medium]
Will this lead to unbalanced commit/done trace events for background updates?

The trace_intel_dsb_done() tracepoint is conditionally called only when a
userspace vblank event is present. If a commit completes in hardware
without an associated vblank event, the irq handler will skip emitting the
completion tracepoint.

>  			/*
>  			 * Update vblank counter/timestamp in case it
>  			 * hasn't been done yet for this frame.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260909161730.12969-1-ville.syrjala@linux.intel.com?part=12

  reply	other threads:[~2026-09-09 16:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09 16:17 [PATCH v2 00/13] drm/i915: Some DSB/flipq stuff Ville Syrjala
2026-09-09 16:17 ` [PATCH v2 01/13] drm/i915: Give up on DSB/flip queue if we fail to allocate the color DSB buffer Ville Syrjala
2026-09-09 16:17 ` [PATCH v2 02/13] drm/i915: Check use_flipq in intel_crtc_needs_vblank_work() Ville Syrjala
2026-09-09 16:17 ` [PATCH v2 03/13] drm/i915: Don't initialize flip queue on pre-LNL Ville Syrjala
2026-09-09 16:17 ` [PATCH v2 04/13] drm/i915: Warn about use_flip==true in MMIO commit codepaths Ville Syrjala
2026-09-09 16:17 ` [PATCH v2 05/13] drm/i915: Refine vblank evasion DSB check Ville Syrjala
2026-09-09 16:17 ` [PATCH v2 06/13] drm/i915: Make intel_crtc_needs_vblank_work() easier on the eye Ville Syrjala
2026-09-09 16:17 ` [PATCH v2 07/13] drm/i915: Extract intel_dsb_supported() Ville Syrjala
2026-09-09 16:17 ` [PATCH v2 08/13] drm/i915: Use intel_dsb_supported() to determine 'use_dsb' Ville Syrjala
2026-09-09 16:17 ` [PATCH v2 09/13] drm/i915: Extract commit_dsb_max_cmds() Ville Syrjala
2026-09-09 16:17 ` [PATCH v2 10/13] drm/i915: Introduce enum intel_commit_type Ville Syrjala
2026-09-09 16:17 ` [PATCH v2 11/13] drm/i915: Carve intel_atomic_commit_type() up a bit Ville Syrjala
2026-09-09 16:17 ` [PATCH v2 12/13] drm/i915/dsb: Add tracepoints for DSB commit Ville Syrjala
2026-09-09 16:34   ` sashiko-bot [this message]
2026-09-10 11:23     ` Ville Syrjälä
2026-09-09 16:17 ` [PATCH v2 13/13] drm/i915/dsb: Add tracepoints for flip queue Ville Syrjala
2026-09-09 17:50 ` ✓ i915.CI.BAT: success for drm/i915: Some DSB/flipq stuff (rev2) Patchwork
2026-09-10 10:56 ` ✗ i915.CI.Full: 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=20260909163450.000EE1F00898@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=ville.syrjala@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox