Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: sashiko-reviews@lists.linux.dev
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 06/13] drm/i915/dpt: Compute DPT size in the DPT code
Date: Wed, 11 Nov 2026 14:39:27 +0200	[thread overview]
Message-ID: <avRh_5mkErMktGqN@intel.com> (raw)
In-Reply-To: <sashiko-outbox-208882@kernel.org>

On Wed, Nov 11, 2026 at 11:31:06AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found no new issues
> in this patch, but noticed 1 related pre-existing issue it does not
> introduce:
> - [High] drm/xe/display: double BO unpin on __intel_fbdev_fb_alloc()
>   error path [1]
> --
> 
> commit ae1435739339ed58396679163558aae13db1d253
> Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> drm/i915/dpt: Compute DPT size in the DPT code
> 
> This commit passes the GTT view instead of a precomputed size to
> intel_parent_dpt_create() so that the DPT code computes the DPT size for
> both normal and remapped views.
> 
> > diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
> > index b3344e3f187fb..35f1d5dd31d7d 100644
> > --- a/drivers/gpu/drm/i915/display/intel_fb.c
> > +++ b/drivers/gpu/drm/i915/display/intel_fb.c
> > @@ -2275,13 +2275,15 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
> >  
> >  	if (intel_fb_uses_dpt(fb)) {
> >  		struct drm_gem_object *obj = intel_fb_bo(&intel_fb->base);
> > +		const struct intel_gtt_view *view;
> >  		struct intel_dpt *dpt;
> > -		size_t size = 0;
> >  
> >  		if (intel_fb_needs_pot_stride_remap(intel_fb))
> > -			size = intel_remapped_info_size(&intel_fb->remapped_view.gtt.remapped);
> > +			view = &intel_fb->remapped_view.gtt;
> > +		else
> > +			view = &intel_fb->normal_view.gtt;
> >  
> > -		dpt = intel_parent_dpt_create(display, obj, size);
> > +		dpt = intel_parent_dpt_create(display, obj, view);
> >  		if (IS_ERR(dpt)) {
> >  			drm_dbg_kms(display->drm, "failed to create DPT\n");
> >  			ret = PTR_ERR(dpt);
> 
> [Severity: High]
> This problem wasn't introduced by this patch, but can failing in
> intel_framebuffer_init() after intel_bo_framebuffer_init() cause a double
> BO unpin on Xe when called from __intel_fbdev_fb_alloc() [1]?
> 
> In __intel_fbdev_fb_alloc(), intel_bo_fbdev_create() allocates the BO via
> xe_bo_create_pin_map_novm() with XE_BO_FLAG_PINNED set and a pin count of
> 1, and xe_display_bo_framebuffer_init() only takes a reference without
> pinning it again.  If a later step in intel_framebuffer_init() fails and
> jumps to err_bo_framebuffer_fini, xe_display_bo_framebuffer_fini() sees
> XE_BO_FLAG_PINNED and unpins the BO:
> 
> drivers/gpu/drm/xe/display/xe_display_bo.c:xe_display_bo_framebuffer_fini() {
> 	struct xe_bo *bo = gem_to_xe_bo(obj);
> 
> 	if (bo->flags & XE_BO_FLAG_PINNED) {
> 		/* Unpin our kernel fb first */
> 		xe_bo_lock(bo, false);
> 		xe_bo_unpin(bo);
> 		xe_bo_unlock(bo);
> 	}
> 	xe_bo_put(bo);
> }
> 
> When control returns to __intel_fbdev_fb_alloc(), error handling calls
> intel_bo_fbdev_destroy() -> xe_display_bo_fbdev_destroy() ->
> xe_bo_unpin_map_no_vm(), which unpins the BO a second time, triggering
> assertions in xe_bo_unpin() and underflowing bo->pin_count in
> ttm_bo_unpin().

Yes, the xe pin_map() stuff is broken by design. I've mentioned it
before, and I think the correct way to fix it is by making it a
custom object type in xe, and have the object destructor itself do
the needed cleanup.

> 
> [1] https://sashiko.dev/#/bug/linux-227b0044-5f2a-4c7c-81e6-93b67cb4f477
> 
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20261111112007.16790-1-ville.syrjala@linux.intel.com?part=6

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2026-11-11 12:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 11:19 [PATCH 00/13] drm/i915/dpt: Optimize i915 DPT Ville Syrjala
2026-11-11 11:19 ` [PATCH 01/13] drm/i915: Bump surface alignment to 32k on MTL for async flips Ville Syrjala
2026-11-11 11:19 ` [PATCH 02/13] drm/i915/fb: Fix error handling onion in intel_framebuffer_init() Ville Syrjala
2026-11-11 11:19 ` [PATCH 03/13] drm/i915/dpt: Stop allocation DPTs from stolen Ville Syrjala
2026-11-11 11:19 ` [PATCH 04/13] drm/i915/fb_pin: Remove overzealous vma NULL checks Ville Syrjala
2026-11-11 11:19 ` [PATCH 05/13] drm/i915: intel_{remapped, rotation}_info_size() into intel/gtt_view_types.h Ville Syrjala
2026-11-11 11:20 ` [PATCH 06/13] drm/i915/dpt: Compute DPT size in the DPT code Ville Syrjala
2026-11-11 11:31   ` sashiko-bot
2026-11-11 12:39     ` Ville Syrjälä [this message]
2026-11-11 11:20 ` [PATCH 07/13] drm/i915/vma: Extract intel_gtt_view_compare() Ville Syrjala
2026-11-11 11:20 ` [PATCH 08/13] drm/i915/vma: Introduce i915_vma_lookup() Ville Syrjala
2026-11-11 11:20 ` [PATCH 09/13] drm/i915/dpt: Make i915_dpt_{suspend, resume}() internal to i915 Ville Syrjala
2026-11-11 11:20 ` [PATCH 10/13] drm/i915/dpt: Cache DPTs in the gem object Ville Syrjala
2026-11-11 11:20 ` [PATCH 11/13] drm/i915/dpt: Hide the DPT even more from the display code Ville Syrjala
2026-11-11 11:20 ` [PATCH 12/13] drm/i915/dpt: Remove dpt->vma Ville Syrjala
2026-11-11 11:20 ` [PATCH 13/13] drm/i915/dpt: s/struct intel_dpt/struct i915_dpt/ Ville Syrjala
2026-11-11 12:28 ` ✗ CI.checkpatch: warning for drm/i915/dpt: Optimize i915 DPT Patchwork
2026-11-11 12:30 ` ✓ CI.KUnit: success " Patchwork
2026-11-11 13:05 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-11 20:29 ` ✓ Xe.CI.FULL: " 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=avRh_5mkErMktGqN@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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