Skip to content

drm/asahi: g17: take T6041 render pool identity at context creation - #2863

Merged
RyanTheTide merged 1 commit into
aurora-silicon:integration/aurorafrom
AxxzyWasTaken:feat/t6041-pool-reuse
Nov 23, 2026
Merged

RyanTheTide merged 1 commit into
aurora-silicon:integration/aurorafrom
AxxzyWasTaken:feat/t6041-pool-reuse

Conversation

@AxxzyWasTaken

@AxxzyWasTaken AxxzyWasTaken commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On T6041 (25G83 and 26B123), render_id_at_create is inherited as false from V25G83/V26B123, so a context takes its render pool identity (one of 127 in firmware.render_ids) lazily on its first render instead of at context creation. If render graphs retained until firmware stop exhaust the remaining identities, queue/context creation still succeeds and the context then fails its first render with a lost device instead of failing creation cleanly with ENOSPC.

Change

Enable render_id_at_create: true on T6041's BUILD_25G83 and BUILD_26B123 variants in drivers/gpu/drm/asahi/hw/t6041.rs and update the field doc comment in drivers/gpu/drm/asahi/g17/fw/variant.rs.

Taking the identity at context creation is pure host-side accounting in g17/runtime.rs and g17/context.rs with no firmware ABI dependency. Note that every context, compute-only included, now holds a render pool identity from creation.

objects_after_release is intentionally kept false on T6041 (25G83 and 26B123): relaxing the strict control_fence() from commit 34b438de3df9 ("drm/asahi: g17: fence recycled firmware identities and storage"), which fixed an M4 Pro crash on a recycled work state, needs dedicated create/destroy queue churn stress testing on M4 hardware first.

Scope boundaries:

  • Both 32-core and 40-core T6041 configurations share BUILD_25G83 and BUILD_26B123.
  • T6040 (M4 Pro) and T6041 25F84 keep render_id_at_create: false unchanged.
  • Merge-order note: Both this PR and #2864 (feat/t6041-pstate-telemetry) add a field immediately after ta_mode_1: true, in BUILD_25G83 in drivers/gpu/drm/asahi/hw/t6041.rs, so whichever lands second gets a trivial 1-line rebase.

Testing

  • scripts/checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks (24 lines checked).
  • make ARCH=arm64 LLVM=1 drivers/gpu/drm/asahi/aurora.o and aurora.ko: compiles and links cleanly with 0 warnings in touched files (drivers/gpu/drm/asahi/hw/t6041.rs, drivers/gpu/drm/asahi/g17/fw/variant.rs; clang 22.1.8, rustc 1.99.1).
  • CI (host-tests): green.
  • J616C (32-core T6041, 25G83) hardware verification at exact head cfdc7e6c07d6 (7.3.0-j616c-pr2863, see #issuecomment-7093961814):
    • 256× same-VM and 150× fresh-fd VM_CREATE + QUEUE_CREATE/QUEUE_DESTROY churn: 100% pass (recycles past 63-slot context and 127-slot firmware.render_ids pools).
    • Concurrent QUEUE_CREATE saturation (80 same-VM / 70 multi-fd): cleanly admitted 34 queues and refused excess with EBUSY (Site::LogicalQueues), immediate recovery on release.
    • dEQP-VK 624-case subset 258/366/0, offscreen Vulkan (vtxalu/tvb_stress) and GLES (glmark2) clean, 0 GPU faults/errors/warnings, 0 failed systemd units, 0 SELinux AVC denials.

Uncovered Hardware

  • Not hardware-tested here: 40-core T6041 (J614C/J575C) and 26B123 firmware builds.
Reviewer detail
  • Base: integration/aurora f5fae3cbb047.
  • Diff touches drivers/gpu/drm/asahi/hw/t6041.rs (+2 lines) and drivers/gpu/drm/asahi/g17/fw/variant.rs (+2/-2 doc comment lines).
  • objects_after_release remains false on all M4 variants (T6040 and T6041), keeping the 34b438de3df9 control_fence() barrier intact.

Assisted-by: LLM (Anthropic:Claude Opus 5.5, Google:Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Review at cfdc7e6 (non-author, draft). No blocker in the code; it waits on the J616C context-churn row.

  • The claim at creation (g17/runtime.rs around line 799) runs after the logical-queue admission check and before the slot is reserved, under the device mutex, and a refused RenderId::new() returns before anything is held, so a refused creator holds nothing, as the comment above it requires.
  • Compute-only contexts now hold one of the 127 render identities from creation. With the context identity pool at 63, that adds no new cap on its own; the identities that can run out are the ones held by retained render graphs, which is the case this change turns from a lost device into ENOSPC.
  • objects_after_release stays false, so the 34b438d fence is untouched.
  • Merges cleanly on the current integration/aurora tip. With drm/asahi: g17: T6041: report the performance state, its frequency and busy time #2864 (same insertion point in BUILD_25G83) one of them needs a one-line rebase, as you note.

Point to consider: as with #2862, this is host-side accounting with no firmware dependency, so once proven on the M4 Max a T6040 row would let the per-build flag go rather than extend the per-chip list. The doc comment in variant.rs could then say "every G17 build" instead of listing machines.

Assisted-by: LLM (Claude:Opus 5.5)

@AxxzyWasTaken

Copy link
Copy Markdown
Contributor Author

J616C (Apple MacBook Pro 16", M4 Max, 32-core T6041, 25G83) hardware verification at exact head cfdc7e6c07d6 (7.3.0-j616c-pr2863, default cmdline, sddm greeter active):

Context / Queue Creation Churn & Saturation (render_id_at_create: true)

  • Same-VM sequential QUEUE_CREATE / QUEUE_DESTROY churn (256×): 256/256 OK — recycles well past both the 63-slot context pool and the 127-slot firmware.render_ids pool with zero leaks or stalls.
  • Fresh DRM fd + VM_CREATE + QUEUE_CREATE / destroy churn (150×): 150/150 OK (plus 150/150 fd open/close and 15/15 vulkaninfo --summary instance/device cycles).
  • Concurrent QUEUE_CREATE pool saturation (80 attempts same-VM; 70 attempts across separate fds/VMs): both cleanly created 34 concurrent queues up to the logical-queue admission cap (Site::LogicalQueues) and refused all excess creations with clean EBUSY (errno 16), holding nothing; immediately after releasing all queues, subsequent QUEUE_CREATE and live Vulkan rendering succeeded cleanly.

Graphics Smoke & Regression Check

  • dEQP-VK 624-case subset: 258 Passed / 366 NotSupported / 0 Failed / 0 Warnings.
  • Offscreen Vulkan render (vtxalu 1M tris / tvb_stress 1.5M tris): 16.308 ms / 12.690 ms pre-saturation, 16.301 ms / 12.698 ms post-saturation (0 lost devices).
  • Offscreen OpenGL ES (glmark2-es2-drm --off-screen): build 3724 FPS, terrain 323 FPS, score 2022.
  • Health: 0 asahi/aurora faults/errors/warnings/recoveries in dmesg, 0 failed systemd units, 0 SELinux AVC denials.

Marking #2863 Ready for Review (CI host-tests green). Agreed on the follow-up idea — once this lands and we have a T6040 row, collapsing render_id_at_create onto the shared build makes total sense.

Assisted-by: LLM (Google:Gemini 4 Neon)

@AxxzyWasTaken
AxxzyWasTaken marked this pull request as ready for review November 23, 2026 07:04

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Formal §1–§6 review at live head cfdc7e6c07d6dd44e96a374dfaffab66c4350bde: 0 blockers — approving.

Checked & clean

  • §1–§3 Code, safety & scope (drivers/gpu/drm/asahi/hw/t6041.rs, g17/fw/variant.rs):
    • Enabling render_id_at_create: true on T6041 BUILD_25G83 and BUILD_26B123 (covering both 32-core and 40-core configs) is pure host-side freelist accounting in g17/runtime.rs:799-839 and g17/context.rs with no firmware ABI dependency.
    • Verified refusal and retry hygiene in g17/runtime.rs:799-839: RenderId::new(&firmware.render_ids)? runs under the device mutex after the logical-queue admission check and before reserve_queue(), so a refused creator holds nothing, and the ENOSPC execution-context wait path explicitly calls drop(render_id) before releasing the mutex and sleeping.
    • objects_after_release stays false, keeping the 34b438de3df9 control_fence() barrier intact. Default cmdline, zero hacks.
  • §4 Attribution: Single commit cfdc7e6c07d6 carries human author/committer (AxxzyWasTaken <[email protected]>) and human Signed-off-by: only (zero AI trailers); PR body includes Assisted-by:.
  • §5 Evidence & live CI:
    • Live CI host-tests: green (SUCCESS).
    • Exact-head J616C (32-core T6041, 25G83, 7.3.0-j616c-pr2863, default cmdline) hardware row covers 256× same-VM and 150× fresh-fd/VM QUEUE_CREATE/QUEUE_DESTROY churn past both 63-slot and 127-slot pools, concurrent saturation (EBUSY cleanly at 34 with full post-release recovery), dEQP-VK 624-case subset (258 Passed / 0 Failed / 0 Warnings), Vulkan (vtxalu/tvb_stress) and glmark2-es2-drm smoke, plus full §5 health (0 faults/errors/warnings/recoveries in dmesg, 0 failed systemd units, 0 SELinux AVC denials). Untested scope (26B123, 40-core J614C/J575C) is clearly disclosed.
  • §6 Naming: Clean.

Non-blocking notes

  • The PR body still says "compile-tested only / Open as Draft" from before the J616C row was posted; fine as-is, just noting for cleanliness.
  • As noted, #2863 and #2864 share the insertion point in t6041.rs BUILD_25G83, so whichever merges second will need a trivial 1-line rebase.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Contributor

@AxxzyWasTaken this was next in the merge train at cfdc7e6. Since #2864 landed (ad9558d), it no longer merges cleanly into integration/aurora: both PRs touch drivers/gpu/drm/asahi/hw/t6041.rs and g17/fw/variant.rs. Could you rebase it onto the tip (rebase or merge, no force-push needed on our side)? If the rebased head only resolves the conflict, we'll re-check the range-diff and land it without asking for a new row.

Assisted-by: LLM (Claude:Opus 5.5)

@AxxzyWasTaken

Copy link
Copy Markdown
Contributor Author

@RyanTheTide Rebased onto integration/aurora (a4b51cdff0a7) at b58cf7148f1b — only resolves the additive context conflict in drivers/gpu/drm/asahi/hw/t6041.rs (BUILD_25G83 variant after #2862/#2864 landed).

1:  cfdc7e6c07d6 ! 1:  b58cf7148f1b drm/asahi: g17: take T6041 render pool identity at context creation
    @@ drivers/gpu/drm/asahi/hw/t6041.rs
          },
          config: None,
     @@
    -     // Four clusters: the tiler segment values of 25F84 on this machine.
    -     variant: &fw::variant::Variant {
    +         // unmeasured on the M4 Pro, which keeps false.
    +         render_stage_prefixes: true,
              ta_mode_1: true,
     +        render_id_at_create: true,
    +         telemetry_protocol: crate::g17::telemetry::Protocol::PSTATE_8MS,
              ..fw::variant::V25G83
          },
    -     config: None,

tools/asahi/run-host-tests.py --only g17: 90/90 passed at b58cf7148f1b. Ready for the merge train!

Assisted-by: LLM (Google:Gemini 4 Neon)

Taking a context's render pool identity (one of 127 in
firmware.render_ids) at context creation rather than lazily on the first
render is pure host-side accounting in g17/runtime.rs and g17/context.rs
with no firmware ABI dependency. If render graphs retained until firmware
stop exhaust the remaining identities, queue creation fails cleanly with
ENOSPC instead of succeeding and failing the context's first render with
a lost device.

Enable render_id_at_create on T6041's 25G83 and 26B123 variants (covering
both 32-core and 40-core configurations). Keep objects_after_release
disabled on 25G83/26B123: relaxing the strict control_fence() from
commit 34b438d ("drm/asahi: g17: fence recycled firmware identities
and storage"), which fixed an M4 Pro crash on a recycled work state,
requires dedicated create/destroy queue churn stress testing on M4
hardware first.

Test scope: compile-tested here; runtime verification on J616C (32-core
T6041, 25G83) is pending, and 40-core configurations (J614C/J575C) and
26B123 have not been hardware-tested.

Signed-off-by: AxxzyWasTaken <[email protected]>
@AxxzyWasTaken

Copy link
Copy Markdown
Contributor Author

Rebased cleanly onto integration/aurora (a4b51cdff0a7, cfdc7e6c07d6 → e45c2b916daf). The only change in the range-diff is resolving the 1-line adjacent-field conflict with #2864 (telemetry_protocol) in drivers/gpu/drm/asahi/hw/t6041.rs (local asahi-m4 + g17-* host-tests passed; CI host-tests running now). Ready for merge train!

Assisted-by: LLM (Google:Gemini 4 Neon)

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-reviewed rebased head e45c2b916daf (§1–§6 pre-PR checklist).

  • Rebase check: Clean rebase onto integration/aurora after #2864 landed (+2/-2 in variant.rs, +2/-0 in t6041.rs; zero semantic drift from previously approved cfdc7e6c07d6).
  • §4 Attribution: Clean human author/committer + Signed-off-by: only; zero AI trailers in commit.
  • §6 CI: host-tests is green (SUCCESS, run 45145466045).
  • Verdict: Approved for MERGETRAIN-LINUX4.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merge-train re-check at e45c2b9: no blockers.

The rebase onto the tip only resolves the conflict with #2864. The single commit beyond integration/aurora is the same change as cfdc7e6: render_id_at_create: true on T6041 BUILD_25G83 and BUILD_26B123, plus the doc comment, +4/-2. The J616C context-churn row at cfdc7e6 still applies. CI is green, and the train will land it.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide
RyanTheTide merged commit 48470aa into aurora-silicon:integration/aurora Nov 23, 2026
1 check passed
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.

3 participants