Repository navigation
drm/syncobj: walk bypassed signaled chain predecessors for direct wait - #3406
Conversation
When drm_syncobj_direct_wait_fence() unwraps a timeline point to its contained fence, the dma_fence_chain wrapper itself never has dma_fence_signal() called on it. On the next consecutive depth-1 submit, checking only DMA_FENCE_FLAG_SIGNALED_BIT on chain->prev sees an unset bit even though prev's contained fence and all earlier nodes are already signaled, falling back to a wrapped chain wait and firing a dma_fence_chain irq_work self-IPI on every other submit. Walk chain->prev using only monotonic DMA_FENCE_FLAG_SIGNALED_BIT checks (no driver callbacks, bounded to 8 hops, safe under syncobj->lock) so already-complete bypassed chain wrappers still allow direct waits. Add KUnit tests covering consecutive depth-1 timeline sequences and unsignaled predecessors. Signed-off-by: DjDeveloperr <[email protected]>
There was a problem hiding this comment.
Verdict: HOLD at 924f87dc08ec
Blockers: Hosted CI and a second GPU-family regression covering overlapping timeline waits.
Checked: Code approved by inspection. The walk takes a reference on the predecessor before dropping the current wrapper and consumes the input reference on every exit. It uses monotonic signal bits and keeps the chain on ambiguous or over-limit walks. The exact-head KUnit 3/3 and J700 results are author-reported.
Evidence
Reviewed PR source and recorded results at 924f87dc08ec.
|
Second-generation hardware verification on J714s (Apple M5 Pro /
|
|
Merge readiness at
Areas: none matched in CODEOWNERS Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Merging at |
What
When
drm_syncobj_direct_wait_fence()unwraps a timeline point to its contained fence, thedma_fence_chainwrapper itself never hasdma_fence_signal()called on it. On the next consecutive depth-1 submit, checking onlyDMA_FENCE_FLAG_SIGNALED_BITonchain->prevsees an unset bit even thoughprev->fenceand all earlier nodes are already signaled. As a result, every other consecutive depth-1 timeline wait (50%) falls back to a wrapped chain wait and fires adma_fence_chain_irq_workself-IPI (irq=6), moving completion wakeups into hard-IRQ context.Add
drm_syncobj_chain_prev_signaled()to walkchain->prevusing only monotonicDMA_FENCE_FLAG_SIGNALED_BITchecks (bounded to 8 hops, no driver callbacks, safe undersyncobj->lock), so already-complete bypassed chain wrappers continue to allow direct waits. Add KUnit tests covering consecutive depth-1 sequences, unsignaled predecessors, and the bounded depth limit.Tested
drm_syncobj_direct_wait): 3/3 passed (0.083s) on exact head924f87dc08ec4:drm_syncobj_test_direct_wait_depth1_sequencedrm_syncobj_test_direct_wait_unsignaled_prev_stays_chaindrm_syncobj_test_direct_wait_deep_chain_boundedBAABon MacBook Neo (J700,T8140/G17P B1),fca33ed67eb81vs924f87dc08ec4(Mesa30df6feb98f):ftrace(A2vsB2, 25 ms):dma_fence_chainIRQ_workself-IPIs dropped from100/199(50.3%) to0/185onrender.light d1, and117/234(50.0%) to0/233oncompute.light d1(100% task-context completion wakeups).gpubench-vk(4-bootBAABmeans, allstatus=ok):default compute.light d1:112.08 -> 104.23 us(-7.85 us,-7.0%,med 105.1 -> 101.0,p95 123.7 -> 115.5)u1024 render.light d1:105.09 -> 101.85 us(-3.23 us,-3.1%,med 78.5 -> 74.4)u1024 compute.light d1:106.20 -> 104.38 us(-1.82 us,-1.7%,med 104.4 -> 101.2)policy0=4044MHz render.light d1:78.92 -> 76.19 us(-2.73 us,-3.5%,med 75.2 -> 72.4)render.light d2/d4/d8,compute.light d4:-0.2%to-0.9%render.deferred,render.postfx,compute.heavy d1/d4): flat (-0.2%to+0.3%)n=4per arm):84.14s -> 84.06s(-0.08s,-0.10%, no regression).B2):dEQP-VK.synchronization.basic.*29/29 PASS,dEQP-VK.synchronization2.basic.*26/26 PASS,dEQP-VK.compute.pipeline.basic.*80/81 PASS (1 NotSupported, 0 failed).P=744 MHz,E=816 MHz;0GPU faults,0SELinux AVCs,0new kernel errors across all 4 boots.Risk
Risk: two-way · J700, J714s.
Low.
drm_syncobj_chain_prev_signaled()only reads the monotonicDMA_FENCE_FLAG_SIGNALED_BIT, invokes no driver->signaledcallbacks, holds no extra locks beyond brief RCU reads, and caps traversal at 8 predecessors before conservatively returning the wrapped chain fence.Not yet
T8140) and UML KUnit only; not separately benchmarked on M3/M4/M5 hardware.policy0/scaling_min_freq=4044000,compute.light d1on J700 shifts98.37 -> 107.30 usbecause 100% task-context wakeups allow upstreamWAKE_SHORT_LOCALto keep the waiter oncpu0(c2d = 10 usvs13 usoncpu5), which independently reproduces viataskset -c 0even withNO_WAKE_SHORT_LOCALdue to G17P compute firmwaredb->irqtiming atc2d = 10 us. Default andu1024compute.light d1both improve cleanly.