Repository navigation
accel/ane: h16: take a program's process pool before LOAD - #3159
Conversation
Every CREATE makes the H16/H17 firmware ask for a 2 MiB EXPP process pool by SHAREDMALLOC, and it answers the CREATE only once that request was served. A request the host cannot serve, for lack of memory or of the 12 MiB shared quota, is never answered: the transport fails, the CREATE is lost, and the session is quarantined, taking every other loaded program with it. The host knows the request is coming, so take the pool first: before a LOAD (and a replay), make sure a retired EXPP allocation is there, allocating one now and keeping it retired if not. The firmware's request then reuses it as it reuses any pool given back by FREE. With no memory or no quota the LOAD now fails with -ENOMEM or -ENOSPC before any traffic, the engine stays up and every other program keeps running. A FREE of a torn-down program's pool that is still posted is served first, and the reservation tried once more. The firmware's request still goes through the same checks; a request the host did not foresee and cannot serve fails the transport as before. KUnit: past the quota a LOAD fails with -ENOSPC and no command sent, the other programs keep running and a closed program's pool serves the next LOAD; no memory gives -ENOMEM the same way; a FREE posted after the settle is served by the next LOAD; and at the transport level a reserved allocation serves its request without an allocation and a refused reservation leaves the transport working. The fake firmware now asks for the pool during CREATE and frees it after UNLOAD. [ported from niteria/linux 1e518c5 (ane/h17-cma-enomem), which has no Signed-off-by; onto the per-program command records: the replay takes the pool before its record instead of after an arena room check] Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
A shared allocation the backend hands back for a firmware request is checked (16 KiB aligned DVA, exact size, no overlap with the IPC area, the command pool or another allocation), and one that fails the check fails the transport. The same check runs when a LOAD reserves its process pool ahead of the request, but there it only returned -EPROTO: the backend's mapping is not recorded, so every later LOAD made and dropped another 2 MiB mapping that the backend keeps until teardown. Fail the transport there as well, and quarantine the session when a reservation finds the transport failed, as the request path does. KUnit: a misaligned backend surface fails the reservation with -EPROTO, fails the transport, records nothing, and a second reservation does not allocate again. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
ane_h16_session_replay() documents that a failed replay quarantines the session, but h16_replay() returns before h16_fail() when taking the process pool fails (-ENOSPC, -ENOMEM), when the command buffer cannot be allocated, or when no firmware record is free. The caller then logs "PROGRAM REPLAY FAILED" and the backend reports the session quarantined while s->quarantined stays false, so requests reach firmware whose state is uncertain. Quarantine in ane_h16_session_replay() for any replay error. h16_fail() keeps the first error and reports the hang once, so a replay that already failed the transport is unchanged. KUnit: a replay that cannot take its process pool fails with -ENOMEM, replays nothing and quarantines the session, reported once. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Reviewed eaa0b0c12f67: ane_fw_shared_add() / ane_fw_transport_shared_reserve() cleanly pre-reserve the 2 MiB EXPP process pool before LOAD/replay (failing transport on -EPROTO while keeping -ENOMEM/-ENOSPC non-fatal), h16_process_pool() settles once on -ENOSPC for late post-UNLOAD frees, and ane_h16_session_replay() now quarantines via h16_fail() on every early replay error (verified by the new KUnit test). Holding merge for CI, exact-head H17 + Neo rows, and @niteria's Signed-off-by:.
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
main gained the H16 runtime-PM tests (#3154) next to the process-pool tests in ane_h16_program_test.c; both sets are kept. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Re-reviewed after merging main at 2eb63b78faed: cleanly keeps both the #3154 H16 runtime-PM tests and #3159's process-pool pre-reservation/replay tests (329/330 ANE KUnit pass, 1 skip). Holding merge for CI, exact-head H17 + Neo rows, and @niteria's Signed-off-by:.
|
Verified Signed-off-by: Bartosz Nitka niteria@gmail.com |
Hardware row at
|
|
|
|
Merged as e12e25d. The merge commit records Bartosz's Signed-off-by for 4428291, from his comment here: #3159 (comment) |
What
Replaces #2897 (conflicted with main; new branch on main 569ff3d, no force push). Every H16/H17 CREATE makes the firmware ask for a 2 MiB process pool, and a request the host cannot serve used to fail the transport and quarantine every loaded program. The driver now takes the pool before LOAD, so a LOAD past the quota or out of memory fails with -ENOSPC/-ENOMEM and the engine and other programs keep running. Three commits:
accel/ane: h16: take a program's process pool before LOAD(ported; one KUnit-file conflict with main's recover-gate test, both kept).accel/ane: fail the transport when a reserved shared pool is invalid(unchanged from accel/ane: h16: take a program's process pool before LOAD #2897).ane_h16_session_replay()quarantines the session on any replay error, including the early -ENOSPC/-ENOMEM returns that skippedh16_fail().@niteria: your original commit (niteria/linux
1e518c576e74) has noSigned-off-by, so it goes in under Ryan's DCO (b) sign-off with the source noted in the message. Could you reply here with yourSigned-off-by:line so it can be added?Tested
program_process_pool_replay_nomem_testfails (session not quarantined, hang not reported) and everything else passes. Logs: traces/ci/20261126-pr-burndown-2897v2 (lab store).Risk
Risk: two-way · M4 Pro, M4 Air, M5, Neo (a plain revert undoes it).
H16/H17 ANE only. A replay that fails early now quarantines the session (as documented) instead of leaving it open on firmware in an unknown state; the backend's recovery handles a quarantined session the same as after any other failed replay.
Not yet
ane_fw_cold.cpath), plus one Neo no-regression row (kits/test/20261123-sec-ane2-29/drive.sh).Review items from #2897
h16_replay()early returns withouth16_fail(): fixed in the caller, covers every early return; KUnit added.