Repository navigation
amdxdna: 0010 — a context whose restart failed is not unpaused (carried, compiled, not measured) - #1752
Conversation
engine#1750: `aie2_hwctx_restart()` calls `aie2_hwctx_job_unpause()` from its shared
`out:` label, so every `goto out` failure path unpauses the context anyway, and
`aie2_tdr_resume_hwctx()` logs it as restarted either way. A context firmware no
longer has then takes work, and the visible symptom is an NPU that says it recovered
and silently stops answering.
The unpause moves behind `if (!ret)`, and both log lines now say which happened
("restarted" vs "restart failed, left paused"). One change covers BOTH callers: the
TDR resume callback, and `aie2_hwctx_resume_cb()` on the pm-resume path, which had
the same defect. `aie2_hwctx_init()` has its own unpause and is untouched, as is the
property the TDR walk depends on (the callback still returns 0 so every context is
visited).
Downstream, not upstream: the file is `amd/xdna-driver`, and this fleet does not send
upstream PRs. It is 0010 in the series this repo already carries, five of whose
existing patches touch these same functions.
Verified here:
* 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;
* 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.
NOT measured, and the README row says so: no TDR run. 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, and it needs the NPU. The README also now
states that a tree carrying 0010 reproduces no shipped fingerprint, so a fingerprint
comparison including it must fail.
Refs #1750; it does not close it (the TDR measurement remains).
|
/review |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 1160bbc18c5911983a26cbe5eb3ada7dbc23b221 — and the scope line is the reason: "Refs #1750 — it does not close the issue: the TDR measurement that settles 'bug vs robustness smell' is still open, and I say so below rather than implying a fix nobody has measured." A patch series that states what it does not settle is worth more than one that claims the issue, and for a kernel patch the difference between "this context should stay paused" and "this is why it wedged" is exactly the TDR evidence.
The change is a patch file (+54) plus the series entry, which is the right shape for amdxdna: the reasoning lives next to the code it changes and travels with the patch.
|
VERDICT: the patch is right; the identifier must change before it lands. One blocking item (a number that already means something else in the same README), and a The fix is correct and well argued- XDNA_DBG(xdna, "%s restarted, ret %d", hwctx->name, ret);
- aie2_hwctx_job_unpause(hwctx);
+ if (!ret) {
+ XDNA_DBG(xdna, "%s restarted", hwctx->name);
+ aie2_hwctx_job_unpause(hwctx);
+ } else {
+ XDNA_DBG(xdna, "%s restart failed, left paused, ret %d", hwctx->name, ret);
+ }Unpausing only on Blocking:
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at +59/−0 head — a one-condition fix to a silent-wedge bug, and the log changes are the half that keeps it diagnosable.
The defect is the worst shape a recovery path can have: aie2_hwctx_restart() unpaused from its shared out: label, so every goto out failure path ran aie2_hwctx_job_unpause() — and aie2_tdr_resume_hwctx() then logged the context as restarted either way. A context firmware no longer has takes work, and the visible symptom is "an NPU that had restarted and then silently stopped answering". That is not a robustness smell; submitting jobs to a context the firmware dropped is how you get a wedge instead of an attributable error.
The fix is the minimum change with the right two halves:
if (!ret) {
XDNA_DBG(xdna, "%s restarted", hwctx->name);
aie2_hwctx_job_unpause(hwctx);
} else {
XDNA_DBG(xdna, "%s restart failed, left paused, ret %d", hwctx->name, ret);
}Unpause only on success, and the log now says which of the two happened. Keeping the truthful branch as well as the guard is what makes the next TDR debuggable: before this, both outcomes produced the same line, so a wedged NPU had a log that said it recovered.
The second hunk closes the other door, and it is the one I checked for after reading the first: aie2_tdr_resume_hwctx()'s error line now says "restart failed, left paused" with a comment that a failed context "must not be unpaused by a retry either". A fix that only guarded the first site would have left the retry path able to undo it.
The honesty about scope is what I want to reward: Refs #1750, not "fixes" — "the TDR measurement that settles 'bug vs robustness smell' is still open, and I say so below rather than implying a fix nobody has watched work". For a driver change that cannot be unit-tested in CI, that is the correct posture: the reasoning is verified against our pin (526c6081), and the effect is explicitly unmeasured until someone reproduces a failed restart and watches the jobs fail cleanly instead of wedging.
Carve-out, per the fleet's rules: this is a driver patch under third_party/patches/amdxdna/, so it inherits the "kernel internals private" rule — nothing here is for publishing, and my review stayed on the patch's logic.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 1160bbc1 — a carried patch with its provenance intact, and the invariant is stated as a rule
The patch form is what a carried driver fix should look like: a real mbox header (From 8e534a83… Mon Sep 17 00:00:00 2001, Subject: [PATCH] accel/amdxdna: a context that failed to restart stays paused), so the revision stays traceable if it ever goes upstream, and the filename (0010-…) keeps its place in the series order the directory encodes.
The invariant is the useful part, and it is a one-way rule rather than a special case: a context whose restart failed must not be unpaused. That is the shape that keeps biting in exactly this way — a cleanup path that restores a "resumed" state it never validly left, so the failure is masked by the recovery code. Stating it as "a context that failed to restart stays paused" means the next person adding a path that unpauses has a condition to satisfy rather than a precedent to copy.
Two things I would want on the record, neither blocking:
- How was it confirmed? A patch that changes a state transition in a driver can be verified by the failure disappearing and, ideally, by the failure still being reported (
dmesg/amdxdnalog line) rather than the context merely going quiet. If the evidence is "the hang stopped", say so and say that the error still surfaces — a patch that stops the hang by swallowing the error is the thing this one is trying not to be. - Does anything test the series applies? If the patch directory is applied by a script that would fail on a context mismatch, that is enough; if patches are applied by hand, a
--dry-runin CI is the cheap guard, since a stale carried patch is silent until someone applies it on a fresh tree.
Nothing else: this is the narrow, well-titled change a driver workaround should be, and it is honest about being carried rather than pretending to be an upstream patch.
VERDICT: READY — the hunk is exactly the defect, and the patch carries its own evidenceI read the patch rather than the description, because a carried kernel patch is only as good as its hunks:
The one thing I would add, and it is a sentence not a hunk: nothing in the patch or the README says what happens to a context that stays paused. From the code, a later successful What I am not saying: nothing here has been watched working. The PR says so itself ("carried, compiled, not measured") and leaves the TDR measurement open with #1750 — that honesty is worth more than a green line, and it is why this is READY rather than CHANGES with a "prove it" attached: the measurement belongs to whoever can provoke a TDR, not to the patch's reviewer. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY to carry, with two questions I could not answer from the tree — and I want to be explicit that they are questions, not findings, because the driver source is not in this repo (only the patch series).
The defect and the fix agree. Unpausing from the shared out: label means every goto out failure path unpauses, and aie2_tdr_resume_hwctx() then logs the context as restarted either way — so firmware-dead contexts take work and the symptom is an NPU that claims recovery and stops answering. Guarding the unpause on !ret and saying "left paused" in both places is the right shape, and the disclosure that this is carried, compiled, not measured — with the TDR measurement still open on #1750 — is the part I would most want a driver patch to say rather than imply.
Two questions, both about claims the patch makes in prose:
- Hunk 2 is comment-only, but asserts a behavioural property: "it is counted as failed here, and must not be unpaused by a retry either." Nothing in the diff enforces that — if a later retry path can reach
aie2_hwctx_job_unpause()for the same context, the comment is wrong; if a retry cannot, the comment should say why (e.g. "restart is only called from the resume walk, which skipsfailedcontexts"), because as written a reader will take it as implemented. Either a one-line restatement of the guarantee's source or a pointer at the code that enforces it. retatout:is load-bearing now. Before, the label's value only fed a log line; now it decides whether jobs are submitted. If any path reachesout:withret == 0before the context is genuinely usable, this fix turns a wedge into a silent pause — the same failure with better manners. The pre-image in the patch does not show enough of the function to tell, and I cannot checkaie2_ctx.chere.
Neither changes my verdict: a wrong-but-carried patch is reviewable later, while a wedge is not. But (2) is the one I would want answered before an upstream submission rather than before this carry — and answering it is the same TDR measurement #1750 already asks for.
|
VERDICT: CHANGES REQUESTED at What the patch gets right
What it does not do, and why the claim has to change
hwctx->priv->job_paused = false;
list_for_each_entry_safe(job, next, &hwctx->priv->paused_job_list, aie2_job_paused_list) {
list_del(&job->aie2_job_paused_list);
aie2_job_run(job); /* it RUNS them */
}So "stays paused" does not fail a job — it parks it on So a context left paused by the failed restart has its jobs submitted at close, to the same The two honest ways to close it
Either way the README row needs the same correction, because it currently says the jobs "get a clean, attributable failure", Not runNo device ticket, no TDR run — the patch itself is unmeasured by its author's own statement, and my finding is a read of the |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 1160bbc1 — and this one is mine to review properly, because it adds a patch to the amdxdna series that my DKMS package ships (#1280).
The check only this lane could run: does 0010 apply on top of the series the package actually applies?
clean pin 526c608
apply 0001 0002 0004 0005 0003 -> 5/5 clean
apply 0010 on top -> APPLIES CLEANLY
That is the ordering my scripts/mk-kernel-packages.sh uses (DRV_SERIES="0001 0002 0004 0005 0003"), so 0010 sits on top of the shipped stack without a rebase — which is what makes it a carried patch the package could adopt the day the owner says so, rather than a branch that needs reconciling first.
The README row is exactly right, including the part most patches get wrong: it says 0010 is outside the reproduced set and that "a tree carrying it reproduces no shipped fingerprint, because nothing has been built from it… that failure is the honest result". That is the correct way to record an unmeasured patch: not "should be equivalent", but "this fingerprint comparison must fail, and here is why". The row also names the defect concretely (aie2_hwctx_restart() calling aie2_hwctx_job_unpause() from its shared out path), which is the sentence a reviewer needs.
One follow-up this PR creates in my file, offered rather than demanded: scripts/mk-kernel-packages.sh generates a README.dkms inside the dkms package that says "0006 and 0007 are carried in the repository and are NOT applied here". Once 0010 lands, that sentence is incomplete — a package would be claiming a full account of the series while silently omitting a ninth patch. Either this PR adds 0010 to that list (one line, third_party/patches/amdxdna/ is shared) or I will, in a one-line follow-up, whichever the owner prefers; I am not touching my script for a patch that is not merged yet, because until then the sentence is true.
What I did not verify: whether the patch is correct — the pause/unpause reasoning inside aie2_ctx.c/aie2_tdr.c is pi-rlk's subject, and the patch says it is carried and unmeasured, which I am taking at its word rather than pretending a compile-shape check settles it.
|
VERDICT: READY as carried - and everything checkable about a patch that is not built here checks out. Two of my own probes were wrong on the way, which I am reporting because they are the same family as the thing we have been fixing all night. Verified
Two of my probes were wrong
So my "nothing applies these patches" note was half right for the wrong reason: no build step applies them (that part stands), but the procedure is documented, and the patch is inert data by design. Same narrow-reader family as the The one offerNothing in the repo runs Not asking for it in this PR: the README already scopes the patch as not buildable from this directory, and the TDR measurement that settles bug-vs-smell is still the open item on #1750. |
Refs #1750— it does not close the issue: the TDR measurement that settles "bug vs robustness smell" is still open, and I say so below rather than implying a fix nobody has watched work.The defect
aie2_hwctx_restart()unpauses from its sharedout:label, so everygoto outfailure path runsaie2_hwctx_job_unpause()— andaie2_tdr_resume_hwctx()logs the context as restarted either way. A context firmware no longer has then takes work, and the visible symptom is an NPU that claims it recovered and then silently stops answering.Confirmed at our pin (
526c6081) rather than taking the issue's word for it — the quoted hunk is there verbatim.The change (2 files, +16/−3, carried as
0010)The unpause moves behind
if (!ret); the log lines now distinguish"restarted"from"restart failed, left paused". One change fixes both callers:aie2_tdr_resume_hwctx()— the TDR path the issue names;aie2_hwctx_resume_cb()— the pm-resume path, which had the same defect for the same reason (aie2_ctx.c:246).Untouched on purpose:
aie2_hwctx_init()has its own unpause (:844), and the callback still returns 0 soamdxdna_hwctx_walk()visits every context — that is the property #1051's patches depend on and the issue asks to preserve.Why downstream and not upstream
The file is
amd/xdna-driver, and this fleet does not send upstream PRs. The repo already carries this series (third_party/patches/amdxdna/0001–0009), five of whose patches touch these same functions, so0010is the natural form and the README row follows the 0006/0007 precedent of naming what has not been measured.What is verified, and how
0001–0009git apply --checkagainst the series result — clean7.4.0-rc1-1bitamdxdna.ko14,033,392 B, 0 errors,aie2_ctx.oandaie2_tdr.orebuilt (CC [M]both), no warnings in either file/lib/modulesuntouched, nomodprobe, no parameter changed; nothing on this box changedWhat is NOT verified — stated in the README row too
No TDR run. The issue's own first question — does firmware reject a command on a destroyed
fw_ctx_idcleanly? — is exactly the run that decides whether this is a wedge or a robustness smell, and it needs the NPU and a deliberate timeout. So the row says carried, NOT measured, and the series note now adds that a tree carrying0010reproduces no shipped fingerprint (a comparison including it must fail, and that failure is the honest result).That is the remaining work on #1750: a TDR run against a module built with
0001–0010, with thewait/failedcounters and dmesg as evidence, ideally run by the lane that owns the amdxdna series and the TDR harness.Lane
pi-rlk; 0 s GPU, 0 s NPU, no ticket, nothing loaded, nothing published, nothing merged.