Expand description
A per-thread count of the interrupts the probe thread takes, from the core PMU (https://github.com/rrnewton/hermit/issues/4243), condition C11).
The XINUSE probe’s reference trial is valid only if nothing saved and
reloaded the thread’s FPU state inside it. Without a context switch, Linux
does that only through kernel_fpu_begin in interrupt or softirq context, or
in the task’s own syscall, so a trial that took no interrupt, no context
switch and no syscall cannot contain a reload. This counter supplies the
interrupt half of that certificate, and every property it rests on is
checked rather than assumed:
- the raw event is used only on CPU models whose perf tables document it;
- it is opened pinned, so it is never time-shared, and every read checks that its time enabled equals its time running (both are cumulative, so equality at a read proves it counted for its whole enabled history);
- a failed read is an error, never a value that could compare equal;
- at startup its count over a spin must bind to the kernel’s own count of
this CPU’s interrupts in
/proc/interrupts.
Structs§
- CpuInterrupts
- One CPU’s local-timer count and its column total in
/proc/interrupts. - CpuModel
- The CPU’s vendor and display family/model, from CPUID leaves 0 and 1.
- IrqCounter
- An open, pinned interrupts-taken counter for the calling thread.
Enums§
- Counter
Refusal - Why the counter cannot certify trials on this host.
Constants§
- CALIBRATION_
SLACK - A fixed allowance on top of the proportional one in
calibration_verdict. - MIN_
CALIBRATION_ TICKS - The fewest local-timer interrupts a calibration must see, summed over its
clean spins.
CALIBRATION_SLACKis absolute, so this floor is what keeps the binding tight: at 190 interrupts the counter must see at least 180 of them, about 95%, when the reads around the spins take no time. (A single 70 ms spin sees about 70, where the slack alone would admit about 86%.) A tickless (nohz_full) CPU sees almost none, and there the binding says nothing.
Functions§
- calibration_
verdict - Whether a calibration binds the counter to the kernel’s count: over its clean spins, summed, the counter must see at least this CPU’s local-timer interrupts and no more than all of its interrupts.
- interrupts_
of cpu’s interrupt counts from asnapshot_proc_interruptstext.- interrupts_
taken_ event - The raw PMU configuration of the interrupts-taken event on
cpu, orNonewhere perf’s event tables do not document one. - parse_
proc_ interrupts - Parses
/proc/interruptstext forcpu’s column. Rows whose entry in that column is not a number (the trailing descriptions ofERRandMIS) are skipped; theLOCrow must be present. - snapshot_
proc_ interrupts - Reads
/proc/interruptswhole. It is about 1.4 MB on a 316-CPU machine; the caller parses it after taking its other samples, so parsing time does not widen the interval the counter must cover.