intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] dma-buf/fence-chain: Speed up processing of rearmed callbacks
@ 2025-08-14  8:16 Janusz Krzysztofik
  2025-08-14  8:16 ` [PATCH 1/4] dma-buf/fence-chain: Report time spent in wait_* test cases Janusz Krzysztofik
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Janusz Krzysztofik @ 2025-08-14  8:16 UTC (permalink / raw)
  To: Christian König
  Cc: Sumit Semwal, Gustavo Padovan, Chris Wilson, linux-media,
	dri-devel, linaro-mm-sig, linux-kernel, intel-gfx, intel-xe,
	Janusz Krzysztofik

CI results indicate excessive time spent on processing of wait_backward
selftest.  The test case enables signaling on each link of a 4096 links
long chain, then signals those links one after another in reverse order.
That scanario corresponds to user space potentially building a dma_fence
chain of an arbitrary length step by step, e.g. via drm_syncobj IOCTLs,
and each step waiting on a chain link it has added.

When first user starts waiting on a not yet signaled fence of a chain
link, or signaling is explicitly enabled on it, a dma_fence_chain callback
is added to a user fence of that link.  When the user fence of that chain
link is then signaled, the chain is traversed in search for a first not
signaled link and the callback is rearmed on a user fence of that link.
Each time an arbitrary user fence is signaled, all dma_fence_chain
callbacks added to it so far must be rearmed to another user fence of the
chain.  In extreme scenarios, when all N links of a chain are awaited and
then signaled in reverse order, the dma_fence_chain callback may be called
up to N * (N + 1) / 2 times (an arithmetic series).

To avoid that potential excessive accumulation of dma_fence_chain
callbacks, rearm a trimmed-down, signal only callback version to the base
fence of a previous link, if not yet signaled, otherwise just signal the
base fence of the current link instead of traversing the chain in search
for a first not signaled link and moving all callbacks collected so far to
a user fence of that link.

For more clear correspondence to a potential userspace scenario, update
the wait_* selftests so they actually wait on each link fence of the chain
instead of just enabling signaling.  For easy evaluation of the change
impact, report processing time of signaling loop of each wait_* test case.


Janusz Krzysztofik (4):
  dma-buf/fence-chain: Report time spent in wait_* test cases
  dma-buf/fence-chain: Let test cases decide which fence to wait on
  dma-buf/fence-chain: Wait on each tested chain link
  dma-buf/fence-chain: Speed up processing of rearmed callbacks

 drivers/dma-buf/dma-fence-chain.c    | 101 ++++++++++++++++----
 drivers/dma-buf/st-dma-fence-chain.c | 133 +++++++++++++++++++++------
 2 files changed, 189 insertions(+), 45 deletions(-)

-- 
2.50.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-08-19  9:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-14  8:16 [PATCH 0/4] dma-buf/fence-chain: Speed up processing of rearmed callbacks Janusz Krzysztofik
2025-08-14  8:16 ` [PATCH 1/4] dma-buf/fence-chain: Report time spent in wait_* test cases Janusz Krzysztofik
2025-08-14  8:16 ` [PATCH 2/4] dma-buf/fence-chain: Let test cases decide which fence to wait on Janusz Krzysztofik
2025-08-14  8:16 ` [PATCH 3/4] dma-buf/fence-chain: Wait on each tested chain link Janusz Krzysztofik
2025-08-14  8:16 ` [PATCH 4/4] dma-buf/fence-chain: Speed up processing of rearmed callbacks Janusz Krzysztofik
2025-08-14 12:24   ` Christian König
2025-08-18 14:30     ` Janusz Krzysztofik
2025-08-18 14:42       ` Christian König
2025-08-19  9:04         ` Janusz Krzysztofik
2025-08-19  9:15           ` Christian König
2025-08-14 16:46 ` ✗ i915.CI.BAT: failure for " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).