Repository navigation
Conversation
…ned barrier When a G17 submission carries more than MERGED_DEPENDENCIES (8) scheduler dependencies, sync_input::merge() previously allocated a cursor array and delegated to __dma_fence_unwrap_merge(), which walks every input twice, heap-allocates and sorts a second pointer array, and wraps the result in a dma_fence_array. Every dma_fence_array completion also queues an irq_work (IPI) even when its final child signals inside asahi_g17_signal_fence(). Generalize sync_scope's per-CPU active_scopes deferred-completion node and add asahi_g17_barrier, a compact single-allocation variable-fan-in barrier that joins the same inline drain pass when triggered from asahi_g17_signal_fence() (falling back to irq_work only for foreign signalers or when SCOPE_ATOMIC_BATCH is reached). Update asahi_g17_merge_fences() and sync_input::merge() to: - use stack scratch buffers up to 64 fences (heap-allocating only above 64), - skip already-signalled non-error fences in a single pass, - deduplicate identical pointers and same-context fences (keeping the latest seqno) for small active sets while keeping large merges O(N), - preserve already-signalled error fences instead of dropping their status, - return the stub or single remaining fence directly without allocating a barrier when 0 or 1 fences remain. Extend tools/testing/selftests/drivers/gpu/asahi-m4/test-fence-signalling.py to cover asahi_g17_merge_fences() fast paths, same-context deduplication, error-fence preservation, and the >64 heap path. Signed-off-by: oreater <[email protected]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
Verdict: FINISH, then merge at 22d1339fe02a15d90074e230d4c1a161c4247428
Blocker: The new host merge tests mock asahi_g17_barrier_create(), so they only test selection of inputs. At this head there is also no hardware run of the production barrier. Please exercise the new callback/refcount path, including a child already complete during registration, the last child completing in the inline drain and from a foreign signaler, and a negative child status. Show one barrier completion and balanced child refs. The exact-head J716c stress and peer rows remain due.
Checked: Reviewed the collector, reference ownership, constructor guard, deadline snapshotting, and the bounded inline drain. The test cases for deduplication, error inputs and large inputs do not enter the production barrier. No DT, board gating, private material, or attribution changes.
|
Thanks @oreater. The review is waiting on tests that exercise the real barrier: a child already signalled at registration, the last child in the inline drain and from a foreign signaler, and a negative status. It also needs before/after numbers for the >8-dependency case and an exact-head J716c stress row. Can you add these within 24 h? If not, we park it and pick it up when there is room (maintainer edits are on). |
erikwb
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at 22d1339fe02a
Blockers: the J716c row at this head is missing.
Checked: Traced callback registration, the constructor guard, callback and drain references, error publication, and deadline snapshots. No new hardware gates, runtime parameters or safety limits. The readiness checks passed and the branch has no conflicts. The equivalent-path boot predates this head. Exact-head J716c and peer rows are still due.
Evidence
Question, not blocking until measured: drivers/gpu/drm/asahi/g17/sync_input.c:161 keeps timeline chain wrappers as barrier children. That may cost the signalling path this change optimizes. Take a render submit with eight other pending inputs and a two-point chain whose leaves have distinct contexts. Let the newest leaf complete first and the predecessor complete last, after the first chain work has rearmed the callback and the other inputs have completed. The old merge unwraps the chain and queues one array completion. The new merge queues chain work for each leaf, then queues barrier work because the chain signals outside the driver's inline drain. Keep the flat fast path and retain the existing unwrap path for container inputs, or preserve the old leaf-level waiting in the new merge. A count of deferred work items per signal on that case, against main, would settle it.
drivers/dma-buf/dma-fence-chain.c:122 rearms via irq_work and signals with plain dma_fence_signal(). The render path in g17/queue/mod.rs:257 does not fold external inputs into firmware waits. The host merge tests replace the real barrier with a mock. Exercise the production callback path and show one barrier completion with balanced refs when a child completes during construction, the last callback runs on the inline path or a foreign path, and a child reports a negative status.
|
J716c (16-inch M5 Max) at EvidenceBuilt into batched kernel
Every fail and flaky case on both kernels is in |
… tests The merge tests replace asahi_g17_barrier_create() with a mock, so the new barrier's callback and reference path had no coverage. Compile the production g17/sync_scope.c unchanged against a single-CPU dma_fence, llist, per-CPU and irq_work model (ASan/UBSan on) and check, for children already signalled at registration, the last child signalled in the asahi_g17_signal_fence() drain or by a foreign signaler (irq_work fallback), a negative child status, a barrier waiting on a barrier and more ready barriers than SCOPE_ATOMIC_BATCH: one barrier completion, the expected inline or irq_work path, balanced child references and the barrier's release. Dropping the callback's barrier put, the inline drain, the error propagation, the child release on completion or the constructor guard each fails the test. Signed-off-by: Ryan Murray <[email protected]>
|
Thanks @oreater. I pushed 06a530f on top of your commit (test-only, no driver change) to answer the App finding. |
There was a problem hiding this comment.
Verdict: HOLD at 06a530fe for hosted CI and the J716c hardware row.
Checked: This delta compiles production sync_scope.c and exercises children already signalled at registration, inline and foreign completion, negative child status, nested barriers, early caller put, and the bounded drain handoff. The cases assert one completion and balanced references, addressing the host-coverage finding. The test models one CPU, so keep the current-head J716c stress and peer validation for the real IRQ path.
There was a problem hiding this comment.
Verdict: MERGE at 06a530fe1cfb
Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.
Checked: This delta compiles production sync_scope.c and exercises children already signalled at registration, inline and foreign completion, negative child status, nested barriers, early caller put, and the bounded drain handoff. The cases assert one completion and balanced references, addressing the host-coverage finding. The test models one CPU, so keep the current-head J716c stress and peer validation for the real IRQ path.
Follow-ups (not blocking): hosted CI; J716c IRQ-path stress row
What: Replace
__dma_fence_unwrap_merge()/dma_fence_arrayinasahi_g17_merge_fences()with a single-pass O(N) stack-buffered merge and a compactasahi_g17_barrierfence that joinssync_scope's per-CPUactive_scopesinline drain pass instead of queueingirq_workon every barrier completion.Tested: J716c (MacBook Pro 16" M5 Max) host build + tests at
22d1339fe02a(make LLVM=1 ARCH=arm64 drivers/gpu/drm/asahi/clean with 0 warnings in touched files;tools/testing/selftests/drivers/gpu/asahi-m4/test-fence-signalling.pypassing including newasahi_g17_merge_fencestests;run-host-tests.py --only asahi-m41/1,--only cross-qid-direct11/11,--only capacity-fault1/1). Equivalent barrier path previously boot- and Vulkan-stress-tested on J716c (7.3.0-40).Risk: two-way · G17 Macs (M4/M5) when a submission has >8 scheduler dependencies (
MERGED_DEPENDENCIES).Not yet: Bare-metal boot and GPU stress run at this exact rebased
maincommit (22d1339fe02a).Design details and test evidence
asahi_g17_scope'sready/workfields intostruct asahi_g17_deferredsoasahi_g17_signal_fence()drains both ready scopes and ready barriers inline on the same CPU (respectingSCOPE_ATOMIC_BATCHand falling back toirq_workonly for foreign fence signalers).asahi_g17_barrier_create()indrivers/gpu/drm/asahi/g17/sync_scope.cusing a single flexible-array allocation, constructor guard,barrier_drop_children()child release after signalling, lock-safe batchedset_deadline, and negative error propagation.sync_input::merge()andasahi_g17_merge_fences()to use stack buffers up to 64 fences (heap-allocating only above 64), skip already-signalled non-error fences, deduplicate identical pointers and same-context fences (keeping the latest seqno) for small active sets (<= 16), preserve already-signalled error fences, and bypass barrier allocation when 0 or 1 fences remain.tools/testing/selftests/drivers/gpu/asahi-m4/test-fence-signalling.pyto test all-signalled stub return, same-context deduplication without barrier allocation, error-fence preservation alone and alongside unsignalled fences, and the >64 heap path.