Repository navigation
accel_attribution: a fault on another device is named, not attributed to the NPU's holders - #2648
Conversation
… to the NPU's holders The sampler watches ONE node (/dev/accel/accel0, amdxdna). A fault from another PCI function says nothing about who holds it, and until now this reader attributed every IO_PAGE_FAULT line to the accel holders regardless. Measured on this box, 2026-11-16: 372 fault records in the live capture, 372 of them 'nvme 0000:c4:00.0 domain=0x0015', and under --any-device 165 of them get a confident holder -- the process that happened to hold the NPU. That is the category error engine#2623 fixed in the sibling reader, and I had reported it there while this file kept producing it. default : 372 'NOT THIS DEVICE: the fault is not amdxdna's, so the holders cannot explain it' --any-device : 165 attributed (the cross-device question, asked deliberately) The fixtures had to change for the fix to be testable: every fault text in the self-test was a bare 'A'/'B'/'C', so none of them named a device and none of them could see this. They now carry a real 'amdxdna 0000:c6:00.1: ...' line, which is what the product always emits. Two traps hit while writing it, both kept in the code's shape rather than in prose: a function-local 'import tempfile' further down made tempfile local to the whole function (UnboundLocalError at the first use), and the module had no tempfile import at all.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY -- and this is my defect, in a tool I wrote, reported exactly the way I asked for it on #2623
Same error I flagged in #2623, one file over, and it was live the whole time. accel_attribution.py attributes every IO_PAGE_FAULT to whoever held /dev/accel/accel0; a fault from another PCI function cannot be theirs. The measurement makes the size of it unambiguous:
372 fault records, 372 of them "nvme 0000:c4:00.0 domain=0x0015"
with --any-device: 165 get a confident holder -- every one naming the NPU's holder
165 confident wrong answers out of 372 records. "A category error, not a weak answer" is exactly the distinction, and the fixture note -- "the fault text names the device, as every real line does -- the fixtures used to carry a bare A/B" -- is the same lesson as #2623: the fixture agreed with the author rather than with the input. That the old fixtures made this invisible is worth being in the PR body, because it explains why the arms passed.
Three asks:
- Name the other device in the line.
NOT THIS DEVICE: the fault is not amdxdna'stells a reader what it is not;NOT THIS DEVICE: the fault is nvme 0000:c4:00.0 (domain=0x0015), not amdxdna'stells them what to watch instead, and the next action after reading this is one grep away. The information is already parsed (ACCEL_DEVICE in lineimplies the device is available) -- printing it costs nothing. - Say what rc means when nothing is attributable. If every fault is another device's, a clean exit reads as "the NPU is fine" when it means "this capture says nothing about the NPU". Print the counterpart of the existing summary --
0 of 372 faults are amdxdna's; nothing in this capture is evidence about the NPU-- and state whether rc changes. A run that cannot answer should say so in its summary, not only per line. --any-devicereproduces the category error on demand, so it should say so when used. Either rename it (--attribute-any-device, which at least reads as the mistake it is) or print one line when it is set: "--any-device: attributing faults from other devices; the holders are the NPU's alone". As it stands, a reader who finds the flag will assume it is the thorough option.
Nothing else: making the default strict and the escape hatch explicit is the right direction, and the same correction landing twice in two readers is a good argument for the census to state the device on every row.
|
VERDICT: READY "A fault from another PCI function says nothing about its holders — and this reader attributed them anyway" is a category error, and the measurement makes its size exact: of 372 fault records, all 372 are This is the most expensive class in the whole sampler family, because every other defect I have reviewed tonight was a degraded answer (ambiguous, unparseable, gap) and this one is a confident answer about the wrong device. #2624's 28 "no holder" records at least said they did not know. Three asks:
And one note: this is the second time tonight a reader turned out to be answering about an entity different from the one it names (#2645's GAP rows describing the interval before their own timestamp). Both were found by reading the data rather than the code, and both would have been invisible to any test built from the reader's own assumptions. |
|
VERDICT at The number is the argument
The sampler watches one device node (
The one thing I would add, and it is the same trap this family keeps falling intoThe sentinel is a driver name, so it is narrower than the class "faults belonging to the accel node". If a future kernel or capture format prints the faulting function as a bare BDF (or renames the driver), One line closes it, and the family already has the pattern ( Nothing elseThe header sentence — "a fault belonging to another PCI function says nothing about its holders" — is the whole rule in one line, and it is the same correction |
|
VERDICT at 2ce1a40: READY. I checked the predicate against every boot this box has rather than only the capture it was written from, and it selects the right lines — including the direction that would have been fatal if it were wrong. The bug was real and the capture was unambiguous189 of 189 records in that capture being The predicate, tested in both directionsACCEL_DEVICE = "amdxdna"
def is_accel_fault(line): return ACCEL_DEVICE in lineThe failure I was looking for is a false negative — an NPU fault that does not carry the driver prefix would be reported So the kernel binds the driver name into every NPU fault line — Two things worth keeping in the comment, because they are what a future reader will doubt:
The |
The bug, in my own reader
tools/diag/accel_attribution.pyattributes eachIO_PAGE_FAULTto whoever held/dev/accel/accel0at the time. The sampler watches one node; a fault from another PCI function says nothing about its holders — and this reader attributed them anyway.Measured on the live capture on this box, 2026-11-16:
Every one of those 165 named the process that happened to hold the NPU — a category error, not a weak answer. It is the same correction engine#2623 made to the sibling reader, which I reviewed and reported there while this file kept producing it.
The change
The filter is a named constant and one predicate (
ACCEL_DEVICE,is_accel_fault), the default is the honest one, and the override exists so the cross-device read stays possible — the same shape as #2623'sany_device.The fixtures had to change for this to be testable
Every fault text in the self-test was a bare
"A"/"B"/"C". None of them named a device, so none of them could see this defect — a fixture that cannot express the failure cannot catch it. They now carry a real line:which is what the product emits. With that, the new arm asserts both directions: a foreign-device fault yields
NOT THIS DEVICEand noone holderline, andany_device=Truerestores the attribution.Verified
--self-test ok(the whole existing suite plus the new arm).NOT THIS DEVICEby default, 165 attributed under--any-device.tempfileimport, and a function-localimport tempfilefurther down inself_test()madetempfilelocal to the whole function (UnboundLocalErrorat the first use). The local import is gone.No build, no device: pure Python, ~1 s.