AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Matthew Brost <matthew.brost@intel.com>
Cc: phasta@kernel.org, alexdeucher@gmail.com, simona.vetter@ffwll.ch,
	tursulin@ursulin.net, dri-devel@lists.freedesktop.org,
	amd-gfx@lists.freedesktop.org
Subject: Re: Independence for dma_fences!
Date: Mon, 3 Nov 2025 12:43:32 +0100	[thread overview]
Message-ID: <2f8a4b6b-4b9e-480b-8ea0-35e9293d0b85@amd.com> (raw)
In-Reply-To: <aQT1lpZJwQmWXGBt@lstrano-desk.jf.intel.com>

On 10/31/25 18:44, Matthew Brost wrote:
>>> Not to derail the conversation, but I noticed that dma-fence-arrays can,
>>> in fact, signal out of order. The issue lies in dma-fence-cb, which
>>> signals the fence using irq_queue_work. Internally, irq_queue_work uses
>>> llist, a LIFO structure. So, if two dma-fence-arrays have all their
>>> fences signaled from a thread, the IRQ work that signals each individual
>>> dma-fence-array will execute out of order.
>>>
>>> We should probably fix this.
>>
>> No we don't. That's what I'm trying to point out all the time.
>>
>> The original idea of sharing the lock was to guarantee that fence signal in order, but that never worked correct even for driver fences.
>>
>> The background is the optimization we do in the signaling fast path. E.g. when dma_fence_is_signaled() is called.
>>
> 
> Ah, yes—I see this now. I was operating under the assumption that fences
> on a timeline must signal in order, but that’s not actually true. What
> is true is that if a fence later on a timeline signals, all prior fences
> are complete (i.e., the underlying hardware condition is met, even if
> the software hasn’t signaled them yet).
> 
> Could we document this somewhere in the dma-fence kernel docs? I can
> take a stab at writing it up if you'd like. This is a fairly confusing
> aspect of dma-fence behavior.

We do have some hints in the documentation about that, but nothing which clearly says "don't expect fences submitted in the order A,B,C to also signal in order A,B,C unless signaling of each is enabled".

Were could we add something like that?

Christian.

> 
> Matt

  reply	other threads:[~2025-11-03 11:43 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13 13:48 Independence for dma_fences! Christian König
2025-10-13 13:48 ` [PATCH 01/15] dma-buf: cleanup dma_fence_describe Christian König
2025-10-14 14:37   ` Tvrtko Ursulin
2025-10-23  3:45     ` Matthew Brost
2025-10-13 13:48 ` [PATCH 02/15] dma-buf: rework stub fence initialisation Christian König
2025-10-14 15:03   ` Tvrtko Ursulin
2025-10-24  7:29   ` Tvrtko Ursulin
2025-10-13 13:48 ` [PATCH 03/15] dma-buf: protected fence ops by RCU Christian König
2025-10-16 18:04   ` Tvrtko Ursulin
2025-10-31 10:35   ` Tvrtko Ursulin
2025-10-13 13:48 ` [PATCH 04/15] dma-buf: detach fence ops on signal Christian König
2025-10-16  8:56   ` Tvrtko Ursulin
2025-10-16 15:57     ` Tvrtko Ursulin
2025-10-23  4:23       ` Matthew Brost
2025-10-23  4:44         ` Matthew Brost
2025-10-30 13:52       ` Christian König
2025-10-31 10:31         ` Tvrtko Ursulin
2025-10-17  9:14   ` Philipp Stanner
2025-10-30 15:05     ` Christian König
2025-10-13 13:48 ` [PATCH 05/15] dma-buf: inline spinlock for fence protection Christian König
2025-10-16  9:26   ` Tvrtko Ursulin
2025-11-03 13:07     ` Philipp Stanner
2025-10-23 18:09   ` Matthew Brost
2025-10-30 15:14     ` Christian König
2025-10-13 13:48 ` [PATCH 06/15] dma-buf: use inline lock for the stub fence Christian König
2025-10-13 13:48 ` [PATCH 07/15] dma-buf: use inline lock for the dma-fence-array Christian König
2025-10-13 13:48 ` [PATCH 08/15] dma-buf: use inline lock for the dma-fence-chain Christian König
2025-10-13 13:48 ` [PATCH 09/15] drm/sched: use inline locks for the drm-sched-fence Christian König
2025-10-13 13:48 ` [PATCH 10/15] drm/amdgpu: fix KFD eviction fence enable_signaling path Christian König
2025-10-13 13:48 ` [PATCH 11/15] drm/amdgpu: independence for the amdgpu_fence! Christian König
2025-10-13 13:48 ` [PATCH 12/15] drm/amdgpu: independence for the amdgpu_eviction_fence! Christian König
2025-10-13 13:48 ` [PATCH 13/15] drm/amdgpu: independence for the amdgpu_vm_tlb_fence! Christian König
2025-10-13 13:48 ` [PATCH 14/15] drm/amdgpu: independence for the amdkfd_fence! Christian König
2025-10-17 22:22   ` Felix Kuehling
2025-10-30 15:07     ` Christian König
2025-10-30 20:04       ` Felix Kuehling
2025-10-13 13:48 ` [PATCH 15/15] drm/amdgpu: independence for the amdgpu_userq__fence! Christian König
2025-10-13 14:54 ` Independence for dma_fences! Philipp Stanner
2025-10-14 15:54   ` Christian König
2025-10-17  8:32     ` Philipp Stanner
2025-10-28 14:06       ` Christian König
2025-10-29 20:53         ` Matthew Brost
2025-10-30 10:59           ` Christian König
2025-10-31 17:44             ` Matthew Brost
2025-11-03 11:43               ` Christian König [this message]
2025-11-03 19:32                 ` Matthew Brost
2025-10-15  0:51 ` Dave Airlie

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=2f8a4b6b-4b9e-480b-8ea0-35e9293d0b85@amd.com \
    --to=christian.koenig@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=phasta@kernel.org \
    --cc=simona.vetter@ffwll.ch \
    --cc=tursulin@ursulin.net \
    /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