Expand description
BPF verifier log parsing, cycle detection, and output formatting.
Provides:
VerifierStats/ProgStats/DiffRow— data typescollect_verifier_output— boot VM, collect stats via host introspectionformat_verifier_output/format_verifier_diff— text formattingextract_verifier_log— extract verifier trace from libbpf log blobparse_verifier_stats— extract insn/state counts from verifier lognormalize_verifier_line— strip variable register state annotationsdetect_cycle/collapse_cycles— loop iteration compressionbuild_b_map/build_diff_rows— A/B comparison helpersSCHED_OUTPUT_START/SCHED_OUTPUT_END— delimiters the guest’s rust_init emits over the bulk port (asMSG_TYPE_SCHED_LOGframes) around the scheduler log region;parse_sched_outputextracts the enclosed block
Structs§
- DiffRow
- A single row in the A/B diff output.
- Prog
Stats - Per-program verifier statistics collected from a VM run.
- Verifier
Cell Ownership Entry - One selected scheduler declaration and the sole test executable allowed to list, launch, and record its verifier cells.
- Verifier
Cell Ownership Manifest - One parent-elected verifier-cell owner per selected scheduler identity.
- Verifier
Cell Record - One
cargo ktstr verifiercell’s outcome. The cell process writes it (viawrite_cell_record) into the directory named bycrate::KTSTR_VERIFIER_RESULT_DIR_ENV; after nextest returns the dispatcher reads them back (viaread_cell_records) and renders one PASS/FAIL/SKIP grid per scheduler (rows = topology, cols = kernel). A cell is one (scheduler, kernel, topology): the verifier sweeps each declared scheduler across topologies, so topology IS a result axis — a scheduler can pass on one topology and fail on another. - Verifier
Stats - Parsed verifier stats from the kernel log line:
processed N insns (limit M) max_states_per_insn X total_states Y peak_states Z mark_read W - Verifier
VmResult - Result of collecting verifier output from a VM run.
Enums§
- Attach
Outcome - Whether the scheduler positively confirmed it turned on during a verifier VM run.
- RunOutcome
- The terminal disposition of a
cargo ktstr verifierrun, decided byclassify_run_outcomeafter nextest returns and the report grids have been printed.
Constants§
- VERIFIER_
CELL_ OWNERSHIP_ MANIFEST_ VERSION - Current schema version for
VerifierCellOwnershipManifest.
Functions§
- build_
b_ map - Build the B-side lookup map from collected stats.
- build_
diff_ rows - Build diff rows from A stats and B lookup map.
- build_
nextest_ args - Build the
cargo nextest runargument vector for the verifier sweep. - classify_
run_ outcome - Decide the
cargo ktstr verifierrun outcome from nextest’s exit success, whether any per-cell records were produced, whether any of those records is a FAILED cell (already shown as a ✗ in the printed grid), and the optional--schedulerfilter. - collapse_
cycles - Collapse repeating cycles in a verifier log.
- collapse_
verifier_ region - Return
swith the libbpf verifier-log region (between the-- BEGIN/END PROG LOAD LOG --markers) replaced bycollapse_cyclesof that region — collapsed IN PLACE, with every byte OUTSIDE the region (the surrounding scheduler output, the BEGIN and END marker lines, any mid-line-END partial prefix) preserved exactly. Input WITHOUT the marker pair is returned unchanged. - collect_
verifier_ output - Boot a VM and collect verifier statistics via host-side memory
introspection. Per-program
verified_insnscomes frombpf_prog_aux->verified_insnsread through the guest’s physical memory. On load failure, libbpf prints the verifier log to stderr; the returnedscheduler_logfield contains the scheduler’s captured output from the VM. - detect_
cycle - Detect a single repeating cycle in a slice of lines.
- extract_
verifier_ log - Extract the verifier instruction trace from a scheduler log blob.
- format_
verifier_ diff - Format an A/B diff table comparing two sets of verifier stats.
- format_
verifier_ output - Format verifier results as text: brief lines per program and collapsed logs.
- format_
verifier_ stderr - Format the scheduler’s captured STDERR for emission to the test’s stderr, or the empty string when there is no stderr to show.
- normalize_
verifier_ line - Normalize a BPF verifier log line by stripping variable register-state annotations so that lines from different loop iterations compare equal.
- parse_
verifier_ stats - Parse verifier stats from the log output.
- read_
cell_ records - Read every
*.jsoncell record underdir(non-recursive). A missing dir or an unparseable record is skipped (best-effort). Returns records in filesystem-iteration order;render_result_tablesorts for a deterministic render. - render_
instruction_ count_ tables - Render one
verified_insnstable per declared scheduler. Within each scheduler’s section: rows = BPF program, columns = kernel version, and each cell is that program’sverified_insnsfor the (scheduler, kernel) summarized ACROSS the topologies that ran it — a single number when topology-invariant,lo..hiwhen it varies (-when that program reported no stats on that kernel). - render_
result_ table - Render the per-cell records into one PASS/FAIL/SKIP grid PER declared
scheduler (BTreeSet-sorted). Each scheduler’s section is a tally line
followed by a bordered grid whose rows are the topology presets that
ran the scheduler (BTreeSet) and whose columns are the kernels that
ran it (BTreeSet); the header row’s first column is
topology. Each grid cell is the (topology, kernel) result FOR THAT SCHEDULER, rendered nextest-style: