Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] drm/i915/display: hold frontbuffer ref across dirtyfb fence callback
       [not found] <20261126060818.1654-1-luob87709@gmail.com>
@ 2026-11-26  6:20 ` sashiko-bot
  0 siblings, 0 replies; only message in thread
From: sashiko-bot @ 2026-11-26  6:20 UTC (permalink / raw)
  To: Bin Luo (University of Electronic Science and Technology of China)
  Cc: intel-gfx, intel-xe, dri-devel

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-26  6:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261126060818.1654-1-luob87709@gmail.com>
2026-11-26  6:20 ` [PATCH] drm/i915/display: hold frontbuffer ref across dirtyfb fence callback sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox