Skip to content

drm/asahi: g16 + shared SUBMIT: Wave 6 R2 — demand-grown 32 render slots / 18 compute units, fast SUBMIT path, stamp-only barriers, and batched render release - #2826

Open
DjDeveloperr wants to merge 8 commits into
djdev/g16-perf-wave2-5from
djdev/g16-perf-wave6
Open

DjDeveloperr wants to merge 8 commits into
djdev/g16-perf-wave2-5from
djdev/g16-perf-wave6

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Eight-commit Wave 6 R2 (f63168347300c) series stacked cleanly on #2787 (djdev/g16-perf-wave2-5 at 5610a84b974e5):

  1. 882a01ec1cd14 drm/asahi: g16: skip no-op publishes, batch event ring drains, and smooth receipt-tail backoff
  2. 3a970ce516736 drm/asahi: g16: offload displaced render pass scrubbing to an unbound workqueue
  3. 594a723798f0c drm/asahi: g16: expand render pass slots to 32 in demand-grown tiers and compute units to 18
  4. 5d6bef0371307 drm/asahi: g16: parse SUBMIT streams in one pass, batch CDM gate locking, and synchronize resnap
  5. 086fda9437006 drm/asahi: g16: use stamp-only cross-engine barriers for same-VM non-InitBM handoffs
  6. 11fb7fab68da5 drm/asahi: use VM reservation lock for VmReadGuard and merge G16 render validation (shared mmu.rs + G15/G16)
  7. b60cdb650c6f6 drm/asahi: reuse per-queue SUBMIT cmdbuf staging and bulk-read syncs (shared file.rs across generations)
  8. f63168347300c drm/asahi: g16: release full batched render count in commit_render()

Verification (exact head f63168347300c)

Host checks

  • scripts/checkpatch.pl --strict --ignore FILE_PATH_CHANGES: 0 errors, 0 warnings, 0 checks across all 8 commits.
  • run-host-tests.py: 25 / 25 PASS.

Live hardware (Apple M4 (G16G B0), J773g / T8132, 7.3.0-ARCH-m4prod17, 26B123 firmware)

  • Vulkan CTS (900 Pass / 1,687 NotSupported / 0 Fail / 0 Crash / 0 Timeout / 0 GPU errors):
    • vk-mustpass-short: 87 / 87 PASS
    • dEQP-VK.synchronization.* (1,500 strided of 64,872): 664 Pass / 836 NS / 0 Fail
    • dEQP-VK.memory_model.* (1,000 strided of 18,530): 149 Pass / 851 NS / 0 Fail
    • Live debugfs: type0: fs2c 13873 c2ta 20506 (0 faults).
  • gpubench-vk (0 CRC/status fails across 44 rows, pb: bad 0): 24-row 4K@120Hz + 4 overlap.passes + 6 render.postfx + 2 compress.bw array + 8 render.deferred.
  • Live Direction A + B hang recovery (rc=0 across all concurrent and fresh post-hang workloads):
    • Dir A (compute hang wait_rc=-4, 555.9 ms, recoveries 2 -> 3, compute_owners: retired 16 quarantined 2 reusable 15): concurrent render.heavy d=4 rc=0 (33,606 submits, 252.02 us vs 249.58 us clean), immediate fresh d=1 compute.heavy/compute.light/render.heavy all rc=0, 0 ECANCELED.
    • Dir B (render hang wait_rc=-4, 120.8 ms, recoveries 3 -> 4, render_owners: retired 30 quarantined 2 reusable 29, render_failed=0, degraded=0, pb: bad 0): concurrent compute.heavy d=4 rc=0 (16,175 submits, 550.05 us vs 547.45 us clean), immediate fresh d=1 render.heavy/render.postfx (CRC 668d6f0a)/compute.heavy all rc=0, 0 ECANCELED.
    • Post-recovery vk-mustpass-short: 87 / 87 PASS, 0 kernel BUG/WARN/Oops/wedged.
  • Real Deep Sleep S2R (rtcwake -d /dev/rtc1 -m mem -s 15): apple-sleep: back from sleep, boot object resumes 0 -> 1, pcie-apple port 0 & 2 link restored, ZERO_S2R_ERRORS, post-wake vk-mustpass-short 87 / 87 PASS.

Assisted-by: LLM (Gemini:4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Review at ac4f4cc.

  1. g16/resources.rs:236 + g16/hw.rs:730: RenderExtArena::new() allocates every extension pass slot at once, so RENDER_SLOTS = 32 means 30 slots of roughly 3.3 MiB each (2 MiB TPC + 1 MiB tilemap + aux/pre/scene/scratch/work). That is about 100 MiB of driver-private memory per VM, up from about 46 MiB. A VM gets it as soon as it pipelines renders or submits 2 or more renders in one SUBMIT (RENDER_BURST_COMMANDS = 2), which is nearly every compositor and app. Please give the per-VM footprint with numbers, or grow the extension slots on demand instead of all 30 at once.
  2. g16/engine.rs:2108, 2311/2369/2383: fs2c, c2ta and c2fs move from Hold to Stamp. The previous series kept the cross-engine barriers at Hold on purpose. The new comment at 2097 says "same-VM non-InitBM", but the fs2c site sets Stamp with no InitBM check, and from_stamp_only(!init_buffer) checks the consumer's InitBM, not the producer's. What guarantees that writes from the producer stage are visible to the consumer once the stamp fires? vk-mustpass-short (87 tests) is not enough to cover a memory-ordering change. Please run dEQP-VK.synchronization*/memory_model* and the compute→render/render→compute groups at this head.
  3. Commit 02aa294 reverts half of 432eaa0 (unbound events wq, EVENT_RETIRE_POLLS = 4) and cites "commit 2420bcdb1cee", which is not in this series. Please squash it into 432eaa0 and fix that message: right now it describes behaviour the series does not ship, and the commits in between bisect onto the regression. The two messages also disagree on the old value (11 vs 12).
  4. mmu.rs:2636 and file.rs:297/1829 change shared code. VmReadGuard is now used by G15 too (the #[cfg(G15)] on covers_range is gone), and the sync/cmdbuf copy runs for every generation. The title says "g16" but G13/G14/G15/G17 are affected, so this needs rows there (below).
  5. file.rs:1829: the 1 KiB inline_cmdbuf stays live in the ioctl frame across queue.lock().submit(), a deep path that goes through parse, VM locks and allocations. Please report the frame size (objdump or -Wframe-larger-than), or move the buffer into the per-queue state.
  6. g16/poll.rs:523: should_publish now skips publish_checked() unless something retired or one of the listed wake conditions holds. Pending work that becomes publishable through another path waits up to the 1 ms housekeeping tick. Examples are standby PB returned by the deferred Prepared::drop, or a VM slot freed by another file's teardown. Please either poke the poll from those release paths or say why it isn't needed.
  7. g16/poll.rs:384: the lock-free early return in cancel_resnap() can miss a rearm() running at the same moment. rearm() sets the deadline, then has_handle, then starts the timer, so the timer can stay armed after cancel. Before, the mutex ordered the two. This is harmless while idle, but join_workers() relies on this cancel before sleep.
  8. Leftover dead code: check_stream, cover, Resolved (command.rs:301/312/665/740) and ScrubBatch::run are now #[allow(dead_code)] or #[cfg(test)], and ScrubQueue/take_scrub_woke (used) carry stale allow(dead_code). params.rs:43: COMPUTE_UNITS.clamp(2, COMPUTE_UNITS) is a no-op.
  9. Rows at this head (ac4f4cc): the hardware numbers in the body come from "kernel-v14/v15" builds, not from this sha. Needed: a J773g dEQP + gpubench + hang-recovery + s2idle row, a J713 smoke row (same SoC, separate board in the module doc), and no-regression smoke for G13/G14 (M1/M2), G15 (M3, VmReadGuard change) and G17 (A18 Pro, shared sync/cmdbuf parse).

@RyanTheTide

Copy link
Copy Markdown
Contributor

Three additions to the review above (same head, ac4f4cc), not covered there:

  1. g16/poll.rs:346: while let Some(..) = self.scrub_queue.lock().pop() keeps the queue's spinlock guard alive for the whole loop body. The temporary lives until the end of the while let statement, so the scrub of up to 8 MiB runs with the spinlock held and preemption off, and enqueue_scrubs on the SUBMIT path spins on it meanwhile. Pop into a local and drop the guard before scrubbing.
  2. g16/slots.rs:506: once the scrub moved off the submitting CPU, nothing orders the scrubbed bytes before the slot is published back to the firmware. Please add the write barrier (wmb()/dma_wmb()) between the scrub completing and the slot becoming reusable.
  3. g16/hw.rs:730/758: 32 render slots (31 in flight) and 18 compute units are sized from a host address-space budget, not from a capacity the firmware publishes. Please tie them to the firmware's own limits (initdata/ring sizes) or explain why the firmware can take 31 renders in flight. This adds to the footprint point in item 1 above.

Assisted-by: LLM (Claude:Opus 5.5)

…ooth receipt-tail backoff

Reduce G16 completion-poll overhead while preserving per-CPU completion
locality and the full post-event receipt-tail window:

1. Skip redundant `publish_checked()` walks in `Firmware::poll_step()`
   when flights are active and nothing changed (no retirement, no ring
   headroom wait, no recovery unfreeze, no off-lock scrub wakeup, no
   external `publish_wake`, and no 1 ms housekeeping tick). Add
   `Shared::publish_wake` / `Shared::wake_publish()` so external state
   transitions (VM close, unstarted queue cancellation) re-evaluate
   `engine.pending` immediately without waiting for the 1 ms tick;
   `Prepared::drop` only releases standby PB reservations for
   `Cache::prepare` waiters, whose woken `SUBMIT` enters
   `submit_locked()` directly.
2. Keep `aurora_g16_events` per-CPU (`new_percpu_reclaim`) and
   `EVENT_RETIRE_POLLS = 11`, smoothing the trailing receipt-poll
   backoff from `1/2/5 us` (~48 us) to `1/2/3/4/5 us` (45 us total) so
   post-EP 0x20 retirement finishes inline without falling back to the
   repoll timer.
3. Batch `Events::drain()` and `Events::drain_statistics()` ring
   advances: read only the active words of common type-1 stage events
   (3 WC reads vs 18) and non-recovery statistics records (1 WC read
   vs 18), and write `STATE_READ` once per drained burst (flushing
   partial progress on mid-burst errors).
4. Cache `recovery_pending()` once per `submit_locked()` / `poll_step()`
   pass and short-circuit `retire_once()` when `flights` is empty.

Signed-off-by: Diljit Singh <hey@djdev.me>
… workqueue

Move off-lock write-combining zeroing of displaced render pass slots out
of `Shared::try_submit_inline()`, `Shared::submit()`, and `run_poll()`
onto a dedicated unbound reclaim workqueue (`aurora_g16_scrub`):

- Add a zero-allocation slot-indexed `ScrubQueue` protected by
  `Shared::scrub_queue` (`SpinLock`) and a `SCRUB_WORK` work item on
  `Shared::scrub_wq` so SUBMIT ioctls and completion polls never stall
  on WC fills.
- Preserve strict slot-reuse exclusion (`scrubbing` bitmask) and wake
  waiting render submitters via `poll_now()` immediately when a waited
  slot finishes scrubbing.
- Guard async `clean_mask` publication with a monotonic `generation`
  counter incremented by `invalidate_scrub()` so a scrub staged before
  firmware recovery can never leave a stale clean bit afterward.
- Drain `scrub_queue` and `scrub_wq` cleanly in `sleep.rs::join_workers()`
  after `sleeping` is set and `events` is drained so S2R and teardown
  never overlap workqueue draining with concurrent enqueues.

Signed-off-by: Diljit Singh <hey@djdev.me>
…and compute units to 18

Eliminate the 15-flight displacement cap at queue depth 16 and 32 for
both render and compute on G16 without imposing a 107.8 MiB per-VM
memory jump on compositors or shallow desktop VMs:

- Pack lazy extension render pass slots (`2..32`) at an 8 MiB VA stride
  (`EXT_PASS_STRIDE = 0x00800000`, tilemap at `+0x600000`) starting at
  `0x7024000000`, while keeping base slots `0..2` at their full 32 MiB
  intervals (`16 MiB` TPC / `8 MiB` tilemap). All 32 pass slots occupy
  `0x7020000000..0x7033000000` (208 MiB spare below `0x7040000000`),
  raising `render_flights()` from 15 to 31.
- Grow extension pass slots in three demand-grown `RenderExtArena` tiers
  (`EXT_RENDER_TIERS = [(2, 8), (8, 18), (18, 32)]`) sized against live
  render pass count (`active_render_passes + render_count + 1`). Each
  base slot backs 24.59 MiB (25,184 KiB: 16 MiB TPC + 8 MiB tilemap +
  608 KiB metadata/scratch/barriers) and each extension slot backs
  3.59 MiB (3,680 KiB: 2 MiB TPC + 1 MiB tilemap + 608 KiB):
  - Base only (`0..2`, steady 60/120 Hz single-pass): 49.19 MiB pass
    backing (0 MiB ext).
  - Tier 0 (`2..8`, +6 slots, compositors / 2-pass / shallow depth):
    +21.56 MiB ext (80% less than eager 30-slot allocation).
  - Tier 1 (`8..18`, +10 slots, moderate multi-pass bursts):
    +35.94 MiB (+57.50 MiB cum ext).
  - Tier 2 (`18..32`, +14 slots, deep multi-pass bursts):
    +50.31 MiB (+107.81 MiB cum ext).
- Fix `PASS_MASK` in `g16/slots.rs` to `u32::MAX >> (32 - RENDER_SLOTS)`
  so `RENDER_SLOTS = 32` does not overflow `1u32 << 32`, and raise
  `MAX_CLIENT` from 320 to 512 for headroom.
- Expand `COMPUTE_UNITS` from 16 to 18 (17 concurrent compute flights,
  covering `d=16` without displacement stalls), fitting directly inside
  the existing 64 MiB VA layout (`compute_base(18) == PB_HEAP`) and UMA
  slot range (`COMPUTE_UMA_SLOT + 18 <= RENDER_UMA_SLOT`), and simplify
  `params::compute_units()` with a compile-time `COMPUTE_UNITS >= 2`
  assertion in `g16/hw.rs`.

Signed-off-by: Diljit Singh <hey@djdev.me>
…ing, and synchronize resnap

Eliminate repeated SUBMIT-path CPU work across stream parsing, CDM stream
gating, and completion timer management:

- Replace the three-pass SUBMIT stream walk (check_stream -> prepare ->
  validate) with single-pass parse_stream() -> ParsedStream::prepare() ->
  Prepared::validate(). Structural validation and attachment parsing run
  once before device-state checks, preserving exact EINVAL/EOPNOTSUPP
  precedence over crashed/vm.status EIO. Attachment KVecs move directly
  into the first consuming command with zero copy, timestamp destinations
  resolve in place via timestamp::Destinations::empty() (G16-only), and
  validate() operates on the already-decoded commands. Remove the now-dead
  check_stream, cover, and Resolved helpers from g16/command.rs.
- Expose VmReadGuard::covers_range() to G16 in mmu.rs and add
  command::cover_locked() so gate::cdm() holds a single vm.read_lock()
  across stream window reads, USC program checks, and indirect parameter
  checks, dropping the lock and invalidating cached window/program proofs
  before might_sleep() every CDM_RESCHED_RECORDS records.
- Double-check resnap_deadline_ns and sleeping under resnap_handle.lock()
  in rearm(), and unconditionally acquire resnap_handle.lock() in
  cancel_resnap() before clearing resnap_deadline_ns and dropping the
  handle. This avoids redundant cancel+start cycles under racing callers
  while strictly ordering sleep_down() (sleeping = true then
  cancel_resnap()) against concurrent rearm() so no hrtimer handle can
  leak into suspend.

Signed-off-by: Diljit Singh <hey@djdev.me>
…InitBM handoffs

Use BarrierType::Stamp (type 0) instead of BarrierType::Hold (type 1)
for same-VM non-InitBM cross-engine barriers (fs2c in prefix_compute()
and c2ta/c2fs in prefix_render()), eliminating software-job hold bubbles
on compute <-> render handoffs (such as postfx and deferred shading).

Hardware memory-visibility invariant: each G16 GPU stage executes its
FINALIZE micro-sequence (flushing stage caches to the shared coherent
fabric) before firmware advances fw_stamp. Within a single VM (same
ASID and page tables), waiting on fw_stamp via BarrierType::Stamp
establishes full producer-to-consumer memory visibility without a
software-job hold. When either the waited producer or the consumer
carries InitBM, keep BarrierType::Hold via
cross_engine_barrier_type(producer_initbm, consumer_initbm) across
fs2c, c2ta, c2fs, and pipelined render->render barriers (with
WaitTarget propagating producer InitBM state from wait_stamp_for_with()
and cross_engine_wait()). Cross-VM transitions, recovery paths, and
query_access CPU-timestamp waits drain flights completely before
publishing.

Audited waits_for_timestamps in can_queue_behind(): because G16 copies
timestamp results into user query-pool BOs on CPU upon flight retirement
(publish_timestamps), keeping the retirement wait when query_access is
true (userspace did not pass DRM_ASAHI_COMPUTE_NO_QUERY_ACCESS) remains
required for query-pool correctness and is documented inline.

Signed-off-by: Diljit Singh <hey@djdev.me>
…er validation

Vm::read_lock() previously called lock_vm(&self.gpuvm, None, false),
which allocates a KBox<drm_gpuvm_exec>, runs drm_exec_init() (allocating
a page-sized object array), and locks every external BO reservation on
the VM (O(external BOs)) on every G16/G15 SUBMIT.

Because every mapping mutation in mmu.rs holds the VM's shared
reservation, read-only page-table coverage walks and user-memory copies
need only self.gpuvm.lock_inner(), matching covers_ranges_batch():

1. Back VmReadGuard<'a> with GpuVmInnerGuard<'a, VmInner> via
   self.gpuvm.lock_inner(), eliminating the per-SUBMIT KBox,
   drm_exec object-array allocation, and O(external BOs) lock walk.
2. In G16 Prepared::validate(), validate render VM spans and VDM root
   barriers under one Vm::read_lock() hold via SpanBatch::flush_locked()
   and gate::vdm_batch_locked().
3. Minimize PoC cache maintenance (dc civac + dsb sy) in G16 stream
   gates: read only 4 bytes (1 cache line) for single-pass VDM roots
   and clamp CDM root-stream window reads to the validated root end.

Signed-off-by: Diljit Singh <hey@djdev.me>
Avoid per-SUBMIT heap allocations without placing a large command buffer
on the kernel stack across queue.lock().submit(): store a reusable
KVec<u8> staging buffer on TableQueue (retained up to 4096 bytes between
submissions, releasing oversized buffers on completion or error) and
read drm_asahi_sync entries in 8-entry (128-byte) stack chunks rather
than issuing a separate copy_from_user per sync.

On guarded (G16/G17) paths, acquire the queue mutex once to snapshot the
command buffer before resolving output syncobjs, preserving the
pre-syncobj failure boundary; on unguarded paths, keep parsing syncs
before locking the queue.

Signed-off-by: Diljit Singh <hey@djdev.me>
When multiple render commands are batched into a single G16 flight,
engine publication previously called commit_render() once, leaving
(f.renders - 1) standby PB reservations held until Prepared::drop on the
deferred cleanup worker. Pass f.renders to commit_render() so all
published render commands release their standby reservations immediately
upon firmware visibility.

Signed-off-by: Diljit Singh <hey@djdev.me>
@DjDeveloperr DjDeveloperr changed the title drm/asahi: g16: Wave 6 — 32 render slots / 18 compute units, fast SUBMIT path, and batched render release drm/asahi: g16 + shared SUBMIT: Wave 6 R2 — demand-grown 32 render slots / 18 compute units, fast SUBMIT path, stamp-only barriers, and batched render release Nov 22, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

@RyanTheTide Thanks for the detailed review — pushed Wave 6 R2 (f63168347300c, 8 commits on djdev/g16-perf-wave6) addressing all 9 items from #issuecomment-7081661948 (25/25 G16 host tests PASS, 0/0/0 checkpatch.pl --strict):

  1. Demand-grown RenderExtArena tiers (594a723798f0c): Replaced eager 30-slot allocation with three demand-grown tiers (EXT_RENDER_TIERS = [(2, 8), (8, 18), (18, 32)]) sized against live pass demand (active_render_passes + render_count + 1). Exact per-VM pass backing:
    • Base only (0..2, steady single-pass): 49.19 MiB (2 × 25,184 KiB, 0 MiB ext)
    • Tier 0 (2..8, +6 slots, compositors / shallow depth): +21.56 MiB ext (6 × 3,680 KiB, 80% less than eager 30-slot)
    • Tier 1 (8..18, +10 slots, moderate multi-pass): +35.94 MiB (+57.50 MiB cumulative ext)
    • Tier 2 (18..32, +14 slots, deep multi-pass bursts): +50.31 MiB (+107.81 MiB cumulative ext)
  2. Producer + consumer InitBM gating & memory-visibility proof (086fda9437006): Added cross_engine_barrier_type(producer_initbm, consumer_initbm) with WaitTarget propagating producer InitBM across fs2c, c2ta, c2fs, and pipelined render→render barriers so BarrierType::Hold is kept whenever either side carries InitBM. Documented the G16 FINALIZE micro-sequence cache-flush-before-fw_stamp visibility invariant inline and verified with exact-head dEQP-VK.synchronization.* and dEQP-VK.memory_model.* CTS below.
  3. Squashed revert commit (882a01ec1cd14): Folded 02aa294f directly into 882a01ec1cd14 (keeping per-CPU aurora_g16_events and EVENT_RETIRE_POLLS = 11, removing the stale 2420bcdb1cee reference and inconsistent poll-count wording so every commit bisects cleanly).
  4. Shared-code scope (11fb7fab68da5, b60cdb650c6f6): Updated the PR title/body and kept non-g16: prefixes (drm/asahi:) on the shared mmu.rs (VmReadGuard, G15+G16) and file.rs (cmdbuf staging + bulk sync reads across generations) commits. Cross-SoC J713 / G13 / G14 / G15 / G17 smoke rows are not available on this M4 bench and remain noted for cross-board coverage.
  5. Removed inline_cmdbuf from the ioctl stack (b60cdb650c6f6): Replaced the 1 KiB stack buffer with a reusable per-TableQueue KVec<u8> staging buffer (retained up to 4096 bytes between submits, freed on oversized/error), keeping the ioctl stack frame small across queue.lock().submit().
  6. External publish wakeups (882a01ec1cd14): Added Shared::publish_wake / Shared::wake_publish() so external state transitions (VM close, unstarted queue cancellation) re-evaluate engine.pending immediately without waiting for the 1 ms tick; documented why Prepared::drop only releases standby PB reservations for Cache::prepare waiters whose woken SUBMIT enters submit_locked() directly.
  7. cancel_resnap() / rearm() lock ordering (5d6bef0371307): Removed the lock-free early return in cancel_resnap() — it now unconditionally acquires resnap_handle.lock(), and rearm() double-checks resnap_deadline_ns and sleeping under the same lock so join_workers() before sleep cannot race an armed timer.
  8. Dead code & no-op clamp cleanup (5d6bef0371307, 3a970ce516736, 594a723798f0c): Removed dead check_stream, cover, Resolved, and ScrubBatch::run, removed stale #[allow(dead_code)], and replaced COMPUTE_UNITS.clamp(2, COMPUTE_UNITS) with a compile-time assert!(COMPUTE_UNITS >= 2) in g16/hw.rs.
  9. Exact-head live M4 G16G B0 verification (J773g / T8132, 7.3.0-ARCH-m4prod17, exact Wave 6 R2 f63168347300c):
    • Vulkan CTS (900 Pass / 1,687 NS / 0 Fail / 0 faults):
      • vk-mustpass-short: 87 / 87 Pass
      • dEQP-VK.synchronization.* (1,500 strided of 64,872): 664 Pass / 836 NS / 0 Fail
      • dEQP-VK.memory_model.* (1,000 strided of 18,530): 149 Pass / 851 NS / 0 Fail
      • Live debugfs: type0: fs2c 13873 c2ta 20506 (0 faults) confirming live stamp-only Type-0 cross-engine barriers.
    • gpubench-vk (0 CRC/status fails across 44 rows, pb: bad 0): 24-row 4K@120Hz + overlap.passes (4) + render.postfx (6) + compress.bw array (2) + render.deferred (8).
    • Live Direction A + B hang recovery (rc=0 across all workloads):
      • Dir A (compute hang wait_rc=-4, 555.9 ms, recoveries 2 -> 3, compute_owners: retired 16 quarantined 2 reusable 15): concurrent render.heavy d=4 rc=0 (33,606 submits, 252.02 us vs 249.58 us clean); immediate fresh d=1 compute.heavy (793.65 us), compute.light (186.57 us), render.heavy (543.48 us) all rc=0, 0 ECANCELED.
      • Dir B (render hang wait_rc=-4, 120.8 ms, recoveries 3 -> 4, render_owners: retired 30 quarantined 2 reusable 29, render_failed=0, degraded=0, pb: bad 0): concurrent compute.heavy d=4 rc=0 (16,175 submits, 550.05 us vs 547.45 us clean); immediate fresh d=1 render.heavy (543.48 us), render.postfx (1630.43 us, CRC 668d6f0a), compute.heavy (793.65 us) all rc=0, 0 ECANCELED.
      • Post-recovery vk-mustpass-short: 87 / 87 PASS, 0 kernel BUG/WARN/Oops/wedged.
    • Real Deep Sleep S2R (rtcwake -d /dev/rtc1 -m mem -s 15): apple-sleep: back from sleep, boot object resumes 0 -> 1, pcie-apple port 0 & 2 link restored, ZERO_S2R_ERRORS, post-wake vk-mustpass-short 87 / 87 PASS.

(Note: I also saw your three addendum items in #issuecomment-7081689322 — run_scrubs() spinlock scope, post-scrub write barrier, and firmware in-flight capacity rationale — which arrived after f63168347300c was built/verified; we will address those in a follow-up revision.)

Assisted-by: LLM (Gemini:4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-checked at f631683 against both reviews at ac4f4cc.

Fixed:

  • Footprint (1). The demand-grown tiers and the per-tier numbers look right. Slot picking stays within each job's own render_passes().
  • Squash (3). The message is consistent now, and the stale hash is gone.
  • Stack buffer (5).
  • External publish wakeups (6).
  • cancel_resnap()/rearm() ordering (7).
  • Dead code and the no-op clamp (8).
  • Title and commit prefixes (part of 4).

Still open:

  • Spinlock held across the scrub (g16/poll.rs:346). Unchanged. This is the one I'd fix before merge, since it puts up to 8 MiB of WC zeroing under a preempt-off lock that SUBMIT spins on.
  • Write barrier after the off-CPU scrub (g16/slots.rs:512-527). Unchanged: scrub_clean() is followed directly by clean_mask.fetch_or().
  • 32 render slots / 18 compute units (g16/hw.rs:730/758). The commit still gives only the VA budget, not the firmware-side bound for 31 renders in flight.
  • Cross-engine stamp barriers (g16/engine.rs:156, :2137, :2356). Checking producer InitBM, and holding while any InitBM flight is live, answers the InitBM half. Two things remain:
    • g15/hw.rs:566-567 documents "Never both type 0" for FS->compute plus compute->TA, and G16 now runs both at type 0. Your debugfs counters (fs2c 13873 / c2ta 20506, 0 faults) are good evidence that this does not wedge G16. Please say in the commit why G16 differs from G15, and how the FINALIZE-flush-before-stamp behaviour was established.
    • The CTS is strided. It ran 664 + 149 tests, with 836 + 851 NotSupported, so the render<->compute single-queue cases may not have been sampled. Please run unstrided dEQP-VK.synchronization.op.single_queue.* and dEQP-VK.memory.pipeline_barrier.* at the head.
  • Rows (4/9). The J773g row at f631683 covers what was asked for on that board. Still missing at the exact head:
    • a J713 smoke row;
    • no-regression SUBMIT smoke on G13/G14 (M1/M2), G15 (M3, VmReadGuard) and G17 (A18 Pro / M4 Pro, shared cmdbuf/sync path).

New in this revision, minor:

  • Queue mutex held across user copies (file.rs:1862-1883). On the guarded path the queue mutex is now held across the cmdbuf copy and SyncItem::parse_array(). That puts user-memory faults and syncobj lookups under the queue lock. It only blocks the same file's submitters, but a PROVE_LOCKING run would confirm there is no mmap_lock inversion. Alternatively, take the staging KVec out under the lock, copy without the lock, and put it back.

Assisted-by: LLM (Claude:Opus 5.5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants