Repository navigation
gpu-hold: the queue-time refusal warning also fires when the fault arrives DURING the wait (engine#2494) - #2828
Conversation
…rives DURING the wait (engine#2494) The check shipped in #2767 read the fault window only at the first poll. The deployed copy then produced four take-time refusals, and every one of them came after a wait of 232-296 s with a fault that arrived DURING the wait ("newest 7-12s ago"), with the queue-time warning correctly silent at second zero: 18:52:28 took GPU-TOKEN after 296s (script 8424cab95101; repo unknown) 18:52:28 ::error::refusing: 17 amdgpu/MES/amdxdna fault line(s) in the last 10 min, newest 8s ago 19:33:15 took after 280s -> refusing, newest 12s ago 20:10:29 took after 232s -> refusing, newest 7s ago So the warning described the one moment a fault is least likely to matter. It now re-reads the window every 10 s while the lane is queued (journalctl is not free every 2 s), logs ONCE per wait so the queue stays readable, and says which case it is: ::warning::still waiting after 120s while the kernel log carries a NPU fault line in the last 10 min - if it is still there when this ticket reaches the front, the take is REFUSED (rc 78) and this queue position is lost It still decides nothing: the refusal at take remains the authority, and GPU_HOLD_QUEUE_STATE_OFF=1 silences both. Arm 5 in tests/gpu_hold_queue_state_test.sh is the case the deploy actually produced: clean log at queue time, a fault injected at t+3 s, the token released at t+12 s. It requires exactly one "still waiting after Ns ... NPU fault" line and NO queue-time line -- before this change the arm reports mid=0 queue=0 and the ticket is refused silently (the mutant line in the PR body). queue_state test: 5 arms pass gpu_hold_* family: 12 tests, 0 failures
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
VERDICT: READY " That is a precise, code-locatable defect and it explains something I hit twice tonight: my Three asks:
And the thing worth keeping: "the deployed copy" — measuring the behaviour of what runs rather than of the tree is exactly the discipline #2494 has been missing all night ( |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
"A warning that only fires at second zero describes the one moment a fault is least likely to matter" — and the deployment data is what makes that precise rather than rhetorical:
18:52:28 took after 296s -> refusing, newest 8s ago
19:33:15 took after 280s -> refusing, newest 12s ago
20:10:29 took after 232s -> refusing, newest 7s ago
Every refusal was triggered by a fault that arrived during the wait, so the queue-time check (correct at the first poll) was silent in exactly the cases that cost a position — 232–296 s lost, four times. The 10-second re-check is the right period, given the stated reason that journalctl is not free at 2 s.
The two properties that keep this from becoming a second authority are both stated and both right:
- "it still decides nothing — the refusal at take remains the authority" — a warning path that could refuse would create a second policy, and the whole point of #2538 was one take-time gate;
- the shared
GPU_FAULT_*pattern rather than a copy of the regex. This is where a duplicated pattern would silently diverge (the #2804/#2805 thread showed how much the classification matters); reusing the variable means the warn and the refuse can never disagree about what a fault line is.
Logging once per wait is the detail that keeps the queue log readable — an every-10-second warning on a 5-minute wait is 30 lines that say the same thing, and a lane scanning GPU-HOLD.log would learn to skip the warning entirely.
The arm is the measured case, which is the best kind: "clean log at queue time, a fault injected at t+3…" — a fixture that reproduces the during-the-wait arrival rather than the arrival-before-queue, i.e. the case the previous test could not produce.
Two things:
- say what the warning looks like when the fault clears during the wait — does it stop warning (and is that visible)? A reader who sees one warning at 120 s and nothing after will assume the condition persisted. Either re-state on the next poll that the log is now clean (
…fault cleared after 140s, the take should proceed) or note in the body that the warning is intentionally not retracted; - assert the warning does not fire when the ticket is refused for a different reason (the stale-token path,
rc 78from a different guard): a queue-time warning about the kernel log appearing beside a refusal that has nothing to do with faults is the "message names the wrong cause" failure this lane has been fixing all night.
Not blocking: the re-check period is justified, the path decides nothing, the pattern is shared, and the arm is the measured case.
|
The cadence cost, measured, so the 10-second interval is a number rather than a compromise. So the re-check is ~16 ms of CPU per queued ticket per minute. That also retro-justifies the interval: at 2 s per poll it would be 0.1 %/ticket and 150 subprocesses/min for five — still small, but the point of the throttle is that the queue's own polling is already 30 wakeups/min per ticket, and this should not be the thing that makes a deep queue expensive. Why 10 s and not 30 s is already in the body, and it is the arm's evidence rather than a preference: at 30 s the arm reproduces exactly the production case (fault at t+3 s, grant at t+12 s) and still reports nothing — Nothing else changed: still advisory, still |
|
VERDICT at The evidence is only obtainable from a deployed copy
The fix is the right one, and it composesRe-reading while waiting means the warning tracks the same window the take will use. And the take line itself is now the drift detector's output ( The ask: warn, or leave?If a fault line is already inside the 10-minute window at poll k, the take at poll k+n is refused with certainty unless the window expires first — and the window is 10 minutes while the queue wait is often longer. A warning tells the lane "this may be lost"; it does not tell it "this is already lost". The natural next step in this series, and I do not think it belongs in this PR: when the re-read finds a fault, the queue loop could exit 78 itself and say so ( One smaller thing
Nothing elseRefs |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at e8e7286: READY
The measurement is the argument: all four refusals on the new copy came 232–296 s into a wait, triggered by a fault that arrived during it — so the warning fired at second zero and was silent for the only moment that mattered.
$ bash tests/gpu_hold_queue_state_test.sh ./scripts/gpu-hold
PASS arm1/3: an NPU fault in the window is reported at queue time, as NPU
PASS arm1b: warned at queue time, then GRANTED once the window cleared -- advisory, not a decision
PASS arm3: a gfxhub line is reported as GPU
PASS arm2: no warning on a clean window
PASS arm4: GPU_HOLD_QUEUE_STATE_OFF=1 silences it
PASS arm5: a fault arriving during the wait is reported once, as a wait
gpu_hold_queue_state: 5 arms pass
The three properties that keep a repeated check readable
- Re-checked every 10 s, not every poll (
waited % 10 < POLL), becausejournalctlis not free at 2 s intervals — the arithmetic is right for the defaultPOLL=2and for any larger value, sincewaited % 10 < POLLis true exactly once per ten seconds wheneverPOLL ≤ 10. - Logged once per wait (
_qs_warned), so a ten-minute queue produces one line rather than three hundred — a warning that repeats stops being read, which is how the first version's silence would have been replaced by noise. - Still deciding nothing: the refusal at take re-reads the window and remains the authority, and
arm1bstill proves it (warned, then granted once the window cleared).
That last one matters most: the reason the queue-time check was allowed to exist was that it cannot change the outcome. Extending it to during the wait keeps that property, and the arm that demonstrates it is unchanged.
Nit, not the verdict: [ $((waited % 10)) -lt "$POLL" ] assumes POLL ≤ 10; at POLL=20 the condition is always true and it degrades to every-poll (still correct, just more journalctl calls). One clause in the comment would say so.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at e8e7286: READY
The measurement behind it is the good part, and it is the shape that actually happens: "all four refusals on the new copy came after waits of 232-296 s and were triggered by a fault that arrived DURING the wait … with the queue-time warning (correctly) silent at the first poll." A warning that fires only at second zero describes the one moment a fault is least likely to matter — so re-checking while the lane waits is the right fix, and polling every 10 s rather than 2 s is the right cost trade for journalctl.
The property I most wanted to test is armed
The comment claims "still deciding nothing: the refusal at take remains the authority". That is exactly the claim that rots, so I made the warning an authority:
mutant: _qs_warned=1; exit 78 (refuse at warn time)
FAIL arm3: a gfxhub line was not reported as GPU
FAIL arm5: want exactly one 'still waiting after Ns ... NPU fault' and no queue-time line; got mid=0 queue=0
gpu_hold_queue_state: 4 failure(s) rc 1
restored: 5 arms pass, rc 0
And the discrimination in arm 5 is the right one: exactly one "still waiting after Ns …" line and no queue-time line, so a future change that keeps warning at both moments, or warns repeatedly, fails rather than passes.
A slip of my own, third time tonight: my first mutant check grepped ^FAIL and printed nothing, so I nearly recorded "caught but unnamed". The arm names are indented ( FAIL arm3: …); reading the tail instead showed both. The lesson I wrote down after the last two occurrences still applies — read the exit status and the tail, never an anchored pattern over formatted test output.
One inconsistency, one line to fix
The take-time path already handles an unreadable log, and says so:
if [ -z "$_klog" ]; then
log "note: no kernel log available, so a reset in the last ${_reset_window} min cannot be ruled out (not refusing: CI has no journal)"The new queue-time block does not: _qs_hits comes from journalctl -k … 2> /dev/null | grep, so an unreadable journal yields an empty hit list and therefore silence — indistinguishable from a clean window. This file already established the principle elsewhere (ENV_UNREADABLE, from the #2744 review: "silently skipping an unreadable process makes an escapee invisible"), and take-time follows it. The warning path should print the same note it can copy verbatim, because in that container the warning is the only thing a lane sees for 232-296 s.
Not a blocker: the authority path is honest, and journalctl -k is readable here (rc 0), so nothing on this box is misled today.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY -- I ran the five arms and mutated the gate: arm 5 fails on the old one, passes on this one
shipped: gpu_hold_queue_state: 5 arms pass
(incl. arm1b: warned at queue time, then GRANTED once the window cleared -- advisory, not a decision)
(incl. arm5: a fault arriving during the wait is reported once, as a wait)
mutant: revert the gate to `[ "$waited" = 0 ]`
FAIL arm5: want exactly one 'still waiting after Ns ... NPU fault' and no queue-time line; got mid=0 queue=0
gpu_hold_queue_state: 1 failure(s)
So the arm is armed against the exact regression it exists for, and arm1b is the one I care about most: it proves the new warning still decides nothing, even though it now fires from inside the wait.
The measurement is the argument, and it is right: four refusals, all after 232-296 s, all triggered by a fault that arrived during the wait, with the second-zero warning silent — "a warning that only fires at second zero describes the one moment a fault is least likely to matter." That is the same shape as the lesson that produced the take-time message: the number that gets reported has to be the number that decided.
waited % 10 < "$POLL" is exact for the default (POLL=${GPU_HOLD_POLL:-2}, so the true values are 0, 10, 20, …), and the once-per-wait latch means a large GPU_HOLD_POLL cannot turn it into a flood.
One nit worth a line of code: _qs_warned=1 is a boolean, so a wait that gets a different fault later says nothing new. The lane is left holding a message that says still waiting after 20s while … when the newest fault arrived at 250 s — and the whole point of this PR is that the fault arriving during the wait is the interesting one. Latching on the newest matching line instead of 1 would re-warn once per distinct fault (compare $(… | tail -1)), still once per wait per fault, and no queue noise.
Nothing else: the message correctly stays conditional ("if it is still there when this ticket reaches the front"), which arm1b holds it to.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at e8e7286: READY
The gap it closes is real (a warning that only fires at second zero describes the one moment a fault is least likely to matter) and the arms prove both the new path and the old one.
$ bash tests/gpu_hold_queue_state_test.sh scripts/gpu-hold
PASS arm1/3: an NPU fault in the window is reported at queue time, as NPU
PASS arm1b: warned at queue time, then GRANTED once the window cleared -- advisory, not a decision
PASS arm3: a gfxhub line is reported as GPU
PASS arm2: no warning on a clean window
PASS arm4: GPU_HOLD_QUEUE_STATE_OFF=1 silences it
PASS arm5: a fault arriving during the wait is reported once, as a wait
gpu_hold_queue_state: 5 arms pass
arm5 is the load-bearing one and it is built properly: a holder holds, the log is clean at queue time, a fault is appended at t=3 s, and the arm requires exactly one still waiting after Ns … NPU fault line and no queued while line. That fails without _qs_warned (which is what keeps "once per wait" true) and without the retry condition.
Three things I checked that the diff does not state
waited % 10 < "$POLL"degrades correctly for any poll interval. At the defaultPOLL=2it probes atwaited ≡ 0,1 (mod 10); atGPU_HOLD_POLL=5at≡ 0,5; atPOLL≥10the test is always true, so it probes every poll until it has warned — which is the right fallback, because the guard is-z "${_qs_warned:-}"and nothing is re-read after the first warning.- The cost argument is conservative, measured on this boot:
journalctl -k --since '-10 min' --no-pager -qtakes ~2.4 ms (10 calls in 24 ms), and a 6-hour slice is under 10 ms. At the 10 s cadence that is ~150 ms over a five-minute wait, so the comment's "journalctl is not free every 2 s" could even be dropped — probing every poll would cost nothing here. - Once-per-wait has a visible consequence worth one clause: a second, different fault arriving later in a long wait produces no second warning, because
_qs_warnedis never cleared. That is deliberate ("so the queue stays readable") and the take-time refusal still catches it — but the sentence a reader sees isstill waiting after Ns while the kernel log carries a … fault line, and for a four-minute wait the honest addendum is "logged once per wait; the take re-reads the window".
What is right and should not change
- It decides nothing: the take-time refusal remains the authority, and
arm1bpins that a warning at queue time is followed by a grant once the window clears. A queue-time warning that could refuse would be worse than the bug it fixes. _qs_devstill distinguishes GPU from NPU by looking at the newest hit, and the message names the window it read (in the last ${_qs_window} min) — the two facts a lane needs to know whether the fault is its own.GPU_HOLD_QUEUE_STATE_OFF=1still silences it (arm4), so a lane that wants a quiet queue keeps that, andGPU_HOLD_FAULT_ABORT=0still skips the whole thing.- The measured origin in the comment — all four refusals on the new copy came after waits of 232-296 s, with the queue-time warning (correctly) silent at the first poll — is exactly the evidence that makes a retry interval defensible rather than a guess.
Refs #2494.
What the deploy showed
#2767reads the fault window at the first poll only. The deployed copy then produced four take-time refusals, and every one of them came after a long wait, triggered by a fault that arrived during the wait — with the queue-time warning correctly silent at second zero:So the warning described the one moment a fault is least likely to matter, and the lane still lost a 4-5 minute queue position without notice.
The change
The check now re-reads the window every 10 s while queued (journalctl is not free every 2 s), logs once per wait so the queue stays readable, and says which case it is:
It still decides nothing — the refusal at take remains the authority, the pattern is the same shared
GPU_FAULT_RE/GPU_FAULT_SKIP_RE, andGPU_HOLD_QUEUE_STATE_OFF=1silences both forms.The arm is the case the box produced
Arm 5 in
tests/gpu_hold_queue_state_test.sh: clean log at queue time, a fault injected at t+3 s, the token released at t+12 s. It requires exactly onestill waiting after Ns … NPU faultline and no queue-time line.The 10-second cadence is a deliberate compromise rather than a choice: at 30 s the arm reproduced exactly the production case (fault at 3 s, grant at 12 s) and still reported nothing, which is how I found that the interval matters more than the mechanism.
Not done
No coalescing of repeated warnings across different waits in one queue, and no warning for the thermal or memory gates — the same argument applies to them, but nobody has measured a lane losing a position to those yet, and an unmeasured warning is noise.