All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Bin Luo (University of Electronic Science and Technology of
	China)" <luob87709@gmail.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/display: hold frontbuffer ref across dirtyfb fence callback
Date: Thu, 26 Nov 2026 06:20:55 +0000	[thread overview]
Message-ID: <sashiko-outbox-234834@kernel.org> (raw)
In-Reply-To: <20261126060818.1654-1-luob87709@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/i915: atomic frontbuffer put in
  intel_user_framebuffer_fence_wake()
--

commit 6668699993fc94a934753276eb08e4a83ae0ca89
Author: luob87709@gmail.com <luob87709@gmail.com>

drm/i915/display: hold frontbuffer ref across dirtyfb fence callback

This commit takes a frontbuffer reference before registering the dirtyfb
dma_fence callback and drops it in intel_user_framebuffer_fence_wake()
after queuing the flush.

> diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
> index 2c63aeefaea88..a0af4166c1d33 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb.c
> +++ b/drivers/gpu/drm/i915/display/intel_fb.c
> @@ -2184,8 +2184,10 @@ static void intel_user_framebuffer_fence_wake(struct dma_fence *dma,
>  					      struct dma_fence_cb *data)
>  {
>  	struct frontbuffer_fence_cb *cb = container_of(data, typeof(*cb), base);
> +	struct intel_frontbuffer *front = cb->front;
>  
> -	intel_frontbuffer_queue_flush(cb->front);
> +	intel_frontbuffer_queue_flush(front);
> +	intel_parent_frontbuffer_put(front->display, front);
>  	kfree(cb);
>  	dma_fence_put(dma);
>  }

[Severity: High]
Can intel_parent_frontbuffer_put() here drop the final reference to front
from atomic dma_fence signaling context?

intel_user_framebuffer_fence_wake() runs under fence->lock with interrupts
disabled.  If the framebuffer was destroyed before the fence signaled and
front->flush_work finishes on another CPU first,
intel_parent_frontbuffer_put() drops the last reference:

CPU0 (<hardirq>)                  CPU1 (kworker)
intel_user_framebuffer_fence_wake()
  intel_frontbuffer_queue_flush()
    intel_parent_frontbuffer_ref()
    schedule_work(&front->flush_work)
                                  intel_frontbuffer_flush_work()
                                    ...
                                    intel_parent_frontbuffer_put()
  intel_parent_frontbuffer_put()
    frontbuffer_release()  <-- final put in atomic context

On Xe, frontbuffer_release() calls drm_gem_object_put(front->obj) ->
xe_gem_object_free() -> ttm_bo_fini() -> ttm_bo_release() ->
xe_ttm_bo_destroy(), which acquires sleeping mutexes such as
xe->mem_access.vram_userfault.lock in atomic context.  On i915,
i915_gem_object_frontbuffer_put() and frontbuffer_release() ->
i915_ggtt_clear_scanout() acquire i915->frontbuffer_lock and obj->vma.lock
with plain spin_lock(), which can deadlock if the fence signals from an
interrupt that preempted a holder of either lock on the same CPU.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126060818.1654-1-luob87709@gmail.com?part=1

  reply	other threads:[~2026-11-26  6:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  6:08 [PATCH] drm/i915/display: hold frontbuffer ref across dirtyfb fence callback Bin Luo (University of Electronic Science and Technology of China)
2026-11-26  6:20 ` sashiko-bot [this message]
2026-11-30 15:50 ` ✗ LGCI.VerificationFailed: failure for drm/i915/display: hold frontbuffer ref across dirtyfb fence callback (rev2) Patchwork
2026-11-30 18:28 ` 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=sashiko-outbox-234834@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=luob87709@gmail.com \
    --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 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.