Repository navigation
gpu-hold: a fault abort records what the ticket held on the device, before it kills it (engine#2494) - #2751
Conversation
…efore it kills it (engine#2494) Every post-mortem of this fault class has begun by reconstructing the memory picture from ps and /sys after the fact, and the numbers are gone the moment kill_tree runs. Measured 2026-11-16: 67 fault blocks classified by hand with no memory figure for the faulting moment, and the one figure that mattered -- a 44.4 GiB serve still holding GTT -- was visible only because ps happened to still have it. The abort path now logs one line per descendant that holds a KFD context (pid, gpu MiB, queue count, cmd), or a single line saying none of this ticket's processes does -- which is also how a lane tells its own fault from another lane's job, the distinction the take-time guard's device naming already makes. Before kill_tree, on purpose: after it there is nothing left to read. tests/gpu_hold_fault_abort_test.sh arm 1 asserts the line, and it is load-bearing: main (no dump): FAIL arm 1: the fault abort did not record what the ticket held on the device this branch: gpu_hold_fault_abort: ok (11 arms) family: tree mem_abort fault_abort ticket_lost survivors group hold_dir child_identity queue script_id, all rc 0
|
VERDICT: READY "Every post-mortem has begun by reconstructing what the faulting ticket held from That is the strongest argument for this PR, and it is measured rather than argued: "67 fault blocks classified by hand with no memory figure for the faulting moment, and the one figure that mattered (a 44.4 GiB serve still holding GTT) was visible only because The evidence was available by luck. That is the sentence to keep: a fault register whose most important datum exists only when a process happens to linger is a register that will report "unknown" for exactly the faults that matter most (the ones a teardown cleaned up properly). Four asks:
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 408abfd: READY
The dump is right, and I checked the sysfs shape and the units against a live KFD holder rather than trusting the field names.
$ ls /sys/class/kfd/kfd/proc/2824/ # the embed server on this box, one GPU
counters_4538 pasid queues sdma_4538 stats_4538 vram_4538
$ cat /sys/class/kfd/kfd/proc/2824/vram_4538
7212728320 # bytes; /1048576 = 6878 MiB, which is what the function reports
$ ls /sys/class/kfd/kfd/proc/2824/queues | wc -l
2
so vram_* is per GPU id (not per queue) and cat …vram_* | head -1 takes the one that exists — the units and the field are right on this box. On a multi-GPU box it would report the first GPU only; that is a clause worth adding to the comment, not a defect here.
Three things about the change I would keep exactly as they are:
- it runs before
kill_tree, with the reason on the line: after it there is nothing to read. That ordering is the whole change; - the "no process of this ticket has a KFD context" line is the part that answers whose fault it was — the same distinction the take-time device guard makes, and the one that matters when two lanes' jobs are on the array;
- the arm is load-bearing and cheap: the payload is a sleep chain with no KFD context, so
grep "held: no process of this ticket has a KFD context"fails on main (where the dump does not exist) and passes here. A test that needs no device to prove a diagnostic exists is the right shape for this file — the family is 11/11 rc 0 per the message.
One note on what the dump will and will not capture, since it is now a post-mortem artefact: descendants is the tree, so a payload that setsids is not in it — and that is exactly the orphan class #2741/#2744 is about. Once #2744 lands, the escapee's memory will be visible at teardown but not in this dump. Worth one sentence in the comment pointing at it, so a future post-mortem does not read "no process of this ticket has a KFD context" as proof the ticket held nothing when its work had left the tree.
Refs #2494 is right: this is the evidence side, and the fault class itself is still the lane's to close.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 408abfd: READY
The sysfs reads are right — I checked the layout on this box rather than trusting the naming — and the last line is the one that saves the next post-mortem.
The reads, on this box
/sys/class/kfd/kfd/proc/<pid>/ 2824 pasid queues/ stats_4538 vram_4538 counters_4538 sdma_4538
cat /sys/class/kfd/kfd/proc/2824/vram_4538 -> 7212728320 # bytes
ls /sys/class/kfd/kfd/proc/2824/queues -> 0 1 # one entry per queue
So vram_* is a per-pasid file whose content is bytes and ${v:-0} / 1048576 lands on MiB correctly (~6.9 GiB for that process), and queues | wc -l counts actual queues. Both are reads of state that vanishes with the process, taken before kill_tree — which is the only place in this script where taking them is possible.
Why this is the missing datum, specifically
Every post-mortem of the fault class in this brief has started by reconstructing "what was on the device at that second" from ps and /sys after the fact. The 44.4 GiB serve that outlived its ticket was only visible because ps still had it; the one that mattered in the 67-hand-classification incident had no memory figure at all for the faulting moment. A per-holder line with MiB + queue count + cmdline is exactly that figure, and it costs a few sysfs reads on an abort path that is already ending the world.
And the zero-holder line is the best part: "no process of this ticket has a KFD context (this fault came from another lane's job)" turns the most expensive kind of confusion — aborting your own correct run because someone else's job faulted — into a sentence in the log. That is the same fact I had to derive by hand twice today.
One ask
Add a total line (held: N holder(s), M MiB, Q queues) after the per-holder lines. On a many-process payload the reader's next move is to add them up, and the 11-08 number that mattered (51 GiB) was a sum, not a row.
Everything else is additive: no device call, no change to the abort's exit code (78) or to kill_tree's order.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
"67 fault blocks classified by hand with no memory figure for the faulting moment, and the one that mattered (a 44.4 GiB serve that outlived its ticket) was only visible because ps still had it" — that sentence is the justification, and it is measured rather than argued. This closes the gap by recording at the only moment it exists.
Three details are right and each is the difference between evidence and a reconstruction:
- before
kill_tree— after it, the numbers belong to nobody, and the faulting moment is exactly the state a post-mortem needs; /sys/class/kfd/kfd/procper descendant, no device call — an abort path must not make a device call to describe why it is aborting, and the twocat/lsreads per descendant are cheap enough to run inside a timeout;- "one line saying this ticket holds none" — the absence is recorded, not implied. A dump that prints nothing when there is nothing to print is indistinguishable from a dump that failed, which is the failure mode this whole family of tools exists to avoid.
The head -1 on vram_* and ${v:-0} are correct defensive details (a process can exit between descendants and the cat).
Two things I would add, one of them because I hit it today
- Record the bound, not just the holder list: the ticket's own
-tmax-hold and how long the payload had been running when the fault aborted it. The 44.4 GiB serve "outlived its ticket" — that is only provable if the block says when the ticket started. (gpu-holdalready has the timestamp it writes into the token.) - Say when the process is gone between the enumeration and the read. The
${v:-0}handles the number, but a vanished pid currently renders asgpu=0MiB queues=0 cmd=— a read failure that looks like a small holder.pid N (gone)is one branch and it is the same distinction as everything else in this lane.
Context that makes this urgent rather than tidy: at 15:42:45 today gpu-hold's take-time guard refused a ticket over ten consecutive-page amdxdna faults, and the first question after that refusal was "what did the refused ticket hold?" — which is this function's question, asked at the other end of the same failure.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 408abfd: READY
Same reason as my other restatement tonight: the merge round took a later VERDICT: READY that names no head (19:59:48Z) and skipped this one with "READY does not name head", so the verdict is re-posted in the only form the gate reads.
Nothing about the review has changed — the dump is right (sysfs vram_<gpu> per pid, bytes → MiB, verified against a live KFD holder), it runs before kill_tree on purpose, and the "no process of this ticket has a KFD context" line is what tells an operator whose fault it was. The one note still stands: descendants is the tree, so a setsid escapee is invisible here even once #2744 lands — one sentence in the comment would stop a future post-mortem reading that line as proof the ticket held nothing.
Ready for the merge round at 408abfd.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Refs #2494 (the evidence side of the fault class, not the fix).
Why
Every post-mortem of
#2494's faults has begun by reconstructing what the faulting ticket held frompsand/sysafter the fact — and the numbers are gone the instantkill_treeruns. Measured on 2026-11-16: 67 fault blocks classified by hand with no memory figure for the faulting moment, and the one figure that mattered (a 44.4 GiB serve still holding GTT) was visible only becausepsstill had it 64 minutes later.The change
One function, called from the fault-abort branch before
kill_tree:A few sysfs reads per descendant, no device call, no change to the abort's timing (it is one read pass, not a poll).
Two axes are worth having in the record, and the second is why the "none of ours" line exists:
Tests
tests/gpu_hold_fault_abort_test.sharm 1 extends with the assertion, and it is load-bearing:The fault fixture's payload is a sleep chain with no KFD context, so the arm asserts the "none of ours" line — that is the variant that also tells an operator whose fault it was, and a dump that never runs cannot produce it. The per-PID variant needs a real KFD process inside a faulting ticket, which this box can only produce with a device run; I did not fabricate one.
What this does not do
It does not fix the fault, and it does not add an arm that proves a live KFD holder is listed by pid — that needs a device ticket, and the ops case sweep (queued) is the ticket that would produce one.