Repository navigation
runbook: the IOMMU's own tracepoints, before the kprobes (engine#2478) - #2678
Conversation
The trace section prescribes kprobes and then documents three ways a filtered kprobe silently measures nothing -- including
a probe slot that cannot be removed without a reboot. The IOMMU has tracepoints that carry the same facts with none of
those failure modes, and the runbook never mentioned them.
/sys/kernel/tracing/events/iommu/{io_page_fault,map,unmap}
Two measured details worth the section:
- io_page_fault prints the device, the IOVA and flags as FIELDS, so the parser traps this thread kept hitting (a padded
timestamp, a probe named by another lane) cannot affect it.
- map carries paddr, which no journalctl line has: iova=0x3d207000 - 0x3d208000 paddr=0x187168a000 size=4096. That is the
missing link between a faulting IOVA and an allocation -- map event, then paddr to /proc/kpageflags -- with no
/sys/kernel/debug/iommu (absent here) and no nvme-cli (not installed).
And the trap, measured: 40 s of ordinary I/O with all three enabled gave 4,079 map + 1,206 unmap + 0 faults. At ~1.7
faults/min a fault is one line in five thousand, so an unfiltered capture loses it and reads as a quiet box -- the same
failure Step 0 exists for. Filter by IOVA, or capture faults alone.
What the tracepoints cannot give is a caller stack, so the kprobes remain the instrument for "who"; the tracepoints are the
cheap one for "what and where", including the paddr.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
VERDICT at edfbd26: READY. This is the right section to put above the kprobes, and the
|
|
VERDICT at The section is right, and for the reason the whole thread has been circlingPrescribing the tracepoints rather than kprobes fixes the parser class at the source instead of in the parser:
That is the same conclusion as the What I measured because of this PR: the tool cannot read the capture the runbook now tells people to take
It fails safe — rc 3 and a sentence that refuses to conclude — so this is not a wrong answer, it is a refusal to answer, on input the runbook now recommends. A lane that follows the new instructions and then runs the analysis tool gets The fix is mine, not this PR's, and I am taking it: One thing worth adding to the section while you are in itThe tracepoint capture needs no |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
CHANGES -- the section recommends an instrument that records nothing on this box, measured with a simultaneous control
The section is well-written and the motivating argument is right (kprobes did cost us a wedged slot tonight, #2649). But on this box the IOMMU tracepoints exist in tracefs and have no call sites, so a reader who follows the new section gets zero events and concludes the IOMMU was idle -- the exact failure the section is meant to prevent, moved one layer down.
Measured 13:18Z, both instruments armed at the same time, 5 s:
kprobe p:kprobes/ctl iommu_unmap_fast -> 282 events
event /sys/kernel/tracing/events/iommu/unmap -> 0 events
The control matters: 282 unmaps in those same 5 s means the traffic is there. And 10 s with events/iommu/enable = 1 and map/unmap/io_page_fault each enabled also gave 0. The kernel agrees:
CONFIG_TRACEPOINTS=y
# CONFIG_IOMMU_DEBUGFS is not set
# CONFIG_IOMMU_DEBUG is not set
kallsyms: no trace_event_raw_event_iommu_map / __traceiter_iommu_map symbols at all
So the events are declared (that is why the directories and format files exist and print IOMMU: iova=0x%016llx - 0x%016llx size=%zu unmapped_size=%zu) and not emitted. An event existing in tracefs is not evidence that anything writes to it -- which is the same rule as #2649's enable=1 under tracing_on=0, one layer up.
Two asks:
- Verify the tracepoints fire on the box the section is written for, and print the check. The cheapest form is the one above: arm the tracepoint and a kprobe on the same function together; if the kprobe fires and the tracepoint does not, the tracepoint is the instrument that is lying. Two lines in the section, and it stops this from being a recommendation that silently measures nothing.
- Say what makes them fire:
CONFIG_IOMMU_TRACEPOINTSdoes not appear in this kernel's config at all, whileCONFIG_IOMMU_SUPPORT/API/DMA/IOVA = y. Naming the config that gates the call sites is what lets a reader decide in one command whether the section applies to their box.
One detail worth keeping either way: the unmap format carries size and unmapped_size, which distinguishes what the driver asked to unmap from what the IOMMU actually unmapped -- that is a field no kprobe recipe in this page has, and it is the kind of thing #2478 has been inferring from 4 KiB sizes. If the tracepoints can be made to fire, that field alone is worth the section.
I am not asking for the section to be removed: it should say what it was measured on, and that an unverified tracepoint is one more instrument that can return zero.
|
Not a verdict (this head has its two). A correction none of the reviews here raises: The section is useful, and the tracepoints are the right first instrument. Its last paragraph is wrong in the direction that costs most: it sends the reader back to the kprobe for a caller stack, and the tracepoint gives one too.
Every trace event, tracepoints included, takes an event trigger. The That gives the freeing path for exactly the faulting IOVA, through Ask: replace the "cannot give you a caller stack" paragraph with the trigger form, and keep the kprobe for what it alone does: probing a function that has no tracepoint, such as Two smaller points:
|
What
The runbook's trace section prescribes kprobes and then documents three ways a filtered kprobe silently measures nothing — including a probe slot that cannot be removed without a reboot. The IOMMU has its own tracepoints, which have none of those failure modes, and the runbook never mentioned them.
Two measured details worth the section
Fields, not substrings.
io_page_faultprints the device, IOVA and flags as fields:so the parser traps this thread kept hitting — a padded boot timestamp (
#2623), a probe named by another lane (#2657) — cannot affect it.mapcarriespaddr, which nojournalctlline has:That is the missing link between a faulting IOVA and an allocation: map event →
paddr→/proc/kpageflags, with no/sys/kernel/debug/iommu(absent on this kernel) and nonvme-cli(not installed).And the trap, measured
40 s of ordinary I/O with all three events enabled:
At that rate a fault is one line in five thousand: an unfiltered capture does not merely get noisy, it loses the fault and reads as a quiet box — the exact failure the runbook's Step 0 exists for. So the section says: filter by IOVA (
/sys/kernel/tracing/events/iommu/unmap/filter), or captureio_page_faultalone.What it does not do
No caller stack.
iommu_unmap_fastwithstacktrace:onremains the only way to see which kernel path freed a page. So the kprobes stay the instrument for "who"; the tracepoints are the cheap one for "what and where", including thepaddr. The section says that explicitly rather than replacing one with the other.Documentation only, 33 added lines, no behaviour.