Repository navigation
drm/asahi: g17: blame GPU page faults on the faulting VM, and see through a stale fault reason - #2227
Conversation
On a page fault, recovery kept the queue the firmware blamed, which can be a bystander. On 2026-11-06 a compute test's write fault (units CMP(2) and CMP(0), UAT slot 17 in both fault banks) was blamed on a render queue of another VM (context 19). That render failed with EIO and its client lost the device, while the test's interrupted compute was spared, replayed and faulted again 0.3 ms later. The MMU fault banks name the UAT slot of each faulting access, and every in-flight packet carries the context ID of the slot it runs in. Collect the faulting slots while the firmware is halted. When the in-flight work in those slots does not include the blamed queue, blame that work instead, so classification spares the bystander's VM and fails the faulting one. Without a decodable fault, without in-flight work in the faulting slots, or when the blamed queue is among that work, the firmware's blame stands. Signed-off-by: Jonathan Goyvaerts <[email protected]>
c69af9c to
7ad036e
Compare
|
Commit messages only, for the pre-PR checklist: the commits no longer carry Assisted-by: LLM (Claude:Opus 5.5) |
|
Blockers: 1. Commit 1 is sound.
HW row: J616s (25G83) and the Neo (26A428), this head with the gate removed. Run the 11-18 deqp-vk Assisted-by: LLM (Claude:Opus 5.5) |
7ad036e to
f8809c5
Compare
|
Fixed in The Testing: arm64 The J616s row will follow the next kernel build of our tree. The physbuffer case under a compositor stays with the owner. We'd take your offer to run the Neo (26A428) row in your lab. Assisted-by: LLM (Claude:Opus 5.5) |
… timeout On 2026-11-18 at 16:39:57 UTC one deqp-vk hang (memory_model u64 atomics, a fragment shader spinning on a lock) cost T3 Code and Hyprland their devices, and the desktop with them. The first restart failed deqp-vk's interrupted render, as it should. Its next queued render spun again, and 83 ms later the firmware blamed T3 Code's queue 40, whose render was waiting behind it, then Hyprland's queue 36, whose oldest render had never started. Both took EIO, which marks the VM lost. The checks that catch a starved bystander did not run. Every one of those restarts read reason 3, page fault, and for a page fault host_fallback keeps the firmware's blame. fault_override needs a decoded MMU fault, and both fault banks read clear. The same spin on the same boot at 03:40 UTC read reason 0. host_fallback then moved the blame to deqp-vk's running render, and nothing else failed. The reason word is not this restart's. The firmware (here 25G83) writes it only for some restarts, and nothing clears it. Reason 0 shows only in a boot's first recoveries. A real page fault at 04:30 left it at 3 for every later spin. Every other reason-3 recovery on record has a decoded fault in at least one bank (04:30 and two on 11-17), because the faulting access stays latched until the restart. Whenever the reason comes from the firmware's reason word, read the fault banks while the firmware is halted. When the word says page fault but neither bank holds a valid fault, treat the restart as a non-fault restart: slot identity and the host's pass records may correct the firmware's blame, as they do for a timeout. A latched fault in either bank keeps the page-fault handling unchanged. The latch belongs to the MMU, not to a firmware build, so the check runs on every firmware that has the word, the A18 Pro's 26A428 included. M5 has no reason word: its page fault comes from its latched fault register and is not checked against the banks. Sources::settle_reason holds that rule in one place. Signed-off-by: Jonathan Goyvaerts <[email protected]>
f8809c5 to
f52bf1b
Compare
|
New head f52bf1b, which changes one line from f8809c5. Assisted-by: LLM (Claude:Opus 5.5) |
There was a problem hiding this comment.
Adversarial review at f52bf1b7895a against the pre-PR checklist.
No code, CI, attribution, or policy blockers remain:
- CI & Attribution/Policy (§1–§4, §6):
host-testsis green onf52bf1b7895a; both commits carry human author/committer and humanSigned-off-by:only; PR body disclosure is clean. The earlierInitGraph::V25G83firmware gate has been removed in favor ofSources::settle_reason, and the unusedPAGE_FAULTre-export warning indrivers/gpu/drm/asahi/g17/recovery.rs:14is fixed. - Commit 1 (
02e85f129073):report_mmu_fault()(runtime/events.rs:280-306) skips firmware slot 0 and useschecked_shl;fault_qids()(recovery/attribution.rs:261-269) bounds-checks context IDs against the 64-bit slot mask;fault_override()(recovery/attribution.rs:239-256) only overridesAttribution::Firmwareon an activepage_fault()with a blamed queue (< 128enforced byrecovery::State::request()) when the faulting slots' in-flight work excludesblamed. - Commit 2 (
f52bf1b7895a):Sources::settle_reason()(recovery/attribution.rs:142-170) cleanly keys the fault-bank check on whethersources.reasoncame from the firmware's reason word vs M5's latched fault register (mmu_fault), and fails safe when banks are unreadable. - Minor non-blocking nit: In
Sources::settle_reason()(recovery/attribution.rs:143-146), checkingif self.reason == Some(PAGE_FAULT)before callingbanks()would avoid an extrafault_banks()MMIO bank-select round trip on non-page-fault recoveries (sincereport_mmu_fault()reads the banks right afterward anyway).
Remaining before approval (§5)
- J616s (25G83) on current head
f52bf1b7895a(default command line): the 11-18deqp-vkmemory_model ... u64 ... physbuffer.fragcase under a running compositor (onlydeqp-vkgetsEIO, 0 lost devices for other clients) plus a regression check (0 SELinux denials, 0 failed units, 0 new kernel errors). - A18 Pro / Neo (26A428) boot running the same case, since
settle_reasonnow applies there as well.
|
Re-checked at f52bf1b: the Assisted-by: LLM (Claude:Opus 5.5) |
There was a problem hiding this comment.
Formal §1–§6 pre-PR review at f52bf1b7895ace43d5e7be6af537eb7286777a20 (re-verified against live integration/aurora 70a00e583b03; formalizing the §5 hold from the earlier COMMENTED review): REQUEST_CHANGES.
Audit Summary (§1–§4, §6)
- Code correctness & lifetimes: 0 blockers.
- Commit 1 (
02e85f129073):report_mmu_fault()(drivers/gpu/drm/asahi/g17/runtime/events.rs:280-306) skips firmware slot 0 and useschecked_shl;fault_qids()(drivers/gpu/drm/asahi/g17/recovery/attribution.rs:261-269) bounds-checks context IDs against the 64-bit slot mask;fault_override()(attribution.rs:239-256) overridesAttribution::Firmwareonly on an activepage_fault()when the faulting slots' in-flight work excludesblamed. - Commit 2 (
f52bf1b7895a):Sources::settle_reason()(attribution.rs:142-170) cleanly keys the fault-bank check on whethersources.reasoncame from the firmware's reason word vs. M5's latched fault register (mmu_fault), removes the oldInitGraph::V25G83firmware gate, and fails safe when banks are unreadable.
- Commit 1 (
- §1–§4, §6 & CI: PASS — not superseded on
integration/aurora,mergeable: clean,host-testsgreen, human author/committer + humanSigned-off-by:only on both commits, PR body carriesAssisted-by:, naming clean.
Blockers (§5 Evidence)
- Missing exact-head (
f52bf1b7895a) hardware & regression evidence:- J616s (M4 Pro / 25G83) on default command line with head
f52bf1b7895a: rerun the 11-18deqp-vkmemory_model ... u64 ... physbuffer.fragcase under a running compositor confirming onlydeqp-vkreceivesEIO(0 lost devices for other clients), plus a boot regression check (0 SELinux denials, 0 failed units, 0 new kernel errors). - A18 Pro / Neo (26A428): same recovery/containment run on
f52bf1b7895a, sincesettle_reason()now applies on every firmware carrying the reason word.
- J616s (M4 Pro / 25G83) on default command line with head
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at f52bf1b7895a: the code is ready; it needs one more row.
Blockers: none in the code. Missing row: this is G17 recovery code shared by M4, M5 and the Neo, so before it merges it also needs the same hang case at this head on an M5 or Neo, with the faulting client blamed and no bystander lost. We'll run it on our J714s or J700.
Checked: no Apple material, no gates. The J616s run carries the same lines as this head in a batched kernel, which counts as the M4 row: the 11-18 memory_model … physbuffer.frag hang case 10 times under a compositor, with only deqp-vk failed and no desktop client lost. CI green.
Superseded by the review at f52bf1b
|
J714s (M5 Pro, T6050, G17S B1) row at Kernel: candidate On-demand fault-blame & hang verification (headless, beside Hyprland + 10 desktop DRM clients + live
|
Conflicts, and how they were resolved: - g17/recovery.rs: main's aurora-silicon#2227 page-fault evidence (fault_qids, report_mmu_fault() returning the faulting slots, fault_culprit, fault_override) sits next to this branch's collateral hooks (collateral_before, note_collateral, marks_collateral, note_kill_sightings). Both are kept. In service() the host fallback runs first and fault_override second, as on main, and the Suspects log line stays. Attribution stays pub(crate) for render_culprit(). - g17/recovery/attribution.rs: a aurora-silicon#2227 test called host_fallback() with a culprit closure returning Option<u128>. On this branch the closure returns the attribution, so that call now passes Some(Attribution::Queues(..)). The assertion is unchanged. - g17/queue/admission.rs: try_acquire_render() keeps this branch's owner_released() check, with main's has_live_owner() in place of the owners scan. - tools/asahi: admission harnesses extract both sides' State helpers, and run-host-tests.py lists both sides' mutations and main's new g17-m5-effort test. One behaviour to note: fault_override() returns Queues only when the faulting slots exclude the blamed queue. A page fault in the blamed VM stays Attribution::Firmware, so with this branch's rule it is collateral once, and its VM is guilty at the next fault. aurora-silicon#2500's restart charge in classify() is unchanged: a collateral or suspect-only restart has no guilty client and counts toward the device. Signed-off-by: Jonathan Goyvaerts <[email protected]>
Post-merge J616s (M4 Pro, T6040, 25G83) verification at
|
What: Two fixes to how G17 recovery blames a GPU page fault, both found with 25G83 on the M4 Pro. (1) Recovery kept the firmware's blamed queue on a page fault, which can be a bystander; it now blames the in-flight work of the UAT slots the MMU fault banks name. (2) The firmware's reason word can stay at "page fault" from an earlier real fault, which cost T3 Code and then Hyprland their devices in one deqp-vk hang; a reason-3 restart with no latched MMU fault is now judged like a timeout.
Tested: J616s M4 Pro (T6040, 25G83) with this PR's code, in our test kernel 7.3.0-m4.184 (not a standalone kernel; it adds the same lines as head
f52bf1b7895aon another base, and carries other G17 recovery work), 2026-11-24 03:25 UTC: the 11-18memory_model ... u64 ... physbuffer.fraghang case 10 times under a running compositor. deqp-vk was failed in all 9 hanging runs, and no desktop client (Hyprland, the bar, T3 Code) was failed; 0 restart-storm stops, 0 err-level kernel lines, 0 failed units, no SELinux/AppArmor loaded. In run 6 an off-screen test bystander (tvbstress) also got one EIO from the firmware's blame while foreign compute was in flight (the firmware-blame fallback for foreign compute, outside this PR's code); its VM was kept. Every recovery line read reason 0 with both fault banks clear, so this row covers containment and the bank read, not the stale reason-3 path or the slot override. KUnit at this head 725/727 (asahi_g17_recovery_sources15/15), host tests--only g1790/90.Risk: two-way door · the G17 Macs: M4 (incl. Pro/Max), M5 and Neo (A18 Pro). The fault override (commit 1) runs on each of them, M5 included (same bank registers); the stale-reason check (commit 2) wherever the reason comes from the firmware's reason word (M4 family, Neo 26A428), not M5. Checked unaffected: only the J616s.
Not yet: the stale reason-3 path on hardware (no safe way found to cause a real page fault on demand on G17P; KUnit covers it); commit 1's override firing live; the M4, M4 Max, A18 Pro (26A428) and M5; a standalone
integration/aurora+ this PR J616s run.Details
1. Blame a page fault on the VM the MMU fault record names. On a page fault, recovery kept the queue the firmware blamed, and that can be a bystander. On 2026-11-06, a compute test's write fault (units CMP(2) and CMP(0), UAT slot 17 in both fault banks) was blamed on a render queue of another VM. That render failed with EIO and its client lost the device. The test's interrupted compute was spared, replayed, and faulted again 0.3 ms later.
The fault banks name the UAT slot of each faulting access, and every in-flight packet carries the context ID of its slot. Recovery now collects the faulting slots while the firmware is halted. When the in-flight work in those slots does not include the blamed queue, recovery blames that work instead. The firmware's blame stands without a decodable fault, without in-flight work in those slots, or when the blamed queue is among that work.
2. Judge a page fault without a latched MMU fault like a timeout. On 2026-11-18, one deqp-vk hang cost T3 Code and then Hyprland their devices. The hang was a fragment shader spinning on a lock (
memory_model ... u64 ... physbuffer.frag). Every restart in that cascade read reason 3 (page fault) with both fault banks clear. For a page fault,host_fallbackkeeps the firmware's blame, which was "whoever the spinner starved". The same spin, earlier on the same boot, read reason 0, andrender_culpritcontained it.The firmware (25G83 here) writes the reason word only for some restarts, and nothing clears it. A real page fault at 04:30 left it at 3 for every later spin. Every other reason-3 recovery on record has a decoded fault in at least one bank, because the faulting access stays latched until the restart. A reason-3 restart with neither bank valid is now judged like a timeout. A latched fault keeps the page-fault handling. The latch is a property of the MMU, not of a firmware build, so the check is keyed on where the reason came from, not on the firmware: it runs whenever the reason came from the firmware's reason word, which includes the A18 Pro's 26A428 (
Sources::settle_reason). M5 has no reason word. Its page fault comes from its latched fault register and is not checked against the banks.Known limits:
Evidence
Hang case under a compositor, test kernel 7.3.0-m4.184 (2026-11-24 03:25-03:30 UTC)
The kernel's two commits add the same lines as
02e85f129073andf52bf1b7895a; only context lines of the base differ (auselist), so the patch-ids are not equal. The kernel also carries other G17 recovery changes under review (#2504 and follow-ups).dEQP-VK.memory_model.write_after_read.ext.u64.coherent.atomic_atomic.atomicrmw.queuefamily.payload_local.image.guard_local.physbuffer.frag, 10 runs in a row beside a drawing desktop:capability,landlock,yama: no SELinux or AppArmor loaded, 0avc:lines.Earlier: the 11-18 case, rerun once on a kernel with both commits (guarded)
The reason word was still 0 on that boot, so this run tests containment and the new bank read at every recovery, not the stale reason-3 path:
Only deqp-vk failed. Hyprland, the bar and T3 Code kept running. Commit 1 has run in our kernels since 11-06, and commit 2 since 11-18.
On this branch
KUnit 703 of 704 passed, one skipped (needs
CONFIG_UCLAMP_TASK). The new tests inasahi_g17_recovery_sourcescover the slot override, both stale-reason cases (no bank latched, either bank latched), and which reasons are checked against the banks (a firmware reason word on any firmware, never M5's fault-register reason). After the firmware gate was removed (11-21): KUnit 725 of 727 passed, one skipped, andasahi_g17_recovery_sourcespassed 15/15. The one failure,apple-isp-hw.isp_test_sensor_sysfs, also fails onintegration/aurora.tools/asahi/run-host-tests.py --only g17passed 90/90. CIhost-testsgreen atf52bf1b7895a.Why the stale reason-3 path is not reproduced on hardware
We found no safe way to cause a real page fault on demand on G17P. Unmapped shader reads return zero, unbound sparse pages are backed by scratch, and indirect dispatch goes through a helper shader. In the real faults since, the firmware already blamed the faulting VM, so commit 1's override has not fired live either.