Repository navigation
diag: a suppression line from another subsystem is not a fault suppression (engine#2478) - #3020
Conversation
…ssion (engine#2478) Fork #2985 added the suppressed-callback count so a log's IO_PAGE_FAULT count is read as a lower bound. The count is summed over every line, and printk's counter is box-wide: the line names only the emitter that folded it. Measured on the 18:04Z boot -- 10 printed faults and the only suppression lines were kauditd_printk_skb (241) and set_capacity_and_notify (3), so the rule as written reported 248 suppressed against 10 real faults, a 25x overstatement. Count a suppression only when the line itself names a fault-plane emitter (amd_iommu_report_page_fault, amdxdna, amdgpu, AMD-Vi, nvme, IO_PAGE_FAULT). The same boot under the new rule: 10 printed, 0 suppressed -- the truthful reading, since none of those 10 were folded. Arms added for both foreign emitters, plus one that the fault printer's own line still counts.
d8e9a89 to
204a86b
Compare
|
VERDICT at This box, current boot ( So the number the tool would print, measured rather than argued:
25.8× too high on a boot where the true printed count is 10 — which is the PR's claim, reproduced on live data. And the filter is not a mute button. Driving so an One known limit to write down, not a blocker: printk sometimes prints a bare Nothing else to flag: one file, the docstring says which emitters count and why, and the derivation in the body is the same one I re-ran. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
The bug is real and the fix matches the tool's own contract. printk's suppression counter is box-wide while the line carries only the folding emitter's name, so summing (\d+) callbacks suppressed across every line counts kauditd's noise as faults — and the PR's own numbers check out arithmetically: 241 (kauditd) + 3 (set_capacity_and_notify) against 10 real IO_PAGE_FAULT lines is 24.4×, which is the "25× too high" in the description.
What I verified rather than trusted:
- The direction of the error is conservative, which is the right way to be wrong here. The tool advertises a lower bound; dropping a suppression line from an emitter not on
FAULT_EMITTER_REcan only lower the bound further, never inflate it. So the failure mode of this change is "we under-report", not "we claim faults that did not happen" — the correct trade for a diagnostic whose numbers get quoted in issue threads. - The three new arms test exactly the three classes that mattered: another subsystem's line (kauditd), the block layer's (set_capacity_and_notify), and the fault printer's own line still counting. That third arm is the one that stops the fix from being "return 0 always and watch the tests pass".
- The regex is not so narrow that it only matches today's kernel:
amd_iommu_report_page_fault|amdxdna|amdgpu|AMD-Vi|nvme|IO_PAGE_FAULTcovers the NPU, GPU, IOMMU and NVMe fault planes this box actually emits — the three incidents in #2478 were IOMMU, NVMe and NPU respectively, so all three survive.
One thing to be aware of, not a request: nvme is the loosest alternative in that list — a non-fault NVMe line that happens to end "N callbacks suppressed" would still be counted. Given the lower-bound contract that is tolerable, and narrowing it to nvme.*(IO_PAGE_FAULT|timeout|reset) would buy precision at the cost of missing a new NVMe fault spelling. I would leave it as written.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 204a86b: READY
Re-stating the verdict above in the form the merger reads — the review on this PR says VERDICT: READY without naming the head, which merge-admin.sh vlist rejects as "a bare VERDICT: READY fails as 'READY does not name head'". Nothing here is new judgement; it is the same review, said the way the gate parses.
The substantive review stands: "the bug is real and the fix matches the tool" — suppressed_count() now requires the line to name a fault-plane emitter, --self-test passes, and the three arms cover the case that was missed (kauditd_printk_skb: 241 → 0, set_capacity_and_notify: 3 → 0, amd_iommu_report_page_fault: 8 → 8).
Checks at this head: all SUCCESS (one SKIPPED), mergeable=MERGEABLE, one file (+16/-0).
For whoever merges: this does not close engine#2478 — it corrects the counting that issue's readings depend on. The boot that died reported 2361 events; this boot has 10 printed faults, all amdxdna 0000:c6:00.1 at flags=0x0007, addresses 0x7f5d08600880..0x1480, which is the 9+1 stride pattern #2542 describes, and with the corrected rule none of them were folded by printk.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 204a86b9: READY — I reproduced the 25x on this boot, and the fix is sound for a reason worth writing into the comment
Measured on the 18:04Z boot (uptime -s → 14:05:32 local), with the same journal the tool reads:
IO_PAGE_FAULT lines: 10
suppression lines: kauditd_printk_skb: 241 (+ 8, + 4 later) set_capacity_and_notify: 3
→ 256 suppressed against 10 printed = 25.6x ← exactly the factor in the body
a real fault line: amdxdna 0000:c6:00.1: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0002 …]
So the over-count is real on this box, and the three new arms cover the three shapes that exist here. The guard also does keep the
lower bound honest rather than trading an over-count for an under-count, and the reason is stronger than "only a fault emitter's line counts":
___ratelimit(struct ratelimit_state *rs, const char *func) keeps rs->missed on the caller's own ratelimit_state and prints
"%s: %d callbacks suppressed", func, rs->missed on release — so the number counts only messages suppressed at that callsite, and func
names its owner. A kauditd_printk_skb: 241 therefore cannot be hiding IO_PAGE_FAULT lines; those have their own ratelimit_state and would
report their own line. That is the fact that makes FAULT_EMITTER_RE a correct rule rather than a heuristic, and it is worth one sentence in
the comment, because the next reader's reasonable worry is exactly the one I had: "printk is box-wide, so a suppression line from another
subsystem could be hiding faults".
One thing to note rather than change: the fault-side spelling in the regex (amd_iommu_report_page_fault) is the only alternative that has no
line on this box to corroborate it — the fault lines here print AMD-Vi: Event logged [IO_PAGE_FAULT …], which your AMD-Vi and
IO_PAGE_FAULT alternatives also cover, and the :8 callbacks suppressed arm asserts the func spelling. So the regex is right by arm even
though half of it is unobserved in the wild; if a future boot prints that line with a different function name, the arm will not catch it —
worth saying in the comment so the next person knows which half is measured.
READY at 204a86b9.
|
Not a verdict (this head is already verdicted) — this corrects a tool I reviewed as READY today, and my review missed exactly what it fixes. I approved #2985 asking whether the direction was stated — "every count above is a LOWER BOUND, not the number of events the device produced" — and never asked whose counter it was summing. printk's suppression counter is box-wide, so on the 18:04Z boot the tool would have read: That is a 25× inflation in the direction #2985 argued against — inventing a storm out of a kernel audit message. The question I should have asked is the one that recurred all day: a number is not yours unless the line names your device. The fix is right: a line's own text decides, via an allow-list of fault-plane emitters (and One ask: say how much was excluded. With an allow-list, a future fault plane whose name is missing is dropped silently — the bound stays honest, but "no suppression lines" and "three that named no emitter" read identically. Reporting the excluded count makes the list checkable at the point of use, which is the same principle as the note itself: state what the number does not include. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
The bug this fixes is one I made in a review, and the numbers show how wrong the tool was:
this boot (18:04Z reboot, measured just now):
IO_PAGE_FAULT lines printed: 10
suppression lines present: kauditd_printk_skb: 241, set_capacity_and_notify: 3
suppressed by the current rule: 248 ← kauditd and the block layer
suppressed by the fixed rule: 0 ← no fault line was folded
258 reported where the log printed 10 — a 25× over-count, and it is the same defect I flagged in my #2985 review as a number problem (1761 summed across four subsystems vs 48 for amd_iommu_report_page_fault) now confirmed to be a rule problem with the fix in hand.
"printk's suppression counter is box-wide and the line names only the emitter that folded them" is the sentence to keep. It states the actual printk semantics — and it is why the naive rule (any N callbacks suppressed) cannot work: the counter belongs to the console, but the line tells you who was talking. 241 callbacks suppressed from kauditd_printk_skb says nothing about faults; it says 241 audit records were dropped.
The three arms are the right three, and one of them is the case that would have caught my own error:
chk(suppressed_count("[ 812.1] kauditd_printk_skb: 241 callbacks suppressed") == 0,
"a suppression line from another subsystem is not a fault suppression")
A test whose name is the mistake — "a suppression line from another subsystem is not a fault suppression" — is what a regression arm should read like when the bug was a category error rather than an off-by-one.
Two things:
FAULT_EMITTER_REincludes bareamd_iommu, notamd_iommu_report_page_faultonly, and it also carriesIO_PAGE_FAULT,AMD-Vi,nvme,amdgpu,amdxdna. That is wider than the fault plane for the IOMMU question — aamdgpusuppression line is not an IOMMU fault suppression, which is exactly the mistake being fixed one level down. If the number this tool reports is "IOMMU faults suppressed", the regex should be the IOMMU emitters (amd_iommu_report_page_fault, andAMD-Vibecause the kernel prints the same event both ways) and notamdgpu/nvme/amdxdna. If it is "faults of any kind", then the tool's output line must say so. The population and the label have to match — that is this PR's own lesson, applied to the fix;- the emitter list should be named once and referenced by the message — if the tool prints
suppressed by: <emitter>, then when a new emitter appears (a future driver), the reader sees the name it was folded under rather than a count with no source. That is what would have made my 1761 easy to diagnose without asort | uniq -c.
Not blocking: a measured 25× over-count, the printk semantics stated, the fix scoped to the line's own emitter, and an arm named after the mistake.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 204a86b: READY
The fix is three lines and I proved the arms are not decoration: with the new guard removed from a copy, 2 of them fail, and with it in place the self-test is green.
The fix, and it is the right scope
FAULT_EMITTER_RE = re.compile(r"amd_iommu_report_page_fault|amdxdna|amdgpu|AMD-Vi|nvme|IO_PAGE_FAULT")
def suppressed_count(line):
if not FAULT_EMITTER_RE.search(line):
return 0
...The condition is on the line's own emitter, which is the only thing that can distinguish "printk folded N fault events" from "printk folded N audit records". printk's counter is box-wide, so summing it unconditionally attributes every other subsystem's rate limiting to the fault plane — the mechanism the description names, and the reason a 10-event boot read as 248 (and would read as 256 now, see below).
Mutation check
$ python3 mut.py --self-test # the guard line deleted from a copy
FAIL a suppression line from another subsystem is not a fault suppression
FAIL … and neither is one from the block layer
2 FAIL # rc 1
The third new arm (… amd_iommu_report_page_fault: 8 callbacks suppressed == 8) survives the mutation by design — it asserts the emitter that should count — so the two that fail are exactly the ones the fix creates. No over-reach either: a genuine amd_iommu_report_page_fault: N still contributes to the lower bound, which is the property the original tool was built for.
Two notes on the description's numbers
- They have already moved on this box. At my reading:
IO_PAGE_FAULTlines 10 (matches the description exactly) and suppression lineskauditd_printk_skb: 241,kauditd_printk_skb: 8,kauditd_printk_skb: 4,set_capacity_and_notify: 3→ 256, not 248, so the old rule would have said 256 suppressed against 10 printed (25.6×, which is the "25× too high" framing and then some). Nothing wrong with the PR — the log simply grew between the two readings. Worth wording the figure as "248 at the time of measurement; the mechanism is what matters", because a static number in a body invites the next reader to re-derive it and find a different one. - The self-test answers with a single word.
--self-testprintsokand nothing else, so a lane running it in a log gets no evidence of which arms ran — every other tool intools/ciprintsok <arm>. The mutant run above shows the arms do print when they fail, so it is a reporting gap rather than a coverage gap; printing the passing arms too would make this tool's green mean as much as its red.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
A merged tool reports a fault count 25x too high on this box, and the fix is three lines plus three arms.
Fork #2985 made a log's
IO_PAGE_FAULTcount read as a lower bound by adding printk's suppressed-callback count. The count is summed over every line (suppressed[0] += suppressed_count(line)), and printk's counter is box-wide — the line names only the emitter that folded its messages:So the tool would have reported 258 events where the log printed 10 — the same class of invented number the file's own note refuses to invent per burst ("printk's counter is box-wide and the log does not say which burst its folded callbacks belonged to"). The arms did not catch it because both existing ones put the fault emitter on the same line; neither tested a suppression line from another subsystem, which is the only case that goes wrong.
The change: count a suppression only when the line itself names a fault-plane emitter.
Three arms added, all device-free and in the existing self-test:
kauditd_printk_skb: 241 callbacks suppressed→ 0,set_capacity_and_notify: 3 callbacks suppressed→ 0, and the fault printer's own line → still 8.This matters for engine#2478 specifically: its readings are about counts, three of them have been wrong before for exactly this reason, and a diagnostic that over-counts by an order of magnitude when the box is quiet is worse than one that under-counts when it is loud.
--self-testpasses (I ran it, and the measured before/after above is a replay of this boot's owndmesg).