Repository navigation
accel/ane: fail a DART fault that clears before it is handled - #980
Conversation
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]>
5a3cc1f to
5cb969f
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
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. |
|
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. |
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]>
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]>
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:
ane_tm_poll_step()returns-EIOon a latched faultdrivers/accel/ane/ane_tm.cerrane_tm_execute()never releases scratch on the wedge path, andane_reclaim_preserved()releases it only after a verified power cycle. #359 keeps the scratch until reboot and makesane_tm_recover()return-EBUSY; that flag is not portedane_drm_release()takespm_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 fromdrm_release()inside that referenceTest:
tools/asahi/ane-tm-transient-fault-tests.pycompiles 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.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.run-host-tests.pypasses.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.