diff --git a/third_party/patches/amdxdna/0010-accel-amdxdna-a-context-that-failed-to-restart-stays-paused.patch b/third_party/patches/amdxdna/0010-accel-amdxdna-a-context-that-failed-to-restart-stays-paused.patch index 7849cb689..01f97b127 100644 --- a/third_party/patches/amdxdna/0010-accel-amdxdna-a-context-that-failed-to-restart-stays-paused.patch +++ b/third_party/patches/amdxdna/0010-accel-amdxdna-a-context-that-failed-to-restart-stays-paused.patch @@ -22,8 +22,10 @@ index 6b8653a..75bc573 100644 + * Only a context that actually came back may take work. Unpausing on the + * failure path submitted jobs to a context firmware no longer has, and the + * only visible symptom was an NPU that had "restarted" and then silently -+ * stopped answering (engine#1750). A context that failed stays paused, so -+ * its jobs get a clean, attributable failure instead of a wedge. ++ * stopped answering (engine#1750). A context that failed stays paused, which ++ * is what THIS path fixes; it is not yet a clean failure, because ++ * aie2_hwctx_fini() unpauses unconditionally and that RUNS parked jobs ++ * instead of failing them (engine#1855, the remaining half of #1750). + */ + if (!ret) { + XDNA_DBG(xdna, "%s restarted", hwctx->name); diff --git a/third_party/patches/amdxdna/README.md b/third_party/patches/amdxdna/README.md index 898695b6c..b3af43497 100644 --- a/third_party/patches/amdxdna/README.md +++ b/third_party/patches/amdxdna/README.md @@ -50,7 +50,7 @@ two-client shape (3/3 wedges on `646FFC30…`) now refuses the second client `co | 0008 | `accel/amdxdna: a dying context must not fail the device resume` (2 files, +33/−4) | `aie2_hwctx_resume_cb()` failed the whole walk on the `-ESRCH` that `aie2_hwctx_restart()` returns for a context whose heap address is gone (a client closing while the device is runtime-suspended), and `aie2_hw_resume()` then `break`s out of the **client** loop: every context of every later client stayed destroyed with no firmware context at all, and `pm_runtime_resume_and_get()` reported failure for a resume that had in fact started the hardware, so `amdxdna_pm_resume_get()` called `pm_runtime_set_suspended()` on a started device | the c29 take's own log: `amdxdna_pm_resume_get: Resume failed: -3` then `amdxdna_drm_close: Resume failed (-3), pid 11374 restore data not reclaimed`, followed immediately by `device is already started` — the resume ran, the dying context made it report failure (engine#1051) | | 0009 | `accel/amdxdna: keep the array awake while a context exists` (1 file, +35/−0) | a runtime suspend destroys every firmware context and the resume recreates them; on this platform a recreated context is created and host-buffer-mapped with the same messages, the same fw ctx id and the same address, `aie2_hwctx_restart()` returns 0 — and its first dispatch still never reaches the DPU (`DPU PC 0xffffffff`, `TXN OP ID 0xffffffff`, `timed out sub command 0`), after which the array wedges until a power-cycle. Take a runtime-PM usage reference for the life of each hw_context (`pm_runtime_get_noresume()` in `aie2_hwctx_init()`, released with `pm_runtime_put_autosuspend()` in `aie2_hwctx_fini()`), so the array cannot enter that state under any client; a device with no contexts still autosuspends at 5 s | the engine#1051 ladder on strixhalo 2026-11-06: **3/3 wedge** with `power/control=auto` on the shipping module, each log showing `Destroyed fw ctx 15` → suspend → `Created fw ctx 15` + host buffer → `restarted, ret 0` → wedge, while the same request into a context created after the resume succeeded and XRT's own validate passed 5/5 across resumes. This is the driver-level form of the c30 keep-awake policy, so it protects every client, not only the payload that polls GET_INFO | -| 0010 | `accel/amdxdna: a context that failed to restart stays paused` (2 files, +16/−3) | `aie2_hwctx_restart()` called `aie2_hwctx_job_unpause()` from its shared `out:` label, so a context whose restart had just **failed** was unpaused anyway, and `aie2_tdr_resume_hwctx()` logged it as restarted either way: the queue then drained onto a `fw_ctx_id` firmware no longer has, and the only visible symptom is an NPU that says it recovered and then silently stops answering (engine#1750). The unpause now happens only on success; a failed context stays paused, so its jobs get a clean, attributable failure instead of a wedge. One change fixes both callers — the TDR resume callback and `aie2_hwctx_resume_cb()` on the pm-resume path, which had the same defect; `aie2_hwctx_init()` keeps its own unpause and is untouched | **carried, NOT measured** — no TDR run yet, and the issue's own first question (does firmware reject a command on a destroyed `fw_ctx_id` cleanly?) is the run that would settle bug vs robustness smell. Verified here instead: it applies **on top of `0001`–`0009`** (`git apply --check` against the series result) and **conflicts on the bare pin**, so it must be applied in series order; and the module **compiles** against `7.4.0-rc1-1bit`'s build tree (`amdxdna.ko`, 14,033,392 B, 0 errors, `aie2_ctx.o` and `aie2_tdr.o` rebuilt), never loaded — `/lib/modules` untouched, no `modprobe`, no parameter changed | +| 0010 | `accel/amdxdna: a context that failed to restart stays paused` (2 files, +16/−3) | `aie2_hwctx_restart()` called `aie2_hwctx_job_unpause()` from its shared `out:` label, so a context whose restart had just **failed** was unpaused anyway, and `aie2_tdr_resume_hwctx()` logged it as restarted either way: the queue then drained onto a `fw_ctx_id` firmware no longer has, and the only visible symptom is an NPU that says it recovered and then silently stops answering (engine#1750). The unpause now happens only on success, so a failed context is no longer drained onto a `fw_ctx_id` firmware has dropped **by the restart path**. It is not yet a clean failure (engine#1855): `aie2_hwctx_fini()` still calls `aie2_hwctx_job_unpause()` unconditionally, and that function **runs** parked jobs (`list_del` + `aie2_job_run`) rather than failing them -- so at close a failed context's parked jobs are submitted to the dead context and nothing signals their fences. `job_paused` cannot distinguish "paused for suspend" from "paused because the restart failed", and that flag is the mechanism the fini half needs; this row is the honest half, the fini half is the remaining half of engine#1750. One change fixes both callers — the TDR resume callback and `aie2_hwctx_resume_cb()` on the pm-resume path, which had the same defect; `aie2_hwctx_init()` keeps its own unpause and is untouched | **carried, NOT measured** — no TDR run yet, and the issue's own first question (does firmware reject a command on a destroyed `fw_ctx_id` cleanly?) is the run that would settle bug vs robustness smell. Verified here instead: it applies **on top of `0001`–`0009`** (`git apply --check` against the series result) and **conflicts on the bare pin**, so it must be applied in series order; and the module **compiles** against `7.4.0-rc1-1bit`'s build tree (`amdxdna.ko`, 14,033,392 B, 0 errors, `aie2_ctx.o` and `aie2_tdr.o` rebuilt), never loaded — `/lib/modules` untouched, no `modprobe`, no parameter changed | | 0011 | `accel/amdxdna: document trusted mailbox ring geometry and drop the power-of-two check` (1 file, +7/−5) — **carried, NOT installed** | `xdna_mailbox_start_channel()` refused any channel whose firmware-supplied `rb_size` was not a power of two (`-EINVAL`), which turns a ring geometry AMD's signed firmware handed us into a channel that cannot start at all. Upstream drops the check and documents that the geometry, `rb_start_addr` and `rb_size` come from signed firmware and are trusted by design | **carried, NOT measured** — no run has needed a non-power-of-two ring here, so this is a port of an upstream decision rather than a fix we have watched. Verified: the file is the upstream change unmodified, and it `git apply --check`s **both** on the bare pin (`526c6081`) and on top of `0001`–`0010`, so it is order-independent in the series. Never loaded: `/lib/modules` untouched, no `modprobe`, no parameter changed | | 0012 | `accel/amdxdna: Reject device heap BO when dev_mem_size is not set` (1 file, +5) — **carried, NOT installed** | a heap-BO request on a device with no heap hit a `WARN_ON` and a bogus alignment test instead of one quiet refusal; upstream returns `-EOPNOTSUPP` from the allocation path. Ours warns today (`amdxdna_gem.c`), so this removes a warning from a hot path rather than changing behaviour anyone has depended on | **carried, NOT measured** — the warn path has not been hit on this box in the fleet's runs. Verified the same way: unmodified upstream change, applies on the bare pin and on `0001`–`0011`. Not loaded |