Skip to content

accel/ane: fail a DART fault that clears before it is handled - #980

Merged
joshuaswarren merged 1 commit into
integration/aurorafrom
ane/tm-transient-dart-fault
Nov 5, 2026
Merged

joshuaswarren merged 1 commit into
integration/aurorafrom
ane/tm-transient-dart-fault

Conversation

@joshuaswarren

@joshuaswarren joshuaswarren commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

The ANE completion poll reported success for a DART fault that cleared before it was handled. It now fails the request and recovers. The new host test fails four cases on the old code and passes all seven cases with this change.

This is the poll and error propagation change of omarchy-ane #359 (merge 20629c55).

How it maps to #359:

#359 This tree
ane_tm_poll_step() returns -EIO on a latched fault Ported in drivers/accel/ane/ane_tm.c
Carry the scratch cap and the drain failure into err Ported in the same function
Retain scratch when completion is unknown Different form: ane_tm_execute() never releases scratch on the wedge path, and ane_reclaim_preserved() releases it only after a verified power cycle. #359 keeps the scratch until reboot and makes ane_tm_recover() return -EBUSY; that flag is not ported
Runtime-PM balance in close and release Nothing to port: ane_drm_release() takes pm_runtime_get_sync(), which raises the usage count even when the resume fails, and puts it unconditionally, so the pair is balanced. ane_drm_postclose() only runs from drm_release() inside that reference

Test: tools/asahi/ane-tm-transient-fault-tests.py compiles the production poll and execute functions against a simulated DART latch. Seven cases: normal completion, a fault that clears before the second read, a drained fault, a fault seen only by the last poll, a failed second drain, a scratch cap with a clear latch, and the scratch cap with the latch held.

  • Old revision b5006684: four cases fail. The second read case returns 0. The last-poll case releases scratch without recovery. The failed drain loses its error. The scratch cap with a clear latch releases four scratch pages with no recovery.
  • This head: all seven pass, and the registered old-revision control in run-host-tests.py passes.
  • Run with run-host-tests.py --only ane-tm. No hardware ran this; it is a host test only.

Does not cover: runtime behavior on an M1 or M2, a verified reclaim of scratch after a power cycle, and the timeout path.

The completion poll stops when the DART error latch is set, but it
returned 1, the same value as a finished request. If the latch cleared
before ane_tm_execute() read it again, no fault was recorded and the
request went on to the completion check and returned success although
the engine never completed. If a drained fault cleared the same way,
the scratch pages were released without a recovery.

Return -EIO from the poll step so the poll reports the fault itself.
Carry the scratch cap and the drain failure into err as well, so a
fault that clears after them ends in the recovery path and keeps the
scratch mappings until a verified reset reclaims them.

This is the poll and error propagation change of omarchy-ane #359
(merge 20629c55). The scratch lifetime part of that change is already
present here in a different form: this driver keeps the scratch pages
in struct ane_device, never releases them on the wedge path, and
releases them in ane_reclaim_preserved() after a verified power cycle.

The host test builds the production poll and execute code against a
simulated latch. The old revision fails four cases: a fault that
clears before the second read returns 0, a fault seen only by the
last poll releases scratch without recovery, a failed drain loses its
error, and a scratch cap followed by a clear latch releases the
scratch without recovery.

Assisted-by: LLM
Signed-off-by: Joshua Warren <[email protected]>
@joshuaswarren
joshuaswarren force-pushed the ane/tm-transient-dart-fault branch from 5a3cc1f to 5cb969f Compare November 5, 2026 08:16
@joshuaswarren
joshuaswarren marked this pull request as ready for review November 5, 2026 08:23
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-05T08:23:02.881476Z
We couldn’t complete this review. Comment @codex review to try again.
5cb969f Draft marked ready
🔒 Security Review ⚠️ Failed 2026-11-05T08:23:08.082081Z
We couldn’t complete this review. Comment @codex security review to try again.
5cb969f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@chatgpt-codex-connector

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

GREEN at 5cb969f

Checked at this head: the transient fault test passes 7 of 7 cases. Against the base revision b500668, the same script fails 4 cases, matching the PR description. Read the poll step and execute changes: a fault that clears before the second latch read now returns -EIO and takes the wedge path, where the base returned success. A failed scratch drain is no longer dropped.

Behavior note: a transient fault that clears now wedges the device and runs one recovery. That follows from failing the request; say if the wedge should be reserved for uncleared faults.

Not checked: a kernel build and any run on hardware. The host harness calls the poll op once per check, so multi-iteration polls are not exercised by the test.

@joshuaswarren
joshuaswarren merged commit 6154b01 into integration/aurora Nov 5, 2026
@RyanTheTide
RyanTheTide deleted the ane/tm-transient-dart-fault branch November 7, 2026 00:54
joshuaswarren added a commit to joshuaswarren/linux-aurora that referenced this pull request Nov 9, 2026
The completion poll stops when the DART error latch is set, but it
returned 1, the same value as a finished request. If the latch cleared
before ane_tm_execute() read it again, no fault was recorded and the
request went on to the completion check and returned success although
the engine never completed. If a drained fault cleared the same way,
the scratch pages were released without a recovery.

Return -EIO from the poll step so the poll reports the fault itself.
Carry the scratch cap and the drain failure into err as well, so a
fault that clears after them ends in the recovery path and keeps the
scratch mappings until a verified reset reclaims them.

This is the poll and error propagation change of omarchy-ane AsahiLinux#359
(merge 20629c55), the same change as aurora-silicon/linux#980. The
scratch lifetime part of AsahiLinux#359 is already present here in a different
form: the scratch pages live in struct ane_device, the wedge path never
releases them, and ane_reclaim_preserved() releases them after a
verified power cycle.

The host test builds the production poll and execute code against a
simulated latch. The base revision fails four of seven cases: a fault
that clears before the second read returns 0, a fault seen only by the
last poll releases scratch without recovery, a failed drain loses its
error, and a scratch cap followed by a clear latch releases the scratch
without recovery. With this change all seven pass.

Assisted-by: LLM
Signed-off-by: Joshua Warren <[email protected]>
joshuaswarren added a commit to joshuaswarren/linux-aurora that referenced this pull request Nov 10, 2026
The completion poll stops when the DART error latch is set, but it
returned 1, the same value as a finished request. If the latch cleared
before ane_tm_execute() read it again, no fault was recorded and the
request went on to the completion check and returned success although
the engine never completed. If a drained fault cleared the same way,
the scratch pages were released without a recovery.

Return -EIO from the poll step so the poll reports the fault itself.
Carry the scratch cap and the drain failure into err as well, so a
fault that clears after them ends in the recovery path and keeps the
scratch mappings until a verified reset reclaims them.

This is the poll and error propagation change of omarchy-ane AsahiLinux#359
(merge 20629c55), the same change as aurora-silicon/linux#980. The
scratch lifetime part of AsahiLinux#359 is already present here in a different
form: the scratch pages live in struct ane_device, the wedge path never
releases them, and ane_reclaim_preserved() releases them after a
verified power cycle.

The host test builds the production poll and execute code against a
simulated latch. The base revision fails four of seven cases: a fault
that clears before the second read returns 0, a fault seen only by the
last poll releases scratch without recovery, a failed drain loses its
error, and a scratch cap followed by a clear latch releases the scratch
without recovery. With this change all seven pass.

Assisted-by: LLM
Signed-off-by: Joshua Warren <[email protected]>
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.

1 participant