Skip to content

drm/asahi: g17: reuse released objects early on M4 Pro 25G83 - #3544

Merged
RyanTheTide merged 1 commit into
mainfrom
fix/g17-m4pro-25g83-objects-after-release
Nov 29, 2026
Merged

RyanTheTide merged 1 commit into
mainfrom
fix/g17-m4pro-25g83-objects-after-release

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

What: let the M4 Pro (T6040) 25G83 firmware reuse released objects early (objects_after_release). The cached descriptor storage, queue records and queue configuration that come back after their owner's release can then be reused once the firmware has consumed every control record published before they came back, not only after a later one. The A18 Pro already does this. The M4 Pro kept the stricter fence of 34b438d until a create/destroy-heavy queue test ran on that hardware, and this PR is that test. V25F84 (and V26B123, which inherits it) is pinned to the old value until measured, so only the T6040 25G83 build changes behaviour. Follow-up to #3463 in the GPU-UNGATE chip-gate audit.

Tested: J616s M4 Pro (T6040, 25G83), same-tree A/B: 0 errors in 2x1000 serial create/close + 92-process pool waves, 0 CTS regressions, 0 GPU faults, 0 oops, default restored.

Details on the J616s, one one-shot boot per arm. A = main 844781f + #3463 (now merged), B = A + this commit; the touched file is byte-identical to this head.

  • G17 pool churn (the SEC-MED2 qpair waves: 40 at once, 15 staggered, 40 short-lived, flush) run twice, each with LOOP=1000 serial create/close: 0 errors on both arms. Deferred-list sampler: 0 samples with deferred > 0. Object pool capacity refusals: A = 2 LowerVa + 4 LogicalQueues, B = 0 LowerVa + 4 LogicalQueues (the LogicalQueues ones are the known 40-process-wave baseline). Released objects coming back sooner removes the LowerVa exhaustion under churn.
  • =3 concurrent GPU clients (glmark2, gpubench compute, dEQP simple_draw loop, 3x qpair with host-checked results): 0 errors, capacity back to baseline, on both arms.

  • Multi-client ray tracing: four RT CTS groups (ray_query builtin.flow + watertightness, ray_tracing_pipeline trace_rays_cmds + misc) run solo and then as 4 concurrent clients beside two rt.rays loops and a compute client. 195 Pass -> Pass, 8 NS -> NS, 0 differences, 0 GPU faults, on both arms.
  • VK CTS 1.4.7.1 sync/query/compute/renderpass set (as in drm/asahi: g17: M4 Pro 25G83: stage-prefixed renders and render identity at create #3463): 0 failures on both arms.
  • gpubench, 41 cases, 2 runs per arm: median -0.03% (neutral), 0 cases worse beyond the run-to-run spread.
  • tools/asahi/run-host-tests.py --only g17: 247/247 at this head.

Risk: two-way door. T6040 25G83 only. Revert = flip the flag back.

Not yet: 25F84 / 26B123 (M4 Pro/Max on older or 27.2 firmware) measurements.

Evidence: traces/gpu/20261128-gpu-ungate/j616s-k4/ (lab store).

Cached descriptor storage, queue records and queue configuration that come
back after their owner's release was consumed may be reused once the
firmware has consumed every control record published before they came
back. The A18 Pro does this; the M4 Pro kept the stricter fence of
34b438d until a create/destroy-heavy queue test ran on that hardware.
Turn it on for 25G83. 25F84 and 26B123 keep the stricter fence.
@RyanTheTide
RyanTheTide requested review from a team and DjDeveloperr as code owners November 28, 2026 15:07

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at d0345a7a (wait for queued CI to finish green before merging)

Blockers: none

Checked:

  • drivers/gpu/drm/asahi/g17/fw/variant.rs (+5/-4): sets objects_after_release: true on V25G83 and explicitly pins objects_after_release: false on V25F84 (which inherits ..V25G83, and V26B123 inherits ..V25F84), while V26A428_M5 / V26B123_M5 (false) and V26A428 (true) remain untouched. Strictly isolated to M4 Pro (T6040) 25G83.
  • Verified exhaustive J616s (T6040, 25G83) same-tree A/B hardware row:
    • 2x1000 serial create/close + 92-process qpair pool waves: 0 errors, LowerVa pool exhaustion reduced 2 -> 0, 0 deferred>0 samples.
    • Multi-client stress (>=3 concurrent GPU clients + 4 concurrent RT CTS clients alongside rt.rays + compute): 195 Pass -> Pass, 0 diffs, 0 GPU faults, 0 oops.
    • VK CTS 1.4.7.1 sync/query/compute/renderpass: 0 failures; 41-case gpubench neutral (-0.03%); tools/asahi/run-host-tests.py --only g17 247/247 PASS at head.
Evidence
  • Risk: two-way door. T6040 25G83 only present.
  • All 20 queued CI checks (apple-build, host-tests, pr-text, readiness, KUnit suites) pending at d0345a7a.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

code-owner ping <@422957901716652033> / @DjDeveloperr: merge train. App approved, CI green, J616s 25G83 row at head (the change only applies to the 25G83 firmware layout). Merges in 1 h under the 6-point rule unless you object.

@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Merge readiness at d0345a7a: not ready yet

Check Detail
CI at head running running: KUnit macsmc, KUnit clpc, KUnit apple-spmi-nvmem, KUnit trusted-keys
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head no no line with the head SHA d0345a7a, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text ok Risk: two-way · . T6040 25G83 only. Revert = flip the flag back.

Areas: area:gpu

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merging under the 6-point rule (Ryan 09:29, permanent), at d0345a7a. (1) The review App approved at this head. (2) Full CI is green. (3/4) Rows: J616s;25G83-layout-only. (5) There's no blocking review. (6) Dj was pinged here 474 min ago with no objection. Revert: git revert -m 1 <merge>.

@RyanTheTide
RyanTheTide merged commit 41578fc into main Nov 29, 2026
20 of 21 checks passed
@RyanTheTide
RyanTheTide deleted the fix/g17-m4pro-25g83-objects-after-release branch November 29, 2026 00:28
@jgoyvaerts

Copy link
Copy Markdown
Contributor

A data point against this for 25G83, from my J616s (T6040, 25G83). On two local test kernels that still had the strict fence, the firmware stored through a compute descriptor ring after that ring's fence was met and the pool had handed it out again.

Both crashes are the agx_scheduler NULL store (PC 0x1f0c4, ESR 0x96000044, FAR 0), with x0 = descriptor slot + 0xf40, which is ComputeDescriptor.stamp_va. A pool trace named the object each time, a Family::Descriptor ring:

run A (11-24 05:05 UTC) run B (11-24 15:58 UTC)
ring 0xfffffc20026f8000 0xfffffc2007734000
previous owner's newest kick, stamp word 681, covered 440, covered
returned to the pool 7022.682789 1674.585217
reused, zero-filled (fence met) 7022.695821 (+13.0 ms) 1674.589763 (+4.5 ms)
firmware store, crash 7022.698678, slot 1 1674.590227, slot 23
slot belongs to previous owner's kick 673 previous owner's kick 439

So the store is for an older kick of the ring's previous owner, 5 to 16 ms after the ring came back, after the stamp word already covered a newer kick. The control-ring position does not order these deferred stores on this firmware. control_published() shortens the wait further.

Both crashes came 60 to 140 ms after a render watchdog give-up (a render at its queue head for 30.7 s, retired without its stamps). The load was dEQP-VK synchronization2 in 10 processes. A create/close churn test without a stuck render would probably not reach it, which may be why your A/B was clean.

Caveats: these were local kernels with other patches, not main at this head, and I have not run this exact commit. Since I started holding a vacated ring until its stamp covers the newest kick and the device owes no stamps, this signature has not come back in three runs. I can share the traces.

Related: in these dumps the x0 that 34b438d read as work state + 0xf40 is a descriptor ring slot.

RyanTheTide added a commit that referenced this pull request Nov 29, 2026
Resolve g17/fw/variant.rs: keep main's objects_after_release (true on V25G83 from #3544, false on V25F84) and this branch's telemetry_protocol (PSTATE_8MS on V25G83, NONE on V25F84).

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants