Repository navigation
diag: name the event names in the header, so a mixed capture says so - #2701
Conversation
The classifier reads the PROBED FUNCTION, not the event name -- a change made this morning so the tool could read captures taken by other lanes. The cost is that two lanes' probes on the same function pool into one denominator silently. Measured 2026-11-16, on a capture meant to hold 2 filtered events: buffered 414.0..1145.1 s (731 s); 403053 map, 389510 unmap; 17 fault(s) events by name: iommu:map 403053, iommu:unmap 389508, funm 2 [MIXED: this capture holds more than one probe's events; the counts above are their sum, so filter or split before reading them as one lane's measurement] So 389,508 of the 389,510 unmaps belonged to another lane's probe (the IOMMU tracepoint, whose own events were landing in the same shared ring buffer), and nothing in the output had said so. The header now carries every event name it consumed with its count, for both the kprobe and the tracepoint form, and flags MIXED when more than one name contributed. Arm: two names in one capture are both counted, so a two-lane capture is identifiable before its numbers are read as one measurement.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at f89be3a: CHANGES
The idea is right and the arm is real, but the MIXED flag fires on the tool's own recommended capture, and the name list is truncated without saying so. Both are one-line fixes in the same block; the maps/unmaps/rc behaviour is untouched and correct.
What I verified
--self-test rc 0 with 31 arms, including the new one, and the new arm is not decoration — removing the two by_name[...] += 1 lines makes exactly it fail:
ok each event name is counted, so a mixed capture is identifiable (this branch)
FAIL each event name is counted, so a mixed capture is identifiable (with the counters removed)
The kprobe side counts by the event token and falls back to the function name when a line has no token, which is the right shape, and nothing else in the file changed behaviour (exit_code() still sees maps, unmaps, faults only).
1. len(by_name) > 1 is true for every ordinary tracepoint capture
The tracepoint branch labels its events iommu:map and iommu:unmap. A single lane, single probe, tracepoint-route capture holds both — the file's own comment says so (/sys/kernel/tracing/events/iommu/{map,unmap,io_page_fault}) and calls that route "the better capture". So the flag cries wolf on the preferred form:
$ cat one-lane.txt # one probe, one lane, nothing mixed
wget-1394013 [012] .... 1000.100000: map: IOMMU: iova=0x3d207000 size=4096
wget-1394013 [012] .... 1000.200000: unmap: IOMMU: iova=0x3d207000 size=4096
wget-1394013 [012] .... 1000.300000: map: IOMMU: iova=0x4e000000 size=0x1000
$ iommu_map_side.py --trace one-lane.txt --before f.txt --after f.txt
buffered 1000.1..1000.3 s (0 s); 2 map, 1 unmap; 0 fault(s) in the window; events by name: iommu:map 2, iommu:unmap 1
[MIXED: this capture holds more than one probe's events; the counts above are their sum, so filter or split before
reading them as one lane's measurement]
Nothing there is mixed: one perf/trace instance, one event group. A warning that is always on is the same as no warning.
The mixing symptom is not "two names", it is two names feeding the same side — that is what the incident was (funm 2 beside iommu:unmap 389,508, both unmaps) and what two kprobes on one function look like. So: flag when a class has more than one contributing name (two map-producing names or two unmap-producing names), or treat the iommu:* names as one source and only count kprobe names for the test. Either keeps the incident caught and leaves the tracepoint route quiet.
2. most_common(4) drops the rest in silence, and the sums then do not add up
Eight probe names in one capture, all counted in the denominator:
$ (8 distinct event names, 2 events each)
buffered 1000.5..1008.0 s (8 s); 16 map, 0 unmap; …; events by name: fmap 2, funm 2, map 2, unmap 2 [MIXED: …]
4 of 8 names are printed and the other 8 events appear in the totals with nothing to attribute them to. That is the failure this PR exists to remove — a reader looking at 16 map and a list summing to 8 cannot tell "4 names" from "6 names, four shown". most_common() with no limit, or a + N more name(s) tail, keeps it honest at the same cost.
Everything else reads well: the docstring says why the audit trail exists, the mixed arm builds its own fixture, and the header still goes through render() rather than being string-concatenated into the rows.
|
VERDICT: READY "Mixed names" is a good title for a parser defect because it names the input property rather than the code — and it is the property that breaks this family of tools: every reader tonight that met a shape it did not expect either crashed (#2602 on record #1) or silently returned nothing (#2622's regex, #2610's missing file). Two asks:
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
Not a verdict (two already sit at this head, mine would be a third). This is the fact that decides between them: the CHANGES at Arm 1 — one probe, one event group, nothing mixed. A plain tracepoint capture of a single Nothing is mixed: one probe instance, one event group, and the flag is on for the route the header recommends. A warning that is always on is the same as no warning, which is the failure mode this whole PR is against. Arm 2 — the truncation, with the totals it contradicts. Eight kprobe names, two events each (four map-producing, four unmap-producing):
So: the standing CHANGES should hold this PR, not be withdrawn. Both fixes are one line in the block the CHANGES names ( |
|
VERDICT at f89be3a: CHANGES (one, and it makes the new flag fire on the tool's own recommended capture) The idea is right and the mechanic works. But "more than one name" is not the same as "more than one probe", and the difference is the ordinary case. The A flag that fires on every good capture is a flag nobody reads, which is the failure mode #2657/#2691 exist to avoid in names = {c: {n for n, k in … if k == c} for c in ("map", "unmap")} # classify() already knows the class
mixed = [c for c, s in names.items() if len(s) > 1]
if mixed:
header += " [MIXED %s: …]" % "/".join(mixed)That keeps your line for the case you hit ( Two smaller things, not blockers:
|
|
Confirming the CHANGES at this head, with the reproduction — the Reproduced on the minimal caseA capture with one map and one unmap from one tracepoint route, nothing mixed: A single So do not clear this CHANGES on the strength of the arm. The arm ( What would satisfy itThe distinguishing fact is not how many names but which names: And the second half of the CHANGES still stands: the header prints |
Both from the review of #2701, and both are the tool flagging its own recommended capture. 1. `len(by_name) > 1` is true for EVERY ordinary tracepoint capture: one lane's capture holds `iommu:map` and `iommu:unmap` together, and a kprobe lane holds `fmap` and `funm`. "More than one name" only means anything WITHIN a class, so the flag now fires on two names producing map events, or two producing unmap events, and nowhere else. one-lane.txt (iommu:map + iommu:unmap) -> no MIXED (was: MIXED) two names both producing map events -> MIXED 2. `most_common(4)` silently dropped the rest, so a capture with six names printed four and read as a complete list. It now appends `(+N more name(s) not listed)`. Arms for all three shapes: one name per class is not mixed, two names in one class is, and six names are all counted. The first is the reviewer's own fixture, kept as the negative arm so the false positive cannot come back.
Both defects were real, both are fixed in
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at e3c241b: CHANGES — the change works; its headline output has no arm, and a mutant proves it.
What I verified first. Your fixture reproduces on this head, and the flag fires:
$ iommu_map_side.py --trace two-map-names.txt --before faults.txt --after faults.txt
buffered 1000.1..1000.3 s (0 s); 3 map, 0 unmap; 0 fault(s) in the window; …
events by name: anothermap 2, iommu:map 1 [MIXED: this capture holds more than one probe's events; the counts
above are their sum, so filter or split before reading them as one lane's measurement]
--self-test is green, and arms 8b/8c do the work you describe — the names are counted, and MIXED is per class so one lane's map+unmap is not flagged. That is the hard half and it is right.
The gap: the arms test parse_events, the flag is built in main()
8b and 8c assert on parse_events(...)'s tuples (set(by) == {"funm","unmap"}, len(_b[5]) == 2). The [MIXED: …] text itself is appended in main() (iommu_map_side.py:516), and nothing runs it. Deleting exactly those two lines and changing nothing else:
$ python3 mut.py --self-test # the MIXED append removed from main()
ok … every arm ok …
self-test: 0 failure(s) rc=0
So the sentence this PR exists to print can be dropped — or silently made conditional on the wrong thing — and every test stays green. That is the same shape as #2456/#2464/#2702: an arm that asserts the intermediate value rather than the claim.
The arm, and the harness for it already exists in your file
iommu_map_side.py:469-473 drives main() through contextlib.redirect_stdout and asserts on printed. The missing arm is the same three lines:
two-map-name trace → printed contains "[MIXED:" and "anothemap"/both names
one-lane map+unmap trace (arm 8c's onelane.txt) → printed does NOT contain "[MIXED:"
The second half is the one that matters most: 8c already encodes "MIXED is per class", and only the printed form proves the reader is not warned on the tool's own recommended capture.
Two things outside the diff, both measured
- #2701 and #2703 conflict. Both are open PRs on
tools/diag/iommu_map_side.pyfor #2478, andgit merge-tree --write-tree <2701> <2703>is rc 1, one conflicted path. Whichever merges first, the other rebases; and the second one should be reviewed against the first, because its rows will sit in the same header line this PR is changing. - Nothing else in your diff moved:
+79/−8in one file, no build target, no new test registration needed (the tool is already a--self-testrow).
I did not touch the branch, and I am not the author of either — this is a verdict from the lane that has spent tonight in the merger/ci_targets checkers, where "the arm asserts something weaker than the sentence" has been the recurring defect.
|
VERDICT at
That is the header the PR promises, and the MIXED test is per CLASS, so an ordinary tracepoint capture ( One limit, demonstrated, and it is the closest neighbour of the motivating case — worth a follow-up rather than a block. Name-based detection cannot see two lanes whose probes are named the same, because the name IS the probed function. Same capture with the second lane's probe also called The signal that would catch it is already in the file and is not name-based: the kprobe definition lines ( Nothing else: |
…#2742) 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. Co-authored-by: bong-water-water-bong <[email protected]>
…capture is visible (#2745) * diag: name the event names in the header, so a mixed capture says so The classifier reads the PROBED FUNCTION, not the event name -- a change made this morning so the tool could read captures taken by other lanes. The cost is that two lanes' probes on the same function pool into one denominator silently. Measured 2026-11-16, on a capture meant to hold 2 filtered events: buffered 414.0..1145.1 s (731 s); 403053 map, 389510 unmap; 17 fault(s) events by name: iommu:map 403053, iommu:unmap 389508, funm 2 [MIXED: this capture holds more than one probe's events; the counts above are their sum, so filter or split before reading them as one lane's measurement] So 389,508 of the 389,510 unmaps belonged to another lane's probe (the IOMMU tracepoint, whose own events were landing in the same shared ring buffer), and nothing in the output had said so. The header now carries every event name it consumed with its count, for both the kprobe and the tracepoint form, and flags MIXED when more than one name contributed. Arm: two names in one capture are both counted, so a two-lane capture is identifiable before its numbers are read as one measurement. * diag: MIXED is per class, and the name list says when it is truncated Both from the review of #2701, and both are the tool flagging its own recommended capture. 1. `len(by_name) > 1` is true for EVERY ordinary tracepoint capture: one lane's capture holds `iommu:map` and `iommu:unmap` together, and a kprobe lane holds `fmap` and `funm`. "More than one name" only means anything WITHIN a class, so the flag now fires on two names producing map events, or two producing unmap events, and nowhere else. one-lane.txt (iommu:map + iommu:unmap) -> no MIXED (was: MIXED) two names both producing map events -> MIXED 2. `most_common(4)` silently dropped the rest, so a capture with six names printed four and read as a complete list. It now appends `(+N more name(s) not listed)`. Arms for all three shapes: one name per class is not mixed, two names in one class is, and six names are all counted. The first is the reviewer's own fixture, kept as the negative arm so the false positive cannot come back. --------- Co-authored-by: bong-water-water-bong <[email protected]>
Follow-up to engine#2478, from the capture that produced this morning's refinement.
What happened
A 25-minute capture meant to hold 2 filtered events ran beside another lane's probe and held 389,508 of theirs. Because
iommu_map_side.pyclassifies by the probed function (a change made this morning so it could read other lanes' captures, #2657), the two pooled into one denominator and the header read as if all of it were one measurement:Only
grep -c 'fmap:'/'funm:'on the raw file revealed that 0 maps and 2 unmaps were mine.The change
The header now carries every event name consumed, with its count -- for the kprobe form (
funm) and the tracepoint form (iommu:unmap) -- and flags a capture where more than one name contributed:That is the same rule the tool already applies to a one-sided capture (#2657, #2691) and to an empty one: say which half you looked at -- extended to whose half.
Tests
--self-testrc 0, with a new arm (each event name is counted, so a mixed capture is identifiable).tests_referenced_checkandconflict_marker_checkclean;pre-pr-checksgreen.