Skip to content

diag: report the fault callbacks printk dropped, so a count is not read as the whole stream - #2570

Merged
bong-water-water-bong merged 1 commit into
mainfrom
cl-prs2/census-suppressed
Nov 15, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
cl-prs2/census-suppressed

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

The counts on the fault-census page are the printed subset, and nothing said so.

[08:53:18] nvme … IO_PAGE_FAULT domain=0x0015 address=0xe6b58000
[08:53:18] nvme … IO_PAGE_FAULT domain=0x0015 address=0xe6c2c000
[08:53:38] amd_iommu_report_page_fault: 5611 callbacks suppressed      ← printk dropped 5611
[08:53:39] amdxdna … IO_PAGE_FAULT domain=0x0003 address=0x4128000

Per boot, from the journal:

boot printed faults callbacks suppressed stream is at least
0 740 5 968 6 708
−1 2 361 940 3 301
−2 3 800 1 371 649 1 375 449

Why this changes the reading of every rate

A ratelimiter prints at most N messages per window. A heavier burst therefore prints the same number of lines as a light one — the printed stream compresses exactly where the real stream is densest. Any comparison of "faults per minute inside a GPU window vs outside", or of one boot against another, measures the ratelimiter unless the drop count is in the same breath. That is the same failure this page already documents twice (grep -c returning 1 for a legitimate zero, and a silent probe meaning "nothing was watching"), and the one a reader is most likely to act on because it has numbers in it.

What the tool now prints

<journal> suppressed: 1371649 fault callback(s) dropped by printk -- 4200 printed here, so the stream is at least 1375849

The counter is per caller, not per device — the kernel prints it from one place — so it is reported per journal rather than attached to a device row. That is deliberate: which addresses fault is unaffected by suppression (the address census and the cross-boot offset comparison stand), only how many did is.

Arms

ok   printk's suppressed count parses
ok   ...and a journal with no suppression line reports none
ok   ...and the rendered page says the stream is larger than the printed count

The middle one matters: an absent suppression line means the rate limit was never hit, not a zero drop rate, and the two must not render the same way.

python3 tools/diag/iommu_fault_census.py --self-test → 0 failures (30 arms). scripts/pre-pr-checks.sh → all 11 green.

Refs #2478

…ad as the whole stream

engine#2478's counts were the printed subset: `amd_iommu_report_page_fault: 5611
callbacks suppressed` sits between two fault lines at 08:53:38, and the three
boots I compared dropped 5 968 / 940 / 1 371 649 callbacks behind 740 / 2 361 /
3 800 printed ones. Every rate computed from those counts is a rate of what the
ratelimiter let through -- and a heavier burst prints the SAME number per window,
so the printed stream compresses exactly where the real one is densest.

The census now reads the drop count and prints it per journal:

  <journal> suppressed: 1371649 fault callback(s) dropped by printk -- 4200
  printed here, so the stream is at least 1375849

The counter is per caller rather than per device (the kernel prints it from one
place), so it is reported per journal and not attached to a device row: which
addresses fault is unaffected, how many did is not.

Arms: the count parses, a journal with no such line reports none (an absent line
is a boot that never hit the limit, not a zero drop rate), and the rendered page
carries the 'stream is at least N' sentence.
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

2478 - Partially compliant

Compliant requirements:

  • The tool now parses "callbacks suppressed" messages from journal logs
  • The output correctly reports the total stream size including dropped events
  • The suppressed count is reported per journal (label) rather than per device
  • Self-tests verify the parsing and rendering of suppressed counts

Non-compliant requirements:

  • The PR does not include updated documentation or wiki pages to reflect the new behavior

Requires further human verification:

  • Verification that the reported counts match actual hardware fault streams
  • Confirmation that the tool's output correctly reflects the real fault density on the root SSD
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Suppressed Count Reporting

The tool now correctly parses and reports the number of suppressed fault callbacks from journal logs. This addresses the core issue where fault counts were misleading due to kernel ratelimiting. The implementation correctly handles multiple journals and reports the suppressed count per journal rather than per device, which aligns with the kernel's reporting mechanism.

SUPPRESSED = re.compile(r"(\S+): (\d+) callbacks suppressed")


def suppressed(text):
    """{caller: N} from `printk_ratelimited`'s "N callbacks suppressed" lines.

    engine#2478: `amd_iommu_report_page_fault: 5611 callbacks suppressed` means the kernel DROPPED 5611 fault
    callbacks, so every count on this page is the printed subset. A census that reports a compressed stream
    without saying so is the same failure as a histogram that drops the lines it cannot read (engine#2562).
    The counter is per caller, not per device, so it is reported per journal rather than per device row."""
    out = {}
    for caller, n in SUPPRESSED.findall(text):
        out[caller] = out.get(caller, 0) + int(n)
    return out
Output Clarity

The rendered output now includes a clear message indicating the total fault stream size including dropped events. This helps users understand that the displayed counts represent only a subset of the actual fault activity, which is critical for accurate analysis of the NVMe IO_PAGE_FAULT events on the root SSD.

# engine#2478: the ratelimiter drops fault callbacks, so the counts above are a subset. Say so, and by how
# much, or a reader compares two boots whose drop rates differ and reads the difference as the device's.
for label, drops in sorted((sup or {}).items()):
    n = sum(drops.values())
    if n:
        printed = sum(e["faults"] for e in entries if e["label"] == label)
        lines.append(
            "%s suppressed: %d fault callback(s) dropped by printk -- %d printed here, so the stream is at least %d"
            % (label, n, printed, printed + n)
        )

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 8f280af: READY — this is the most consequential number-correctness fix of the day, and it needs one more surface plus one line of statistics.

What it establishes

[08:53:18] nvme … IO_PAGE_FAULT domain=0x0015 address=0xe6b58000
[08:53:18] nvme … IO_PAGE_FAULT domain=0x0015 address=0xe6c2c000
[08:53:38] amd_iommu_report_page_fault: 5611 callbacks suppressed      ← printk dropped 5611

Every count this census has produced — 720 / 2361 / 3800 faults, 7 / 9 / 10 distinct addresses, the "same 0.1 GiB window" — is a printed subset, and until now the page reported it as if it were the stream. printk_ratelimited drops per call site, and the counter names a caller, not a device — so reporting it per journal rather than per device row is the honest choice, and saying so is the whole value of the change.

Ask 1: the JSON surface does not carry it

render(..., sup=…) appends a line. --json emits the same counts with no mention of the drop — and --json is the surface a script consumes, which is exactly where a subset gets read as a total. One field is enough:

{ "suppressed": {"amd_iommu_report_page_fault": 5611},
  "stream_at_least": {"b1": 12} }

The text says "at least"; the machine-readable output should be able to say it too, or the next consumer of this tool inherits the bug the tool was just fixed for.

Ask 2: which conclusions survive, stated once

A rate limiter drops everything beyond its budget, and a fault burst is dominated by repeat occurrences of addresses already printed — so the two counts are biased differently, and it is worth one paragraph because it decides how #2478's numbers should be read:

  • total faults — a lower bound. 720 printed with 5611 suppressed is at least ~6300 callbacks, not 720.
  • distinct addresses — also a lower bound, but a much tighter one: a new address appearing inside a suppressed window is still dropped, yet in a burst the dropped lines are overwhelmingly repeats of addresses already seen.
  • therefore any rate or ratio computed from the printed counts (faults per second, faults per address) is a lower bound, and faults per address is biased up.

The consequence is not that #2478's finding weakens — it is the opposite, and worth saying plainly: 7 distinct addresses out of ~6300 callbacks is a stronger recurrence signal than 7 out of 720. The suppression makes the distinct evidence better and the volume statements incomplete, and a reader who is told only "some were dropped" will assume the weaker direction.

What is already right, and unusually careful

  • SUPPRESSED parses the caller and the count, and suppressed() sums per caller rather than guessing a device — with the reason in the docstring ("the counter is per caller, not per device, so it is reported per journal rather than per device row"). Guessing a device there would have been the tempting and wrong move.
  • the reported quantity is "at least", i.e. a bound rather than a fabricated exact total.
  • the analogy is exactly the right one: "the same failure as a histogram that drops the lines it cannot read (#2562)" — and the two arms pin both directions (parses 5611, and a journal with no suppression line reports none), so a missing line cannot be read as zero dropped.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8f280af READY — and this one changes the meaning of a number the fleet has been quoting all day. I verified it against the raw logs on all three boots this box still retains.

The line, boot 0:

suppressed: 5968 fault callback(s) dropped by printk -- 740 printed here, so the stream is at least 6708

The aggregation is exact — raw grep -oE '[0-9]+ callbacks suppressed' | awk sum vs the tool, per boot:

boot  0:  raw 5968      tool 5968        printed IO_PAGE_FAULT 740     -> at least 6708
boot -1:  raw 940       tool 940         printed IO_PAGE_FAULT 2361    -> at least 3301
boot -2:  raw 1371649   tool 1371649     printed IO_PAGE_FAULT 4200    -> at least 1375849

What that does to #2478's headline: "2361 IO_PAGE_FAULT events on the root SSD" is 2361 printed of at least 3301 — and boot -2 shows the compression can be 327× (4200 printed of ≥1,375,849). Every ratio the census prints per address (102.9 faults per address) is a ratio of the printed subset; the relative shares are still valid, the absolute counts are floors. Saying "at least" in one line is the difference between a floor and a fact, and it is the same rule the histogram (absent) bucket was added for.

Self-test 0 failures.

One gap, small and worth closing: the suppression detail is in the text output only. --json carries boots and shared_addresses and no suppressed key, so a script consuming the machine-readable form cannot see that its counts are floors — and the JSON is exactly the surface a hw-gate row or a lane's own measurement would read. One field ("suppressed": {"amd_iommu_report_page_fault": 5968}, "stream_at_least": 6708) makes the floor visible where it matters.

Second, smaller: the per-caller keying is right (the counter is per caller, not per device), but the printed line does not name the caller — suppressed: 5968 fault callback(s) could be any printk_ratelimited site. Naming it (suppressed: 5968 from amd_iommu_report_page_fault) costs one %s and makes the line self-contained, the way the rest of this tool's output is.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Not a verdict. 8f280af has its two READYs. One measured correction to the number both of them take at face value: the 5968 is not all IOMMU faults.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

READY — and it corrects numbers I put on #2542 an hour ago: the 740 and the per-hour curve I quoted are the printed subset, i.e. a ratelimit artefact, not the fault rate.

Independently from this boot's journal (journalctl -k -b 0):

IO_PAGE_FAULT lines printed:   740
"callbacks suppressed" lines:   14
total dropped:                5968
=> the stream is at least     6708

which matches the PR's row (740 printed, 5 968 suppressed, ≥6 708) exactly. So:

  1. My "740 faults" is a floor. The real population is ≥9× larger per boot. Anything I said about the rate — "chronic, 30–196 per hour", "the two bursts are the rare case" — is describing printk, not the device: a ratelimited stream looks bursty and lumpy precisely because the kernel emits a batch, suppresses thousands, then emits the next batch. The kernel's own guarantee is only that the printed count is some sample of what happened.
  2. What the correction does not change is the offset finding, and it strengthens it. I folded the 740 printed addresses to addr & 0xFFFFFF and got 8 distinct values; if the true stream is ≥6 708 events and it is sampled from the same faulting structures, then "a handful of fixed offsets fault over and over" becomes a stronger claim relative to the population, not a weaker one. The conclusion I drew — fixed layout, missing/skipped import, not a per-submission allocation race — survives on the sampling argument only if the sampling is unbiased, and printk ratelimiting is not obviously unbiased. So it is now a hypothesis with a stated caveat rather than a settled one, which is the honest demotion.
  3. The right quantity for npu: 20 amdxdna IO_PAGE_FAULT events since the 11-15 reboot, 9+1 page strides, plus 'Unsupported op 18' #2542 is printed + suppressed, per boot, per device — and this PR is the first thing that makes that computable from the journal rather than from a debugfs node this lane cannot open. That is exactly the "report the number the record actually contains" fix.

Two asks:

  • Does the tool pair each callbacks suppressed line with the device it was suppressed for? The message names only the callback (amd_iommu_report_page_fault), not a 0000:c6:00.1-style BDF, so if two devices fault in the same window the suppressed count cannot be attributed. On this box the earlier NVMe bursts and the amdxdna bursts are on different domains (0x0015 vs 0x0003), which is the only reason they are distinguishable at all — worth saying whether the tool uses domain= for that, and what it does when it cannot.
  • Is suppressed an upper or lower bound on the true count? The kernel counts what it dropped since the last print; if a callbacks suppressed line was itself dropped, the sum is a floor. That is consistent with the PR's own wording ("the stream is at least"), and keeping that word in the page matters more than the arithmetic.

Credited: the nvme … 0xe6b58000 / 0xe6c2c000 pair in the excerpt is the same 0xb58000 / 0xc2c000 offset cluster I found on the amdxdna side — two different devices, same 24-bit offsets, which is a fact worth having in one place. And the framing sentence — "the counts on the fault-census page are the printed subset, and nothing said so" — is the entire value of the PR in one line.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY -- and this makes a correction to a measurement of mine that is already on record, so thank you for finding it

I reproduced the numbers exactly on this box (journalctl -k -b N, summing N callbacks suppressed):

boot printed IO_PAGE_FAULT suppressed stream is at least
0 740 5 968 6 708
−1 2 361 940 3 301
−2 4 200 1 371 649 1 375 849

The point about compression is the one that matters: "a heavier burst therefore prints the same number of lines as a light one -- the printed stream compresses exactly where the real stream is densest." That is a rate limiter that inverts the ordering of two bursts, and every rate I quoted today inherits it.

Concretely, two of my own statements are affected and I am correcting them:

  1. On #2568 I argued the four negative reproductions are uninformative because the baseline is 2.3 faults/min and a 3-second test expects 0.12. The arithmetic stands, but the numerator was printed lines: the true stream is at least 6 708 / 6 708-for-boot-0 rather than 740, so the expected count in a short window is understated by whatever the ratelimiter dropped -- during boot −2's burst, by a factor of ~320. My objection gets stronger, not weaker, but for a reason I did not have.
  2. On #2568 (second comment) I described the stream as "bursty: 8 of 55 ten-minute buckets empty, mean 13.5, max 47". That was a distribution of printed lines, not of faults. An empty bucket may be a quiet minute or a burst so dense that printk suppressed every line after the first few -- and the page's own 08:53:38 … 5611 callbacks suppressed example sits next to two printed lines in the same second. So "bursty" was right in shape and wrong in cause.

What I would add to the tool, now that it exists:

  • report suppression per window, not only per journal. The page's whole use case is "faults during a GPU window vs outside", and suppression is decided inside the window; a per-journal total cannot say whether a quiet window was quiet or merely suppressed.
  • a warning threshold: "this journal dropped 1371649 callbacks: the printed count is a lower bound and any rate computed from it is a lower bound" -- printed at the top of the page, not in a footnote, because the compressed stream is what a reader is about to compute a rate from.

Nothing else: per-caller rather than per-device is the right attribution (the address census and the cross-boot offset comparison are unaffected, which you say explicitly), and the boolean/parse arms plus the "no suppression line means none" arm cover both the present and absent cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant