Skip to content

drm/asahi: set the G14 27.2 firmware progress checks and compute watchdog - #3055

Merged
RyanTheTide merged 1 commit into
mainfrom
m2gpu/g14-v27-2-progress
Nov 24, 2026
Merged

RyanTheTide merged 1 commit into
mainfrom
m2gpu/g14-v27-2-progress

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 24, 2026 •

Copy link
Copy Markdown

What: The G14 firmware 27.2 runtime armed the firmware's progress recovery but left every Globals word that configures it at zero: the 3D/TA/compute progress-check intervals, the compute context-switch and kill timeouts, the relaxed kill timeout, command submission enabled and +0xe28. As a result the firmware timed out ordinary work within a second or two. On the M2 mini this killed piglit arb_shader_image_load_store-shader-mem-barrier (TA) and Geekbench 6 Vulkan Background Blur (compute). This change writes those words with the values the M3 and M4 27.2 runtimes use for the same 0xe48-byte Globals layout.

Tested: J473 (M2 mini, G14G, firmware 27.2) at 62420ea8 on main (row H7), default cmdline, GNOME on both monitors with a bystander glxgears:

  • piglit shader-mem-barrier passes 145/145 subtests; qualifiers passes.
  • Geekbench 6 Vulkan completes all 8 workloads.
  • No firmware timeouts and no Oops. gnome-shell kept its PID, and fresh vkcube and vulkaninfo returned 0.
  • Production fleet87 was restored and verified.

Before this change both workloads were timed out on every run (rows H1-H5). The KUnit/host test passes 4/4.

Risk: two-way · only Macs running the G14 firmware 27.2 runtime (J473 today; any G14G Mac on 27.2). The 13.5 runtime and other GPU generations don't run this code.

Not yet:

  • A J413 13.5 regression row on the next fleet cut.
  • CI against main: no workflow has run since integration/aurora was renamed.
Details
  • Words and values: +0x24=3000, +0x78=1, +0x998=40, +0x99c=100, +0x9a0=250, +0x9c8=40, +0x9cc=50, +0xe28=3.
    • M3 27.2 (m3/m3_power_26.rs) and M4 27.2 (g16/fw/initdata.rs) write the same values, except +0x99c, which is 10 there.
    • The 13.5 Globals names are progress_check_interval_3d/ta/cl, cl_context_switch_timeout_ms and cl_kill_timeout_ms.
    • +0xe28 has no public name in our trees; 13.5's unk_e28 is in HwDataA, not Globals. Both 27.2 writers set it to 3.
  • TA interval: 100, not the 10 the 27.2 writers use. With 10 (row H8) piglit passed, but the GPU firmware crashed in Geekbench 6 Background Blur (RTKit exception, all clients lost). With 100, the same workload completed in both rows (H6, H7).
  • None of these words is a hardware-protection limit. They are firmware watchdog intervals and timeouts; the thermal and power words are unchanged.
  • The idle power-off delays (+0x9b8..+0x9c0) are not touched.
  • The values live in g14_v27_2_abi.rs as GLOBALS_PROGRESS. Its test checks that they fit the object, are aligned and non-zero, and don't overlap the power words.
  • The root cause was found by the NEON-G14HANG offline audit (its rank 1). drm/asahi: recover from G14 firmware 27.2 command timeouts and faults per client #3041 (per-client recovery) is independent: it contains a real timeout, while this change removes the false ones.
Evidence

Our own traces, traces/gpu/20261124-m2gpu-hang/:

…hdog

The G14 firmware 27.2 runtime armed the firmware's progress recovery
(HwDataB +0xfc4) but left the Globals words that configure it at zero:
the 3D/TA/compute progress-check intervals (+0x998/+0x99c/+0x9a0), the
compute context-switch and kill timeouts (+0x9c8/+0x9cc), the relaxed
compute kill timeout (+0x24), command submission enabled (+0x78) and
+0xe28. The firmware then timed out ordinary work within a second or
two. The J473 (M2 mini) lost piglit
arb_shader_image_load_store-shader-mem-barrier to a TA timeout in its
first subtest, and Geekbench 6 Vulkan to a compute timeout in Background
Blur. Both complete on the J413, the same G14G on firmware 13.5, whose
runtime sets these words.

The 27.2 Globals object has the same 0xe48-byte layout on M3 and M4.
Their 27.2 runtimes write these words with these values (m3_power_26,
g16/fw/initdata). Write them the same way. The exception is the TA
interval: it uses the 100 polls the M3 runtime uses for long vertex loops
(m3_config), not 10. The values live in g14_v27_2_abi.rs with a test
that they fit the object and leave the power words alone. The idle
power-off delays (+0x9b8..+0x9c0) are not touched.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Author

Independent source review at 62420ea802f9. I ran the exact ABI host fixture and all four tests passed. The write is confined to the existing Globals construction, before cache publication. This leaves the existing thermal and power settings and the separate recovery path untouched. Seven of the eight entries agree with both checked 27.2 writers.

The TA progress interval is the one intentional difference. The cited M3 override is in the legacy InitData layout. Both of the linked 27.2 writers use the shorter interval. Please document the reason for taking the longer interval on the current ABI, with the J473 evidence that distinguishes valid long TA work from a stalled workload, and name the final currently unlabeled word or cite its public ABI definition. If a timeout is a hardware-protection limit, it needs the machine's value under the fleet safety rule.

H6 isolates a useful direction. Please post the exact H7 row without the recovery PR, with the normal shader barrier and Vulkan workload results, preserved desktop and post-restore health. The earlier G13 and G16/G17 peer request and the same-G14 legacy-firmware control still apply. All workflow-filter checks also need to run against main.

Assisted-by: LLM (Codex)

@DjDeveloperr DjDeveloperr 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.

Formal §1–§6 pre-PR review at exact head 62420ea802f9b4b7f4caee12d1accc6bad6097c5 — holding approval (COMMENT) pending standalone H7 hardware/regression evidence, resolution/justification of the TA progress interval (0x99c = 100 vs 10), and CI checks running on main.

Technical & ABI Verification

  • Globals layout & bounds (g14_v27_2_abi.rs, gpu/v27_2.rs): GLOBALS_BYTES = 0xe48 matches the shared 27.2 Globals size in m3/m3_power_26.rs and g16/fw/initdata.rs. All 8 entries in GLOBALS_PROGRESS are 4-byte aligned, strictly within 0..0xe48, written via put32 before crate::pgtable::clean_poc(data.as_ptr(), data.len()), and disjoint from the existing Globals writes (0x58/0x5a/0x5c/0x6e/0x84/0x88/0x8c/0x98), untouched idle power-off words (0x9b8..0x9c0), and the runtime idle generation counter (0xe40).
  • Cross-generation & firmware isolation: Strictly isolated to CONFIG_DRM_ASAHI_G14_V27_2, ProbeConfig::LegacyWithG14Handoff (apple,agx-t8112 / G14G), and apple,firmware-compat == [27, 2, 0] (driver.rs:203,404). G13, G14X, G14G on 12.4/13.5, G15, G16, G17, and G18 do not execute any changed code.
  • Host test verification: Ran rustc --test -D warnings on drivers/gpu/drm/asahi/g14_v27_2_abi.rs at 62420ea802f9b4b7f4caee12d1accc6bad6097c5: 4/4 passed, 0 warnings.
  • Word-by-word cross-check & open technical items:
    • Seven of eight entries (0x24=3000, 0x78=1, 0x998=40, 0x9a0=250, 0x9c8=40, 0x9cc=50, 0xe28=3) match both other 0xe48-byte 27.2 builders (m3/m3_power_26.rs:222-236 and g16/fw/initdata.rs:518-528), and the named timeout/interval fields match G14 13.5 (initdata.rs:734,797-813).
    • Blocking clarification — TA interval (0x99c, 100) vs 10: Every other 27.2 builder (m3/m3_power_26.rs:229, g16/fw/initdata.rs:522, g17/fw/m5/initdata.rs:1044) and G14 13.5 (initdata.rs:798) use 10. Notably, the PR confirms J413 (G14G on 13.5, where progress_check_interval_ta = 10) passes both shader-mem-barrier and Geekbench 6 Vulkan, while the cited m3_config.rs:126 override (+0x980) is on the legacy 14.8.3 InitData layout (from a J514S trace). Since the J473 failure occurred with 0x99c = 0, please either align 0x99c to 10 or provide J473 27.2 evidence showing 10 false-triggers on valid TA work while 100 still allows firmware TA recovery to fire well inside the 5000 ms host COMMAND_TIMEOUT_MS (g14_v27_2.rs:52) without tearing down the runtime first.
    • Minor — +0xe28 = 3 documentation & test guard: +0xe28 is currently unlabeled in the doc comment; noting explicitly that it is an unnamed 27.2 Globals constant shared with m3_power_26.rs / g16/fw/initdata.rs (not a hardware-protection parameter) would clarify §3 compliance. Optionally, progress_words_fit_the_globals_and_leave_power_words_alone could also guard 0xe40 (runtime idle generation counter) and 0x9b8..0x9c0 (untouched idle delays) against future overlap.

§1–§6 Checklist Summary

  • §1 No model gating: Pass — no new chip/SoC/board/firmware-version gates; executes solely within the existing apple,firmware-compat = [27, 2, 0] runtime.
  • §2 Production-ready, no hacks: Hold on (0x99c, 100) justification above. Otherwise clean: works on the default kernel command line with no new parameters, sleeps, or disabled checks.
  • §3 Safety: Pass — power/thermal controller, power ceilings (0x84/0x88/0x8c/0x98), and idle power-off delays (0x9b8..0x9c0) are untouched; these are firmware progress-check and compute watchdog intervals, not electrical/thermal protection limits.
  • §4 Clean-room & attribution: Pass — single commit 62420ea802f9b4b7f4caee12d1accc6bad6097c5 carries human author/committer (Ryan Murray <ryan@aurorasilicon.org>) and human Signed-off-by: only, with zero AI trailers in commit history and clean-room implementation.
  • §5 Evidence & CI (blocking for approval):
    • Exact-head standalone HW evidence (H7): Referenced in the PR body ("see the comment below") as the standalone run without #3041, but not yet posted. Please post the H7 J473 results at exact head (piglit shader-mem-barrier, Geekbench 6 Vulkan, preserved gnome-shell PID, post-run vkcube/vulkaninfo) plus the §5 regression counts (0 SELinux denials, 0 failed units, 0 new kernel errors).
    • Legacy-firmware control: J413 (G14G 13.5) regression row noted under "Still to run".
    • CI status: statusCheckRollup is empty ([]) because .github/workflows/*.yml (including host-tests.yml) still trigger on branches: [integration/aurora, aurora-wip] and are waiting on aurora-silicon/linux#3053 to switch triggers to main. Holding approval until CI runs green on main (local rustc --test -D warnings g14_v27_2_abi.rs passed 4/4).
  • §6 Naming: Pass.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide

RyanTheTide commented Nov 24, 2026 •

Copy link
Copy Markdown
Author

Exact-head J473 row (H7) at 62420ea on main a3d477d, without the recovery PR. Default cmdline, GNOME on both monitors, bystander glxgears; our own traces.

  • piglit arb_shader_image_load_store-shader-mem-barrier passes 145/145 subtests; qualifiers passes.
  • Geekbench 6 Vulkan completes all 8 workloads, including Background Blur (rc=0).
  • No firmware timeouts, no recoveries, no Oops. gnome-shell kept the same PID, and fresh vkcube and vulkaninfo returned 0 before, between and after.
  • Production fleet87 was restored and verified: running and saved, next_entry empty, Enforcing, 0 failed units, 0 AVC.

Before this change, both workloads were timed out by the firmware on every run (rows H1-H5).

On the TA interval: I'm now testing the 27.2 parity value of 10 on the J473 (H8). If it passes, I'll switch to 10 so there's no special case. Answers to the other points follow with that row.

@RyanTheTide RyanTheTide left a comment •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Source review of exact head 62420ea802f9. No blocker. One open question, with the row that settles it.

Checked.

  • I compared all eight writes against the two 27.2 writers in the tree. m3/m3_power_26.rs lines 222-236 and g16/fw/initdata.rs lines 518-528 write the same offsets with the same values for 0x24, 0x78, 0x998, 0x9a0, 0x9c8, 0x9cc and 0xe28.
  • The writes happen inside the existing Globals construction, before clean_poc. No power or idle word changes: 0x9b8..0x9c0 are left alone, as the test asserts.
  • The code runs only on the runtime that the handed-over firmware selects.
  1. The TA interval of 100 has no 27.2 source. Both 27.2 writers set 0x99c to 10, and so does the 13.5 G14 runtime (progress_check_interval_ta: 10). The 100 comes from m3/m3_config.rs:128 (TA_PROGRESS_INTERVAL), which belongs to the older InitData path, not to the 27.2 Globals the M3 runtime builds in m3_power_26.rs. H6/H7 show the fix works with 100, but they do not show that 10 fails. Please run the same H7 row at this head with only 0x99c set to 10: piglit shader-mem-barrier, plus Geekbench 6 Vulkan Background Blur.
    • If 10 passes, use 10, so all three runtimes agree.
    • If 10 times out, keep 100 and put that trace in the commit message as the reason. The GPU firmware's progress recovery then waits about 10x longer before it kills a genuinely stuck vertex workload on this runtime, which matters for the separate recovery work (#3041).
  2. Test nit. The power list in progress_words_fit_the_globals_and_leave_power_words_alone repeats the offsets that RootV27_2 writes. If those move into named g14_v27_2_abi constants that both the writer and the test use, the overlap check stays correct when a power word is added.

@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Merge readiness at 62420ea8: ready to merge

Check Detail
CI at head ok no CI for this change (the hardware row is the gate)
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok in the PR body at 62420ea8
Conflicts ok none
PR text ok Risk: two-way · only Macs running the G14 firmware 27.2 runtime (J473 today; any G14G Mac on 27.2). The 13.5 runtime and other GPU generations don't run this code.

Areas: area:gpu
Merge: gh pr merge 3055 --merge (Owners and Core through the bypass: add --admin).

Updated by pr-readiness on every push, edit and review, and every 30 minutes. Rules: merge policy · labels.

@RyanTheTide

Copy link
Copy Markdown
Author

Answers to the review at 62420ea802f9.

TA progress interval (+0x99c): keeping 100. I tested the 27.2 parity value of 10 on the J473 (row H8: main + this PR with +0x99c = 10, otherwise the same as H7).

  • piglit shader-mem-barrier still passed 145/145.
  • In Geekbench 6 Background Blur, the GPU firmware crashed: an RTKit exception from EL1t with ESR 0x96000044 and FAR 0, and no timeout event first. Every GPU client was lost, and a fresh vkcube afterwards found no device.
  • With 100, the same workload completed in both rows (H6, H7).

That is one sample at 10, so I don't claim 10 always crashes. But it is the only distinguishing J473 evidence there is, and it points away from 10. 100 is also the interval the M3 runtime settled on for valid long TA work (m3/m3_config.rs). The code comment says why it differs from the two 27.2 writers.

+0xe28: our trees have no public name for it. The 13.5 unk_e28 is a HwDataA field, not Globals. Both 27.2 writers (m3/m3_power_26.rs, g16/fw/initdata.rs) set it to 3; this PR does the same and cites them.

Hardware-protection limits: none of these eight words is one. They are firmware progress-poll intervals and compute watchdog timeouts, which decide when the firmware declares GPU work stuck. Thermal, power and voltage words are untouched; they still come from the existing T8112 configuration and ADT.

H7: posted above. It is the exact head without the recovery PR: both workloads pass, 0 timeouts, desktop preserved, production restored and verified.

Peers and legacy control: this code runs only on the G14 27.2 runtime, which is selected by the firmware the Mac hands over. G13, G15, G16 and G17, and the J413 on 13.5, never call it. The J413 13.5 row comes with the next fleet cut. CI has not run on any PR since integration/aurora became main; that is listed under Not yet.

Evidence: traces/gpu/20261124-m2gpu-hang/20261125-000429-j473-h8.

@RyanTheTide

Copy link
Copy Markdown
Author

Verdict at 62420ea802f9b4b7f4caee12d1accc6bad6097c5: Source interval finding cleared. Finish the physical coverage.

Blockers: Record the J413 shared-path regression and the combined candidate row before merging.

Checked: The exact H7 branch uses the longer interval and completed all eight Geekbench Vulkan workloads. H8 was a separate child changing the interval and its test expectation. It lost the GPU during Background Blur, and both fresh Vulkan checks then failed. The lab restored and verified fleet87. The shorter setting stays out of the merge candidate. Hosted host-tests passed on the exact PR head.

Evidence

@DjDeveloperr DjDeveloperr 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 62420ea802f9

Blockers: None. All items from the earlier review at 62420ea802f9 are resolved.

Checked:

  • §1 No model gating & cross-generation isolation: Strictly confined to CONFIG_DRM_ASAHI_G14_V27_2, apple,agx-t8112 (ProbeConfig::LegacyWithG14Handoff, driver.rs:203), and apple,firmware-compat == [27, 2, 0] (driver.rs:404). G13, G14X, G14G on 12.4/13.5 (J413), G15, G16, and G17 never execute RootV27_2::build() or read GLOBALS_PROGRESS.
  • §2 Production-ready & TA interval (+0x99c = 100): Default kernel command line, no new parameters, sleeps, or disabled checks. Seven of eight entries (0x24=3000, 0x78=1, 0x998=40, 0x9a0=250, 0x9c8=40, 0x9cc=50, 0xe28=3) match m3/m3_power_26.rs:222-236 and g16/fw/initdata.rs:518-528 (with named intervals/timeouts matching G14 13.5 initdata.rs:734,797-813 and G17 g17/fw/m5/initdata.rs:1042-1054). Row H8 resolves the single divergence: +0x99c = 10 crashed GPU firmware (RTKit exception EL1t, ESR 0x96000044, FAR 0) during Geekbench 6 Vulkan Background Blur on J473, whereas +0x99c = 100 (matching m3/m3_config.rs:128 and well below cl = 250) passed cleanly in both H6 and H7.
  • §3 Safety: All 8 writes are 4-byte aligned, within GLOBALS_BYTES (0xe48), duplicate-free, flushed with clean_poc() prior to firmware boot, and disjoint from power/thermal/pstate words (0x58/0x5a/0x5c, 0x6e, 0x84, 0x88, 0x8c, 0x98), the power mirror (0x6a0), idle power-off delays (0x9b8..0x9c0), and the runtime idle generation counter (0xe40). None is a hardware-protection limit.
  • §4 Clean-room & attribution: Single commit 62420ea802f9b4b7f4caee12d1accc6bad6097c5 carries human author/committer (Ryan Murray <ryan@aurorasilicon.org>) and human Signed-off-by: only, with clean-room implementation and own traces (traces/gpu/20261124-m2gpu-hang/).
  • §5 Evidence & CI: Exact-head standalone J473 (G14G, firmware 27.2) row H7 at 62420ea8 on main (a3d477d0) passes piglit shader-mem-barrier (145/145) + qualifiers and all 8 Geekbench 6 Vulkan workloads with 0 firmware timeouts, 0 Oops, preserved gnome-shell PID, vkcube/vulkaninfo rc=0, and verified production fleet87 restore (Enforcing, 0 failed units, 0 AVC). Because this path is not shared with 13.5, the J413 13.5 regression row on the next fleet cut is non-blocking. Hosted host-tests passed on exact head; local ABI host tests pass 4/4 with -D warnings.
  • §6 Naming: Clean.
  • Non-blocking nits (for follow-up only): Moving the existing Globals power-word offsets into shared g14_v27_2_abi constants (and including 0x9b8..0x9c0 and 0xe40 in the overlap test) would keep the test synced automatically; the Not yet: line in the PR body about CI can also be dropped now that host-tests passed on 62420ea802f9.
Evidence
  • Exact head verified: 62420ea802f9b4b7f4caee12d1accc6bad6097c5 (PR #3055, OPEN, MERGEABLE on main a3d477d03f8e)
  • Local host ABI check: rustc --test -D warnings drivers/gpu/drm/asahi/g14_v27_2_abi.rs -> 4/4 passed, 0 warnings
  • Hosted CI on exact head:
    • host-tests: success (https://github.com/aurora-silicon/linux/actions/runs/45395231541/job/138449110459)
    • readiness / readiness: success (https://github.com/aurora-silicon/linux/actions/runs/45396368367/job/138453135383; follow-up edit run 45400798988 queued)
  • Hardware rows:
    • H7 standalone exact head (traces/gpu/20261124-m2gpu-hang/20261124-220044-j473-h7): J473 (M2 mini, G14G 27.2), default cmdline, piglit 145/145 + qualifiers pass, Geekbench 6 Vulkan 8/8 pass (rc=0), 0 timeouts/Oops, gnome-shell PID preserved, fleet87 restored (Enforcing, 0 failed units, 0 AVC)
    • H8 TA interval control (traces/gpu/20261124-m2gpu-hang/20261125-000429-j473-h8): +0x99c = 10 crashed firmware in Geekbench 6 Background Blur (RTKit EL1t exception, ESR 0x96000044, FAR 0)

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 24, 2026
@RyanTheTide

Copy link
Copy Markdown
Author

J413 row: 62420ea8 (in the fleet-config build of main 0a7dcb39 + this PR) on the J413 (M2 Air, GPU firmware 13.5): pass, 0 failed units.

This runtime does not run the changed code; the row checks the shared build for regressions.

  • Fresh Vulkan and GL clients pass: vulkaninfo, vkcube 300 frames and glxinfo all return 0 on Apple M2 (G14G B0).
  • glmark2 off-screen scores 7601, against 7647 on the production fleet87 kernel on the same boot sequence.
  • Geekbench 6 Vulkan completes all 8 workloads on both kernels.
  • A 15 s s2idle cycle returns to the same boot, and vkcube after wake returns 0.
  • The kernel log has 0 GPU error lines and 0 Oops/WARN.
  • Production fleet87 was restored afterwards: running and saved, next_entry empty, Enforcing, 0 failed units, 0 AVC.
Evidence
  • traces/gpu/20261125-m2gpu-next/j413-c14 (base/ = production fleet87, trial/ = this build, 9-restored.txt)
  • Kit kits/kernel/20261125-m2combo14 (signed manifest 3366a906)
  • One-shot through a GRUB custom.cfg copy of the production entry with only the kernel and initramfs swapped, so the cmdline is the default one

@RyanTheTide
RyanTheTide merged commit 5c2f6c5 into main Nov 24, 2026
3 checks passed
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) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants