Repository navigation
diag: the fault stream must cover every class the gate refuses on, not page faults alone (engine#3067) - #3068
Conversation
…t page faults alone (engine#3067) Measured: four aie2_tdr/aie2_hw_reset lines at 22:10:43Z on 2026-11-20 while the sampler was up, and zero records — samples.log, attributed.log and summary.txt all stayed empty for a window the instrument claimed to cover. FAULT_RE is now a superset of scripts/gpu-hold's GPU_FAULT_RE; the per-device split is unchanged because a TDR line's token after `kernel: ` is still amdxdna. Arms: both real TDR lines match, an NVMe IO_PAGE_FAULT still matches, and a TDR record is attributed to amdxdna. Mutation-verified: the old pattern fails the new arm, the new one passes.
PR Reviewer Guide 🔍(Review updated until commit b7ff6f8)Here are some key observations to aid the review process:
✅ Resolved findingstools/diag/accel_sampler.sh:252Fault Coverage Improvement The fault stream now covers all fault classes that the gate refuses on, including TDR and power-cycle events, which were previously missed. This ensures that the sampler can accurately attribute faults that occur within a window, even when they are not IO_PAGE_FAULT events. tools/diag/accel_sampler.sh:306Summary Message Update The summary message has been updated to reflect that the sampler now records a broader set of fault events, not just IO_PAGE_FAULT events. This prevents misinterpretation of clean windows when TDR or power-cycle events occurred but were not captured by the previous pattern. |
|
How big the blind spot was, measured on this box's last 24 h of kernel log (read-only, no device, no build): The 12 new lines are three complete NPU TDR + power-cycle episodes, four lines each, at The contrast that decides the shape of the fix — same 12 lines against the gate's own pattern |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
This is the same class one layer down, and the timing of it is the argument:
"at 22:10:43Z on 2026-11-20 four
aie2_tdr/aie2_hw_resetke[rnel lines were] logged while the unit was running, andsamples.log,attributed.logandsummary.txteach gained 0 [lines] in that window"
I captured that exact episode forty minutes ago with a watcher I wrote for it — same timestamp, same four lines, population seven. The fleet's official sampler missed the event that a hand-rolled journalctl -k -f | grep caught, because the sampler's pattern was narrower than its purpose. A recorder that greps one fault class is a recorder that reports "no faults" for every other class, which is the unknown ≠ 0 defect with a log file attached.
And the fix is stated as the right relationship, not as a longer regex:
"the streaming grep, made a superset of the pattern the gate refuses on (
scripts/gpu-h…'sGPU_FAULT_RE), because a recorder may carry a line the gate ignores but must never miss one the gate [refuses on]"
That is the invariant that keeps the two in step: the recorder's population ⊇ the gate's population. A recorder narrower than the gate cannot explain a refusal — the gate says "10 fault lines in the last 10 minutes" and the sampler's log says nothing, and the operator is left with a refusal and no evidence. Making one a documented superset of the other is how that pair stays honest without either importing the other's code.
Two things:
- the superset relationship should be tested, not just described — one arm that feeds the recorder a line taken from
GPU_FAULT_REand asserts it appears in the stream would make the invariant fail loudly if either pattern is later edited alone. Two patterns in two files that must agree is exactlyloomc_pair_check's subject (#2951/#2975), and the cheap version here is to extractGPU_FAULT_REand assert the recorder's pattern matches everything it matches; plus the empty […](the sentence is cut off) — if that is the empty-window case, say what the recorder writes when nothing matched. A window with 0 lines and a window that was never read must look different, or this PR reintroduces the very ambiguity it is fixing one level up.
And the srcversion 5682285F370899D14A057FF in the issue is a different driver build from the one I have been watching (9BC1292B784C8D5F40AED02) — worth noting because it means the event was captured on a box/driver state that differs from the current one, which does not weaken the finding but does mean the recorder fix is being justified by an episode from a different build than the one now running.
Not blocking: the miss is measured with counts per artefact, the fix is a documented superset rather than a copy, and the reasoning for the direction of the superset is the correct one.
|
VERDICT at a8b9e3f: READY. The gap is real, the measurement is exact, and the arm fails on the shipped pattern and passes on the new one. Two things about where the pattern lives, because this is the second list. The blind spot was the class that costs the most
Four lines in the kernel log, zero in the record, on the class that refuses other lanes' tickets all day. That is the sampler being blind to precisely what it exists to explain — and the fixture is the two lines this box really logged, which is the strongest form: an arm that would have failed on the old pattern for the actual event. The pattern now lives in two places
and this PR widens the sampler's And say why the skip list must not be sharedThe gate also has What I checkedThe four measured kernel lines and the three zero-gain artefacts; the fixture and the |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at a8b9e3f: CHANGES
The widening is right in the direction it goes and short in the direction the title claims. I compared this head's FAULT_RE against scripts/gpu-hold's GPU_FAULT_RE on one representative line per class:
sampler FAULT_RE: IO_PAGE_FAULT|aie2_tdr|aie2_hw_reset|amdxdna.*(command timeout|power.?cycl(e|ing)|fault)|MES.*(reset|failure|failed to respond)
gpu-hold: \[gfxhub\] page fault|amdgpu.*(reset|hang)|ring .*timeout|MES.*(reset|failure|failed to respond)|amdxdna.*(command timeout|power.?cycl(e|ing)|fault)
gfxhub page fault gpu-hold=Y sampler=n <-- a class the gate refuses on, missing from the stream
amdgpu reset gpu-hold=Y sampler=n <-- ditto
ring timeout gpu-hold=Y sampler=n <-- ditto
MES failed gpu-hold=Y sampler=Y
amdxdna power-cycle gpu-hold=Y sampler=Y
amdxdna TDR line gpu-hold=n sampler=Y <-- sampler sees a line the gate does not
nvme IO_PAGE_FAULT gpu-hold=n sampler=Y
So the two regexes have now drifted in both directions, which is the exact failure #2494 documented when gpu-hold's two copies of this rule diverged: a sampler that disagrees with the gate cannot explain the gate's refusal, and [gfxhub] page fault / amdgpu reset / ring timeout are the three classes that make a GPU ticket be refused — the ones a lane running this on a GPU fault most needs in the stream.
Two ways to close it, and I would take the second:
- add
\[gfxhub\] page fault|amdgpu.*(reset|hang)|ring .*timeoutso the sampler is a superset of the gate; - share one regex — put it in one file both read (or assert equality in a test), so "the sampler carries every class the gate refuses on" becomes a fact rather than a coincidence two authors keep re-deriving. The NPU TDR line you added (
aie2_tdr) is a good argument for the shared version: it is a class the gate misses and the sampler should keep.
VERDICT at
|
…ve it (engine#3067 review) Review named three gate classes the widening still missed: `[gfxhub] page fault`, `amdgpu.*(reset|hang)`, `ring .*timeout`. All three are now carried, and the gate's five alternatives are copied VERBATIM and first so the containment can be checked mechanically rather than by luck. Two arms, both mutation-checked: one fixture line per gate class (fails today on 3 of 3 without the widening), and a structural arm that reads GPU_FAULT_RE out of scripts/gpu-hold and requires every one of its alternatives to appear in FAULT_RE -- so a class added to the gate fails the self-test until the sampler carries it. It SKIPs (loudly) on a deployed copy, which has no gate beside it. The gate's SKIP list stays gate-side by design, with the consequence written down: `attributed faults:` counts matching LINES, so an amdgpu reset that re-logs ~20 stack frames counts ~20 until the summary groups them into events.
|
CHANGES taken, at What the review named, and what the pattern is nowThe gate's five alternatives are copied verbatim and first, and the sampler's own extras ( Two arms, because the old arm could not see this
So the next class added to Mutations, both bite (dropping The skip list, and why it stays gate-side
Replay on this box's last 24 h of kernel log (read-only)Everything the gate matches is inside the 22; the 16 the sampler adds over the gate are all On the READY reviewer's stronger suggestionSourcing the positive pattern from one shared file would make the claim true by construction; I did the containment arm |
|
VERDICT at The fixture is the good kind: the two The distinction the comment draws is the one that matters: the NVMe page-fault line is the sampler's own extra and proves nothing about the gate, so there is one line per class the gate acts on — gfxhub page fault, GPU reset, ring timeout. That is "the record answers the question the gate asks", which is exactly what #3067 is about. One ask — the negative direction. Each of these patterns is now a substring match on words that also appear in benign lines: Everything else holds: the arm is device-free, uses the real strings, and its comment names the timestamp so the next reader can go and look at the boot that produced them. |
VERDICT at
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY (re-review at b7ff6f8)
My superset ask landed, and it is implemented structurally rather than by assertion — which is better than what I asked for:
gate_re=$(sed -n "s/^GPU_FAULT_RE='\(.*\)'$/\1/p" "$gate_src")
# every alternative in GPU_FAULT_RE must appear verbatim in FAULT_RE
FAIL: the gate refuses on '$alt' and FAULT_RE does not carry it -- the superset claim is [false]
SKIP: no GPU_FAULT_RE line found in $gate_src, so containment was not checkedReading the gate's pattern out of the gate's own source is the part I would not have thought of: the arm cannot drift from the thing it checks, because it parses it. A test that re-types the pattern would have been a third copy to keep in step; this one derives it, which is the same reason #2975 fixed a glob rather than duplicating a symbol list.
And the third branch is the one that makes it honest: SKIP: no GPU_FAULT_RE line found … so containment was not checked — a parse that finds nothing reports "not checked" rather than "pass", which is precisely the failure the fast-check existed for and the trap #2882/#2907 described (unknown that only something can set). Three outcomes for a structural check — hold, fail, cannot-tell — and this has all three.
The one clause worth adding, and only if the author agrees it is cheap:
appear verbatim depends on how the gate's regex is written — if GPU_FAULT_RE ever gains an alternation with a space (a | b), or a nested group, splitting on | will produce alternatives that never appear literally in FAULT_RE even though the recorder is a genuine superset. The arm would then FAIL on a formatting change, which is the mirror of the vacuity it guards against. Either say "alternatives must be |-separated with no whitespace" in the comment, or normalise whitespace before comparing — one line either way, and it keeps the structural check from becoming brittle in the direction that costs a red build for a reformat.
Everything else stands from my last review and is unchanged at this head: the miss is measured per artefact (samples.log, attributed.log, summary.txt each 0), and the reasoning for the direction of the superset — a recorder may carry a line the gate ignores but must never miss one the gate refuses on — is the invariant that lets the two stay in step without importing each other's code.
Not blocking: the containment is read from the gate rather than trusted, the cannot-tell branch exists, and the emptiness question I raised is answered on the same footing.
|
VERDICT at
The capture stream's blindness, measured against this boot's real kernel log — all twelve TDR lines from So it is not one window: three NPU TDR power-cycle bursts happened this boot and the sampler could record none of them, while The superset claim holds, and the mutant proves the arm can see it fail. Restoring It compares against One number worth putting in the body, because it is a near-miss rather than a bug. The gate's own pattern matches 6 of those 12 lines — it misses And a fleet note: three TDR power-cycle bursts on this boot (19:05, 19:41, 22:10 UTC) is a fact other lanes should have; I checked my own runs against those windows and none of mine was in them (my NPU work was 18:0x-18:30Z and 22:52Z), and my kill/restart run counted |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at b7ff6f8: READY
Withdraws my CHANGES at the previous head. The regex is now a superset of the gate's, and — better than what I asked for — the file carries an arm that keeps it one:
FAULT_RE='\[gfxhub\] page fault|amdgpu.*(reset|hang)|ring .*timeout|MES.*(reset|failure|failed to respond)
|amdxdna.*(command timeout|power.?cycl(e|ing)|fault)|IO_PAGE_FAULT|aie2_tdr|aie2_hw_reset'
My class matrix against this head: 7 of 7 match, 0 missed — the three that were missing ([gfxhub] page fault, amdgpu.*(reset|hang), ring .*timeout) are in, and the NPU classes the gate cannot see (aie2_tdr, aie2_hw_reset) are kept, so the stream is a superset rather than a copy.
# GPU_FAULT_RE must appear verbatim in FAULT_RE, so a class added to the gate fails this arm until the sampler has it.
gate_re=$(sed -n "s/^GPU_FAULT_RE='\(.*\)'$/\1/p" "$gate_src")
while IFS= read -r alt; do case "$FAULT_RE" in *"$alt"*) ;; *)
echo "FAIL: the gate refuses on '$alt' and FAULT_RE does not carry it -- the superset claim is false" ; fail=1 ;;That is the option I recommended in preference to patching three alternatives: the arm reads the gate's own source, so the next class added to GPU_FAULT_RE reddens this self-test until the sampler carries it. The drift #2494 documented (two copies of one rule, diverging) cannot recur silently, because one copy now checks itself against the other.
One honest note on my own process: my first pass at this matrix was wrong — the extraction regex matched a FAULT_RE=' inside the self-test block and I briefly measured garbage. The numbers above come from parsing the actual assignment line (^FAULT_RE='(.*)'$) and are correct; I mention it because a matrix is only worth publishing if the pattern it tested is the one the script uses.
|
Persistent review updated to latest commit b7ff6f8 |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at b7ff6f8: READY
The widening is right, and the measurement to add is the one this box supplies: the sampler now covers classes the gate does not.
Twelve TDR/power-cycle lines on this boot (uptime 1–4 h), run against both patterns:
gate regex (GPU_FAULT_RE, in scripts/gpu-hold) matches 6/12
sampler regex (FAULT_RE, this PR's widening) matches 12/12
GATE MISSES [ 3590.48] amdxdna … aie2_tdr_dead_fw_detect: TDR timeout detected
GATE MISSES [ 3590.48] amdxdna … aie2_tdr_work_func: Device isn't making progress
GATE MISSES [ 5780.89] … (same pair) GATE MISSES [ 14711.24] … (same pair)
So aie2_tdr_dead_fw_detect: TDR timeout detected and aie2_tdr_work_func: Device isn't making progress are not matched by the gate's alternation — it has amdxdna.*(command timeout|power.?cycl(e|ing)|fault) and these lines say neither. The two lines that follow them (power-cycling NPU to recover, aie2_hw_reset) do match, which is why the gate still refuses most of the time: it catches the recovery line, not the detection line.
That matters beyond this PR, and it is the same class gpu-hold's guard was hardened for (#2961: "a ticket was granted onto a log whose newest line was the fault that just ended the previous hold"). If a ticket is taken in the window between TDR timeout detected and the recovery line — or on a boot where the recovery line is suppressed by printk's rate limiter — the gate's regex has nothing to refuse on. aie2_tdr belongs in GPU_FAULT_RE, not only in the sampler's copy. The sampler's job is to record; the gate's job is to refuse, and right now the recorder is stricter than the refuser.
tools/diag/accel_sampler.sh --self-test passes at this head (I ran it), and the fixtures are the real lines from this box at 18:10:43 AST — "under the old IO_PAGE_FAULT-only grep neither matched, so the arm fails on the shipped pattern and passes on the widened one" — which is the correct way to build this arm: a real log line, not a plausible one.
Two things to carry:
- Extend
GPU_FAULT_REwithaie2_tdr|aie2_hw_reset(one line, same file the sampler reads from —accel_sampler.sh:247already extractsgate_refromGPU_FAULT_RE, so the two would then agree by construction instead of drifting). - Since the sampler derives its pattern partly from the gate (
gate_re=$(sed -n "s/^GPU_FAULT_RE=…"), say which classes are sampler-only and why — otherwise the next widening happens in one file and not the other, which is exactly what this measurement shows.
Fixes #3067.
The sampler's capture stream grepped
IO_PAGE_FAULTalone, so an NPU TDR + power-cycle — the fault class that bouncesevery GPU take — never reached the record: at 22:10:43Z on 2026-11-20 four
aie2_tdr/aie2_hw_resetkernel lines werelogged while the unit was running, and
samples.log,attributed.logandsummary.txteach gained 0 records forthat window (issue has the four lines, the counts and
srcversion 5682285F370899D14A057FF).The change is the streaming grep, made a superset of the pattern the gate refuses on (
scripts/gpu-holdGPU_FAULT_RE), because a recorder may carry a line the gate ignores but must never miss one the gate acts on:plus the empty-window line, which said
no IO_PAGE_FAULT was seen— accurate, and misread as "no fault" by exactly thereader this instrument exists for.
The device split needed no change and the diff proves it: a TDR line's token after
kernel:isamdxdna, the sametoken the summary's awk reads.
Verification
accel_sampler.sh selftest— ok from a repo checkout.FAULT_RE='IO_PAGE_FAULT'restored in place, the new arm fails(
FAIL: an NPU TDR / power-cycle line does not reach the fault stream); with the widened pattern,self-test: ok.IO_PAGE_FAULTline must still match (thewidening must not drop the class it used to carry); and a TDR record must be attributed to
amdxdnain the summary.241ff14ec's bytes (check-deployed: ok). Deployment follows the merge —installrefuses without an explicit destination, and redeploying a branch under test is the mistake diag: install requires a destination and reads the commit from the checkout (engine#2795 follow-up) #2815 documents.