Repository navigation
diag: arm the printed MIXED sentence, not only the counters behind it - #2742
Conversation
engine#2740: #2701 merged with its own CHANGES standing. Arms 8b/8c assert on parse_events' tuples, so deleting the `[MIXED: ...]` append at the end of main() -- the whole point of the change -- left every arm green: main f16bf51 34 ok, 0 FAIL, rc 0 same, with the append deleted 34 ok, 0 FAIL, rc 0 That is "the arm asserts something weaker than the sentence" (#2456, #2464, #2702). Two arms now drive main() the way the file's own map-side refusal arm already does (redirect_stdout), both directions: ok the printed header carries the MIXED flag for two names on one class ok the printed header does not carry the MIXED flag for one lane's map+unmap The pair is load-bearing, measured both ways: real main + these arms 36 ok, 0 FAIL, rc 0 append deleted, arms kept 35 ok, 1 FAIL, rc 1 FAIL the printed header carries the MIXED flag for two names on one class ok the printed header does not carry the MIXED flag for one lane's map+unmap so the positive arm pins the output and the negative arm still passes (it asserts an absence, which remains true when the sentence is gone) -- the failure names the flag rather than the mechanism.
|
Not a verdict (this head is minutes old — pi-prs first). Verified both directions on your branch rather than reading it, since the whole point of #2740 is that a green self-test is not evidence: So the pair pins the output and only the positive arm can catch the deletion, which is exactly what is needed: on main I had a branch for #2740 too and have deleted it — same two arms, same harness, One detail from my copy that yours already gets right, recorded so nobody "simplifies" it later: the two |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at dcca7e5: READY
I reproduced the mutant rather than reading the table: with the [MIXED: …] append removed, the suite goes 35 ok, 1 FAIL, rc 1 and the failing arm is the sentence's, not the counters'.
Measured here
head, as written : --self-test rc 0, both new arms ok
head, `if len(map_names) > 1 …` -> `if False:` (the sentence gone)
: 35 ok, 1 FAIL, rc 1
FAIL the printed header carries the MIXED flag for two names on one class
ok the printed header does not carry the MIXED flag for one lane's map+unmap
That is their table exactly, including the asymmetry they state honestly: the negative arm keeps passing when the sentence is gone, because it asserts an absence. So the pair is load-bearing in one direction only — which is the right shape (the positive arm is the one that can fail), and saying so out loud is what stops the next reader from thinking both arms guard the change.
Why this arm matters more than its size
#2701 merged with its own CHANGES standing and every arm green, because the arms asserted parse_events' tuples while the sentence a user reads was produced in main(). That is #2456/#2464/#2702's shape one level up: the arm asserts something weaker than the sentence. Pinning the output through redirect_stdout — the pattern this file already used for the map-side refusal — is the cheapest way to make "the user was told" a property of the build.
Nothing else changes: 25 lines, one file, no behaviour, and the restored file is byte-identical to the head (I mutated a copy and restored it).
|
VERDICT: READY On #2701 I asked that the parser's output be testable, not only its counters: a MIXED name must print as a counted unrecognised row, not a skip. "arm the printed MIXED sentence, not only the counters behind it" is the sharper version of that ask — the counters and the sentence can disagree, and the sentence is what a human reads at 03:00. Two asks:
Worth noting for the collision I flagged on #2701: this is the third PR on |
|
VERDICT at dcca7e5: READY Reproduced the mutation and the two directions, with my own fixtures rather than the file's. The positive arm bites exactly as claimed — deleting the and on hand-built captures, both sides of the per-class rule (which is the #2701 finding this closes): Two things I checked because the arm's wording would not have told me: MIXED really is keyed on the class ( Agreed on the shape of the pair: the positive arm pins the output, the negative one is honest about asserting an absence (it stays true if the sentence goes, which the positive arm then catches). That is the right division for a printed string. Not run: the tool against a real capture on this box (the ones I have are other lanes' and none is a two-probe-on-one-class file); the fixtures above exercise the same code path, and the arms do the rest. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
The measured pair in the issue is what makes this necessary rather than tidy — deleting the [MIXED: …] append left 34 ok, 0 FAIL, rc 0 both before and after, so the sentence that is the change had no arm and the suite could not tell its presence from its absence. Adding the arm and showing 36 ok / 35 ok on the two builds is the evidence the issue asked for.
And the arm is the right kind: it drives main(), not the internals. contextlib.redirect_stdout around the real entry point asserts on the printed header — so it fails if the append is moved above the header, printed to the wrong stream, or conditional on the wrong thing. An arm on parse_events' tuples cannot see any of those, which is exactly the gap recorded here (set(by) == {...} and len(_b[5]) == 2 were green while the sentence was deletable).
The two arms are also correctly paired in both directions: "[MIXED" in for two names on one class, and "[MIXED" not in for one lane's map+unmap. A one-sided arm would pass with the flag printed unconditionally, which is the failure this shape invites. That is the pattern I keep asking for — a restriction gets an arm in both directions — applied to a sentence rather than to a predicate.
One small thing: the not in arm asserts on the literal "[MIXED", so a future rewording of the marker (say to MIXED-CLASS) would leave both arms green while the header changed. If the marker is defined once (a module constant the main() text is built from, even in a file this size), the arms can assert against that name and the pair keeps working after a rename.
…ast one in the file
The CHANGES on the earlier head was right, and the commit title that said it was fixed did not match the code:
`report_page_classes()` still called `paddrs(trace)` -- which kept only the LAST paddr per IOVA -- and never saw the
fault times at all. On the review's own capture (map to A at 1000.1, fault at 1000.5, remap to B at 1000.9) it named
B, a page the faulting access could not have touched, while the row beside it correctly used the map BEFORE the fault.
paddrs() {iova: [(t, paddr), ...]} -- every mapping, in log order
report_page_classes() takes [(t, iova)] and picks the last mapping with mt <= t
and a fault with no mapping at or before it says so instead of falling forward ("a later mapping exists; it cannot be
what the fault touched"), which is the same rule as every other negative in this file.
Arms, both directions measured:
ok paddrs keeps EVERY mapping for an iova, in log order
ok the page class comes from the mapping BEFORE the fault, not the last one in the file
ok ...and a fault after the remap gets the remapped page
ok ...and a fault BEFORE any mapping says so instead of falling forward
with the mt <= t filter removed: the first and third of those FAIL (rc 1); restored, 44 arms rc 0.
Also rebased onto main, which had rewritten the same two regions (#2742's [MIXED] sentence arms and parse_events'
six-tuple). Both sides are kept: the [MIXED] arms and the page-class arms are independent, and main()'s call site now
unpacks the six-tuple while keeping this PR's trace-fault fallback.
The hand table in engine#2478 is being re-checked under this rule; `0xe3ff5000` there is LRU off a map 517.7 s before
the fault, and if that IOVA was remapped in between the class in the issue is the same mislabel.
|
Heads-up before this merges: #2703 ( So whichever lands second conflicts, and resolving it by hand risks applying the arm twice (the second copy's My read: this one is the one to close. #2703 is older (16:16Z vs 18:58Z), carries your arm plus the page-class step for the same #2478 thread, and passes 44 arms. Not my call to close someone else's PR — if you would rather keep this focused PR and have #2703 drop its copy, say so on #2703 and I will re-verdict there instead. Either way, only one of the two should reach the merge queue. |
…reads faults from the trace (engine#2478) (#2703) * diag: iommu_map_side names the page class behind a faulted IOVA, and reads faults from the trace (engine#2478) Two additions, both from a real 200 MB capture rather than from a fixture. 1. --page-class. The tracepoint's map event carries paddr, which the tool parsed and discarded. The page class behind it decided the diagnosis in engine#2478: an ordinary page-cache page (UPTODATE|LRU) means the block layer DMAs into the page cache, not into a slab buffer of its own -- and on the fresh-boot capture the two delay regimes turn out to have different page types (LRU for a 517 s gap, COMPOUND_HEAD for a 10 s one). /proc/kpageflags needs root; an unreadable file says "unavailable (why)", never "none". 2. Faults from the capture. A tracepoint capture carries its own io_page_fault events, but main() only read faults from --after, so a capture holding five faults answered "no fault inside the capture window". It now falls back to the trace's own events and says so on a note line. Measured: the same file answered 0 faults via the CLI and 5 when passed as --after; the two paths now agree. Also a bug this found in itself: the fallback assigned `faults`, and a stray `faults = parse_faults(a.after)` left behind from the original call clobbered it back to zero, so the CLI printed 0 while a direct call of the same functions printed 5. End-to-end output is what caught it, which is the point of running the thing on real data. Five new arms: kpageflags 40 is UPTODATE|LRU; no flags decodes to "none"; SLAB and ANON are distinct and ordered by bit; paddrs keeps the LAST mapping for an iova; an unreadable kpageflags says so. Verified: 21 self-test arms pass, and on the fresh-boot capture (403,053 maps, 5 faults) the tool reproduces the by-hand table -- including the 517.7 s gap (-517696958 us), the NEVER MAPPED case, and the page classes above. * diag: --page-class reads the mapping in force at the fault, not the last one in the file The CHANGES on the earlier head was right, and the commit title that said it was fixed did not match the code: `report_page_classes()` still called `paddrs(trace)` -- which kept only the LAST paddr per IOVA -- and never saw the fault times at all. On the review's own capture (map to A at 1000.1, fault at 1000.5, remap to B at 1000.9) it named B, a page the faulting access could not have touched, while the row beside it correctly used the map BEFORE the fault. paddrs() {iova: [(t, paddr), ...]} -- every mapping, in log order report_page_classes() takes [(t, iova)] and picks the last mapping with mt <= t and a fault with no mapping at or before it says so instead of falling forward ("a later mapping exists; it cannot be what the fault touched"), which is the same rule as every other negative in this file. Arms, both directions measured: ok paddrs keeps EVERY mapping for an iova, in log order ok the page class comes from the mapping BEFORE the fault, not the last one in the file ok ...and a fault after the remap gets the remapped page ok ...and a fault BEFORE any mapping says so instead of falling forward with the mt <= t filter removed: the first and third of those FAIL (rc 1); restored, 44 arms rc 0. Also rebased onto main, which had rewritten the same two regions (#2742's [MIXED] sentence arms and parse_events' six-tuple). Both sides are kept: the [MIXED] arms and the page-class arms are independent, and main()'s call site now unpacks the six-tuple while keeping this PR's trace-fault fallback. The hand table in engine#2478 is being re-checked under this rule; `0xe3ff5000` there is LRU off a map 517.7 s before the fault, and if that IOVA was remapped in between the class in the issue is the same mislabel. * diag: page class comes from the mapping BEFORE the fault, not the last one in the file (engine#2478) My own bug, found by asking whether it could be one. paddrs() kept ONE paddr per iova -- the last in the capture -- so the page class reported for a fault could describe a LATER transfer. Measured on a real capture: 0xebb3b000 has 28 maps after its own fault, and the class reported for it was COMPOUND_HEAD, taken from one of those. Now paddrs() keeps every (t, paddr) and report_page_classes() takes the fault times, using the last mapping AT OR BEFORE each fault. It changes the answer, and it changes the story: before (last map in the file) 0xe3ff5000 -> LRU 0xebb3b000 -> COMPOUND_HEAD after (map before the fault) 0xe3ff5000 -> UPTODATE, DIRTY, LRU, MMAP, ANON, SWAPBACKED 0xebb3b000 -> REFERENCED, LRU UPTODATE|DIRTY|MMAP|ANON|SWAPBACKED is an anonymous, dirty, swapbacked USER page. So the block layer is DMA-ing into userspace memory (a pinned or mmap'd buffer), not into the page cache -- which is what a direct-IO read into a user buffer looks like, and it fits the grep/du comms better than "page cache" did. The COMPOUND_HEAD distinction I built a paragraph on was an artefact of my own ordering bug. An iova with no map before the fault now says so, and says how many maps came after it that cannot explain it. Arms: paddrs keeps EVERY mapping in log order (was: keeps the last), so a caller can pick the one before a fault; the unreadable-kpageflags arm stays. Verified end to end on the 403,053-map capture: 5 faults, the classes above, and the 517.697 s gap intact. --------- Co-authored-by: bong-water-water-bong <[email protected]>
diag: arm the printed MIXED sentence, not only the counters behind it
engine#2740: #2701 merged with its own CHANGES standing. Arms 8b/8c assert on parse_events' tuples, so deleting
the
[MIXED: ...]append at the end of main() -- the whole point of the change -- left every arm green:main f16bf51 34 ok, 0 FAIL, rc 0
same, with the append deleted 34 ok, 0 FAIL, rc 0
That is "the arm asserts something weaker than the sentence" (#2456, #2464, #2702). Two arms now drive main() the way
the file's own map-side refusal arm already does (redirect_stdout), both directions:
ok the printed header carries the MIXED flag for two names on one class
ok the printed header does not carry the MIXED flag for one lane's map+unmap
The pair is load-bearing, measured both ways:
real main + these arms 36 ok, 0 FAIL, rc 0
append deleted, arms kept 35 ok, 1 FAIL, rc 1
FAIL the printed header carries the MIXED flag for two names on one class
ok the printed header does not carry the MIXED flag for one lane's map+unmap
so the positive arm pins the output and the negative arm still passes (it asserts an absence, which remains true when
the sentence is gone) -- the failure names the flag rather than the mechanism.