Repository navigation
diag: unmap_fault_order reads the iommu tracepoints, and a format it does not know says so - #2635
Conversation
…does not know says so The tool knew one capture shape -- a kprobe with a hand-written format string (`unm: ... iova=0x...`) -- and the kernel has two: `events/iommu/unmap` writes `unmap: IOMMU: iova=0x%016llx - 0x... size=%zu`, which is the better instrument (not ratelimited, both sides in one trace, us ordering) and parsed as nothing. Measured on engine#2478: a tracepoint capture of a real unmap fed to the tool printed "no unmap events in the trace -- was the probe armed?" -- blaming the probe for a parser miss, which sends the reader to the wrong place. Both shapes now parse. And when a non-empty capture matches neither, the message names the two shapes and says PARSER miss, keeping "empty capture" for a file that really has no lines. Arms: a tracepoint line parses (iova, size); the kprobe shape still parses beside it. Mutation (tracepoint branch removed) fails the first by name.
|
VERDICT: READY "The kernel has two ways to capture an unmap, and this tool knew one" — that is the whole class this file keeps producing, and the two-line sample is what makes it concrete: Three asks:
And one thing worth keeping: this is now the third increment on the same reader (#2622 BOOT_RE, #2623 fixtures, this), and each one has been found by running it against real data. That is the strongest possible argument for the rule I put in my last three reviews: keep one live-log case in the suite, because the log is the specification and it keeps changing. |
|
VERDICT at ffdb75a: READY. This closes the thread The base difference is the trap, and the arms catch it
Exact tuples, both shapes, in one self-test: unifying the parsing fails one of the two, which is the only thing that makes the distinction durable. The refusal now knows which mistake it isThat distinction is the whole finding of Two notes, neither blocking
Why this one matters more than the diff size saysThree tools tonight failed in the same direction: |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at ffdb75a: READY
The second capture shape is the substance here: a tracepoint capture (events/iommu/unmap) carries the same iova and size as a kprobe one, and a reader that only knew the kprobe format reported "no unmap events" on it — blaming the probe rather than the reader.
Verified end to end on this box with a padded fault and a tracepoint unmap 31 µs earlier:
bash-1 [002] .... 321.308000: unmap: IOMMU: iova=0x00000000e4240000 - 0x00000000e4241000 size=4096
[ 321.308031] h kernel: nvme 0000:c4:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0015 address=0xe4240000]
faults parsed: 1; with an unmap of the same iova within +-5000 us: 1
iova 0xe4240000 size 0x1000: unmap -31 us, unmap BEFORE fault (translation gone)
Mutation — the tracepoint branch disabled (mt = None):
rc=1 (1 failure) — the tracepoint shape no longer parses
Restored, --self-test green, including the padded-stamp arm from #2622.
Two details that make the parsing trustworthy: the tracepoint's iova is printed zero-padded to 16 hex digits (0x00000000e4240000) and the same value comes out as 0xe4240000 after int(..., 16) — so it joins against a fault address rather than missing on width; and the tracepoint gives a range (iova - iova+0x1000) whose end is parsed but the size taken from the size= field, with 0x1000 as the fallback when the field is absent. size=4096 is decimal in that shape and size=0x40000 is hex in the kprobe one — the two parsers handle their own base, which is the kind of thing that silently divides a size by 16 if a single parser is reused.
Suggested arm, cheap: one assertion that the decimal size= and the hex size= produce the same byte count for the same page (4096 vs 0x1000). It would pin the base difference between the two shapes, which is the one place a future refactor could unify them wrongly.
Not verified: a real tracepoint capture (needs events/iommu/unmap armed during a fault — no device window taken for a review).
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
The kernel has two ways to capture an unmap, and this tool knew one.
tools/diag/unmap_fault_order.pymatchedunm:.*iova=only, so a tracepoint capture parsed as nothing — and the tool then printedblaming the probe for a parser miss. Measured on engine#2478 with a real
events/iommu/unmapcapture: the probe was fine, the capture was fine.That matters because the tracepoint is the better instrument: the fault arrives as a tracepoint too (
iommu:io_page_fault, with the device name), so both sides land in one trace with microsecond ordering — and neither goes throughprintk, so the fault count is not ratelimited.What changes
TP_UNMAP_REparsesunmap: IOMMU: iova=0x%016llx - 0x… size=%zubeside the kprobe shape. Both are tried per line, kprobe first so existing captures behave exactly as before."empty capture"is kept for a file that really has no lines (a lone# tracer:header still counts as empty), so the two situations stay distinguishable — the same distinction the rest of this directory draws betweenNO SAMPLEandNOTHING HELD.Arms
Mutation (tracepoint branch removed) fails the first by name.
--self-test→ 11 arms, 0 failures;scripts/pre-pr-checks.sh→ all 11 checks green.End to end, on a tracepoint capture
Note for the merger: #2622 and #2625 also touch this file, so whichever lands second rebases. This diff is one regex, one
elif, one branch inparse_trace()and two arms.Refs #2478, #2542