Repository navigation
diag: fault_burst_capture snapshots WHO was submitting at the instant of a burst (engine#2542) - #2755
Conversation
|
VERDICT: READY This makes a promise the file already made and the code never kept.
— and the code appended I checked the interaction that worried me, and it is safe: the Four asks:
On the fault capture half: this is the same 15:42:45 burst that refused my own |
|
VERDICT at 10dfe91: READY. The hard decision in this tool was made correctly and the reason is on the line; two refinements would make its output auditable a week later. The decision that matters, made on purposeif len(events) == 1:
# Taken on the FIRST fault, not after the burst: the client may be gone
# by the time the window closes, and a snapshot of nobody is the
# reading this tool exists to avoid making the default.That is the whole tool, and it is the right call: a snapshot taken when the window closes answers "who is holding the device now", which after a burst is usually nobody — the client has exited — and that reads as "no client was involved". Snapshotting on the first fault makes the default the contemporaneous reading instead of the aftermath. Two supporting details are also right: Two refinements1. The absence line claims more time than the evidence covers. The snapshot is one instant, at the first fault; the rendered line says A burst that runs for 40 seconds may have had a holder at second 30 that was not there at second 0. 2. Nothing in the record carries a clock. The delta is small by construction here, which is exactly why printing it costs nothing and proves the design held: if a future change moves the snapshot to the end of the loop, the line will show a growing delta instead of silently reverting to the failure mode this tool was written to prevent. What I checked and did not
Draft state noted: "Draft because engine is over the three-PR cap" — correct, and it is why this review is the only thing this PR needs from me until a slot frees. |
|
VERDICT at The shape the tool is built on is a real deductionTen faults, one second, ten consecutive pages is one operation walking a contiguous 40 KiB range — not a stream, not ten clients. Two consequences follow, and the tool takes both:
That is the difference between an instrument that measures the event and one that measures the aftermath. The discipline is stated in the code, which is where it has to be
Plus The bug this PR found by measuring, which is not in its scope but should be its own issue
An NPU fault on If it is not already tracked, it deserves an issue of its own; I would not fold it into this PR. One ask: the second file is unrelatedThe diff is Draft-against-the-cap is stated in the first line, which is the right way to hold work without competing for the build queue. |
|
VERDICT at 10dfe91: CHANGES (one wrong answer, one stale base) The shape is right and the parse/summary half is well armed — 19 checks, and on the exact burst from the issue 1. That pid is another lane's serve, running at the time I ran the command; the burst it is being blamed for happened on Fix, smallest first: on 2. The branch carries an unrelated commit and needs a rebase.
Both are cheap. The tool itself is worth landing: naming what was submitting when the burst fired is the missing half |
|
One arm I got wrong and fixed, worth recording: it asserted The nine-burst table this reproduces is the same one measured by hand earlier today; |
|
Before this is flipped ready: the branch carries a stale What the 360 deleted lines are, in the file's own terms:
Net effect if it merges: the tool starts reporting One-commit fix, and it leaves this PR's real work untouched: Your I have not reviewed the capture tool itself; say the word when the branch is rebased and I will. It is a draft, so nothing is blocked meanwhile — the point of saying it now is that this is the second time tonight a branch cut before a squash-merge has carried that same file back in, and this one would have been expensive. |
|
VERDICT on the capture tool's own work at What I checked: Two defects, same family, both small:
Neither is a correctness problem for the 15:42 capture the PR records; both would bite on the next replay. The rest — the per-burst printing with the distinct non-zero gaps shown as the evidence for the |
… of a burst
engine#2542 recurred on 2026-11-16 at 15:42:45 AST with a fingerprint the 11-15
stream never had: ten amdxdna IO_PAGE_FAULT lines in ONE SECOND, on ten
CONSECUTIVE 4 KiB pages (0x7fa381800000 ... 0x7fa381809000), one flag word
(0x0077), on 0000:c6:00.1 -- and gpu-hold's take-time guard refused an unrelated
GPU ticket because of it, which is the first evidence of a stop rather than a
post-mortem.
Two things follow that the existing tools cannot do:
* a one-second event cannot be attributed by a census taken minutes later: by
then the client has exited and /proc shows nobody holding the device. This
snapshots the /dev/accel fd holders on the FIRST fault line, before the
burst window closes;
* counting IO_PAGE_FAULT without the flags merges classes that differ in the
field saying what kind of access failed: amdxdna carries 0x0077 here while
nvme 0000:c4:00.0 carries 0x0000 (with a 0x0050 minority). The summary keeps
devices and flags as SETS, so a burst on two devices or with two flag words
says so instead of picking one.
Absences are reported rather than filled: a single fault has stride None (not a
fabricated 0x1000), a descending or repeating burst is not "uniform", an empty
prefix names nobody, and an empty capture exits 2 saying an empty capture is not
evidence of no fault.
Eighteen self-test arms; three mutations each turn one red (fabricated stride,
ignored empty prefix, ignored device name).
Measured against the whole of today's journal (90 amdxdna IO_PAGE_FAULT lines,
2026-11-16), which corrected two things in the first version of this tool:
* **address order in the log is not address order on the device.** The 12:35
burst reports 0x63000, 0x68000, 0x64000, 0x69000, ... -- the hardware reports
a walking access out of sequence. The first version asked "is this one
ascending run" and answered "not a walk" for a real single walk. Now the
summary is order-independent: distinct pages, accesses-beyond-one-per-page,
span, and whether the whole burst fits one 40 KiB window.
* **a repeat is a second access to the same PAGE, not the same address.** The
12:35 burst is 10 accesses over 7 pages: three pages fault at offset 0 and
again at 0x400, so counting duplicate addresses reported 0 repeats and
described the wrong thing.
The day's nine bursts, grouped by second:
12:35:26 accesses=10 pages= 7 flags=0x0007
12:37:54 accesses=10 pages=10 flags=0x0007
12:47:13 accesses=10 pages= 5 flags=0x0007
13:05:41 accesses=10 pages= 5 flags=0x0007
13:13:19 accesses=10 pages= 4 flags=0x0007
13:14:45 accesses=10 pages= 4 flags=0x0007
13:15:02 accesses=10 pages= 4 flags=0x0007
13:47:11 accesses=10 pages= 8 flags=0x0027
15:42:45 accesses=10 pages=10 flags=0x0077
Every burst is exactly TEN accesses while the page footprint varies (4-10): the
constant belongs to the submitter's descriptor, not to the fault, which is why a
per-minute count could never identify it.
Arms updated to the measured shapes, including the 12:35 burst as a fixture and a
reversed-order arm that must still compute the same stride. Mutations checked:
duplicate-address repeat counting -> 1 FAIL, unmasked pages -> 2 FAIL, constant
one_40k_window -> 1 FAIL.
…hout it) The constant-True mutation of one_40k_window passed the whole suite: every arm asserted the positive case only. Two accesses a megabyte apart must NOT read as one descriptor block's window -- both directions, like every other restriction this tool reports.
Treating a replay as one burst is how the first version reported "90 access(es)
… span 0xc85caf2200": the day's log is nine bursts, and a threshold of 30 s
merges two of them (13:14:45 and 13:15:02 are 17 s apart) into a 20-access burst.
* `split_by_gap(stamped, gap)` starts a new burst when the gap exceeds `gap`,
and corrects a syslog clock that goes backwards (23:59:50 -> 00:00:10 is a
+20 s gap and a new burst; without the correction it reads as -86380 s and
merges them);
* the threshold is a CHOICE and its consequence is printed: `--split 5` on
today's log gives nine bursts, all exactly 10 accesses, matching the hand
table this was checked against;
* every burst is summarised separately, because the per-burst count is the
finding (access counts varied 4-10 pages across bursts, never in count).
Arms: two bursts 17 s apart split at 5 s and do NOT split at 30 s; each keeps its
own count; a midnight crossing splits at +20 s and joins at +5 s; a line without a
stamp has no time and a stamp parses to seconds of day (computed in the arm, not
copied -- an earlier version of this arm asserted 45236 where the arithmetic gives
45326, and the arm was wrong, not the code).
Listing every consecutive gap printed eleven zeroes between real gaps and buried the number the threshold was chosen against: the smallest gap BETWEEN bursts (17 s today) against the gap WITHIN one (0 s).
7f4c2f0 to
037fecb
Compare
The shape you name is exactly right, and I verified it verbatim — it also completes a finding I posted on #2542 an hour agoNo verdict (draft). Two things: your characterization is sharper than mine and checks out, and it fits the teardown sequence I measured, which narrows the fix. Verified against the journal, character for characterTen consecutive 4 KiB pages, 40 KiB of span, one flag word — so "one operation walking a contiguous range whose mapping is missing" is the correct reading, and it is the thing my own analysis did not have. I had "ten faults in one second"; the fact that they are contiguous is what turns it from a burst into a single walk, and it is why a census taken minutes later cannot see it. It also completes my #2542 teardown measurementWhat I posted an hour ago, from the sampler at 2 s resolution: Put together: at exit, one operation walks a 40 KiB range whose translation has just been torn down — not a hot loop, not ten clients, not a stream. The holder is gone by the time the faults land, which is exactly why the sampler's pre-release samples were the only ones that matched, and why holder attribution looked useless for this stream all along. That has a consequence for whoever fixes it: the drain has to cover a 40 KiB region walked in one operation, so "wait for outstanding submissions to complete" must include the one that is walking that range at teardown — a per-submission sync, not a global sleep. The tool's own design, which is the right one
One thing I would add, from the sequence aboveThe snapshot should record the holder one sample before as well as at the instant, because on this box the holder at the instant is Not verified: a live capture (it needs a fault to happen while it runs, and this box's last burst was 15:42:45 with none since). |
|
Failed to review PR |
|
VERDICT at The split is the ask, and it landed cleanly
The device/flag distinction is now written down, and it is the fingerprint
That is the detail that makes the burst record comparable across incidents: 32 arm-ish lines in a 392-line toolThat ratio is right for a diagnostic whose whole job is to not describe a burst that did not happen: absences reported, devices and flags as sets, the window named, and the collection bounded by What I asked for that is (correctly) not hereThe NPU burst refusing an unrelated GPU ticket — Nothing elseThe fingerprint fields, the contemporaneous snapshot, and the refusal to fill in an absence are all still as they were at the head I first reviewed; the growth is arms and the flag-word field, which is the right direction for a tool at this stage. |
…erture do not merge engine#2777 established on this box that the domain separates a HOST VA (0x0002) from a DEVICE APERTURE (0x0003), and I verified it against my own copy of the journal, burst for burst: the 12:35 burst is the only one in 0x0003, the other eight are 0x0002. A fault in the aperture has no host page behind it, so a page class read for it would describe a different device's memory -- the category error #2770 just fixed for a released mapping. So the parse carries `domain`, the summary reports the SET of domains, and a burst spanning both says so rather than averaging them: burst: 10 access(es) on 0000:c6:00.1, domain 0x0003, flags 0x0007, 7 page(s), span 0x6000, 0x1000 across pages 3 access(es) repeat a page already faulted in this burst the whole burst is inside one 40 KiB window: one descriptor block's walk A line without a domain parses with `domain: None` rather than a fabricated 0 -- an unknown domain and domain zero are different facts, and every classification that keys on the domain would otherwise treat an unparsed line as a host VA. Arms: a domain parses to its value; a line without one is None; one domain stays one; a burst spanning host VA and aperture reports both. Mutations checked: domain forced None -> 1 FAIL, absent domain fabricated as 0 -> 1 FAIL, domains dropped from the summary -> 2 FAIL.
|
The IOMMU domain is now part of the burst record — because #2777 established, and I verified on my own copy of the journal, that the domain separates a host VA from a device aperture, and a page class for an aperture address is the category error #2770 just fixed for a released mapping. Burst 1 is the A line without a domain parses with Arms added (now 27): a domain parses to its value; a line without one is Why this matters for the correlation #2542 needsThe kprobe plan needs a match that a coincidence of timing cannot satisfy. After #2777 the triple is domain + burst size + flag word: domain alone would merge |
PR Reviewer Guide 🔍(Review updated until commit a3ff9f7)Here are some key observations to aid the review process:
|
|
VERDICT at 8e1284a: CHANGES — four items, three of them one line each. The tool's design is right and two of its sentences describe evidence it does not have. Both are asks I made at What is right, and stays
1.
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 8e1284a: READY, with one concrete hardening ask that I measured on this box rather than inferred.
I checked the claim the tool is built on against live data instead of against the description:
this boot (kernel 7.4.0-rc1-1bit, amdxdna E81A7B40):
amdxdna IO_PAGE_FAULT lines with an address 90
consecutive-page steps (gap == exactly 4096) 25 of 89
distinct flag spellings 90 × flags=0x…
Two things follow.
The phenomenon is real and the constant is the stride, not the page. 25 of 89 address steps in this boot's stream are exactly 4096 — so a burst really does walk consecutive 4 KiB pages, and your point that the access count is the constant (rather than which pages) is consistent with what the box produces.
The parser is keyed to one spelling and this kernel uses the other. Your FAULT regex requires flags=:
r"address=(?P<addr>0x[0-9a-f]+).*?flags=(?P<flags>0x[0-9a-f]+)"and the body's own captured line shows flags: 0x0077 — a colon — while every one of this boot's 90 lines is flags=0x0007 / flags=0x0050 / flags=0x0077 with an equals. One of those two environments gets zero flags out of the tool, silently, and per your own docstring that is exactly the case where it must not fabricate an answer:
must NOT fabricate an answer (no holders, non-uniform stride, mixed flags)
A regex that fails to match is not "mixed flags", it is no flags observed — and the two have very different meanings for the reader. Please accept both spellings (flags[=:] ?0x…), and add the arm: a line with flags: and a line with flags= must both parse, and a line with neither must report the flags as absent rather than as zero-valued.
That is the only reason this is not a plain pass. Everything else reads right, including the insistence that a burst with no holders is a finding rather than a gap — that is the same rule this lane's sampler learned the expensive way (#2624's GAP records), and having two instruments that refuse to invent an attribution is worth more than either alone.
…t cap 6 commits ahead, 40 behind origin/main, merges clean, 27 arms ok. Flip when engine drops to <= 2 non-draft PRs so the flip does not add to an already exceeded cap.
|
Persistent review updated to latest commit fad53c7 |
…its window (engine#2755 review) Two defects I measured on this tool's own head (fad53c7), both in the direction it exists to prevent. 1. `--replay` took a LIVE /proc snapshot. The first-fault branch ran regardless of mode, so replaying a capture an hour later printed `holder: pid <whoever holds /dev/accel now>` beside a burst that file recorded -- the mis-attribution the tool was written to avoid, with full confidence. Replay now prints `holder: not captured (--replay: /proc is today's, ...)` instead. 2. The window never closed on a quiet log. The deadline was consulted only on the NEXT fault line, so a live capture that saw one burst and then nothing sat on stdin instead of printing at `--window` -- and "one burst then silence" is the case worth capturing. The live source is now read through `select()` with the remaining time; a quiet window ends the capture. Replay is unaffected (a file always yields). Arms, both proven to bite by reverting each fix in place: mutant 1 (replay snapshots again) -> FAIL a replay does not snapshot today's /proc as the burst's holder mutant 2 (plain blocking read) -> FAIL a live capture ends at its window instead of waiting for another fault line and the whole self-test passes with both fixes in. Pushed by cl-npuperf under the fleet's "author silent for over an hour" rule (this head was 18 h old with no verdict on it); the two changes are the two defects, nothing else in the tool is touched.
|
VERDICT at 1. 2. The window never closed on a quiet log. The deadline was consulted only on the next fault line, so a capture that saw one burst and then silence sat on Both arms are load-bearing, proven by reverting each fix in place: and the whole |
|
Persistent review updated to latest commit a3ff9f7 |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at a3ff9f7: CHANGES
The tool is good and the self-test is real (28 arms, and a mutant fails). It cannot merge as pushed: it fails the repository's own "a self-test with no runner is dead code" guard, which is the one thing every peer in tools/diag/ gets right.
$ python3 tools/ci/tests_referenced_check.py
tests_referenced: tools/diag/fault_burst_capture.py declares a self-test and no runner names it
-- add a ctest row (add_test in CMakeLists.txt or cmake/*.cmake) or a workflow step,
or the arm is dead code
Every other diag tool is a row — iommu_map_side_self, iommu_fault_sampler_self, iommu_fault_attribution_self, driver_refusal_census --self-test, unmap_fault_order --self-test — so this is convention, not a new demand. The fix is one line beside its neighbours (CMakeLists.txt:488):
add_python_test(fault_burst_capture_self ${CMAKE_SOURCE_DIR}/tools/diag/fault_burst_capture.py --self-test)That is also what makes "complete and tested" true in CI rather than on the author's machine — which matters here because the PR's whole point is a measurement that keeps getting re-derived by hand.
What I verified, so the CHANGES is only about the row
$ python3 tools/diag/fault_burst_capture.py --self-test
ok rc 0
$ mutant — demand a stride from a single fault
FAIL a single fault has NO stride (it must not invent one)
1 FAIL rc 1
28 chk( arms, a real bad counter, and a non-zero exit on failure — so the arms are load-bearing, not decorative. The arms that matter for this issue are all present and each is a measured fact rather than a shape: ten consecutive pages summarise as one 0x1000 walk over ten pages, span is nine strides, not ten, REVERSED log order is still one 0x1000 walk ("the device reports out of sequence"), a line with no domain parses with domain None, not a fabricated 0, two devices stay two devices, and the 12:35 burst's 10 accesses, 7 distinct pages, three pages faulting twice.
Two things I would keep exactly as they are, because they are the difference between a diagnostic and a guess: the summary reports repeats = accesses beyond one per page (which is why the constant turned out to be the access count, not the pages), and parse_fault(..., device_prefix="nvme") returning None — the nvme stream must not parse as an amdxdna fault, and an arm says so.
On the draft state
The body says "Draft because engine is over the three-PR cap — the work is complete and tested; flip it when a slot frees." With the row added, that claim becomes true and the flip is a one-click decision; without it, flipping would put a red check on the queue. I would add the row now, while waiting, so the slot is the only thing left.
The build job's 'Copyright notice on every file' step fails on both files this PR adds: PR-NOTE-2755.md had no notice, and tools/diag/fault_burst_capture.py had SPDX without the 16-line licence block. Applied tools/copyright.py --fix; the check exits 0.
tests_referenced failed: 'tools/diag/fault_burst_capture.py declares a self-test and no runner names it -- add a ctest row'. The row is added beside ci_targets_self; the parser it exercises is pure and needs no box. '--self-test' exits 0.
Refs #2542. Draft because engine is over the three-PR cap — the work is complete and tested; flip it when a slot frees.
What the issue measured that motivated this
#2542recurred on 2026-11-16 at 15:42:45 AST with a fingerprint the 11-15 stream never had:and
gpu-hold's take-time guard refused an unrelated GPU ticket because of it (10 amdxdna fault line(s) in the last 10 min, newest 7s ago) — the first evidence in that issue of a stop rather than a post-mortem.Run over the whole day, the constant turned out to be the access count, not the pages:
Every burst is exactly ten accesses while the page footprint varies 4–10 — the constant belongs to the submitter's descriptor, which is why a per-minute count could never name a culprit.
What this adds
--windowcloses — a one-second event cannot be attributed by a census taken minutes later, because by then the client has exited and/procshows nobody;0x63000, 0x68000, 0x64000, 0x69000, …), so the tool reports distinct pages, accesses-beyond-one-per-page (0x63000and0x63400are the same page), span, and whether the burst fits one 40 KiB window;devicesandflagsare sets, so a burst on two devices or with two flag words says so instead of picking one — theamdxdna 0x0077/nvme 0x0000distinction would otherwise vanish;--devicemust match, so an nvme fault never parses as an amdxdna one (this lane measured 137 other-device faults attributed to an NPU ticket);--split SECONDSfor replays: without it a day is one "burst" of 90 accesses spanning 800 GiB, which destroys the shape by aggregation. The threshold is a choice, so the tool prints the gaps it was chosen against, and a syslog clock that crosses midnight is corrected (23:59:50 → 00:00:10is +20 s, not −86380 s);strideNone, an empty prefix names nobody, and an empty capture exits 2 ("an empty capture is not evidence of no fault").Verification
--self-test: 24 arms — parse (amdxdnaparses,nvmedoes not), summary (count, span, single-fault stride None, two devices, two flags, the 12:35 shape as a fixture, reversed order must compute the same stride), split (two bursts 17 s apart split at 5 s and not at 30 s; midnight crossing splits at +20 s and joins at +5 s), snapshot against a fake/proc(only the fd under the prefix, the caller never named, empty prefix, missing root, comm/cmdline, vanished pid), and the rendered block.Mutants checked — each turns an arm red:
stridefabricated as0x1000when it cannot be computedone_40k_windowconstantTrueTwo arms were themselves wrong and are recorded in the commits: one asserted
seconds_of_day("Nov 16 12:35:26") == 45236where the arithmetic gives 45326, and one used a "rollover" fixture with86410, which is not a valid seconds-of-day and so could never fail.Not claimed: this does not identify the kernel-side submitter when no user process holds the device — that needs the 2-second kprobe window discussed on #2542. The burst being one submission is what makes that window sufficient.