notes

Load-sensitive assertions

(Milestone 78 (the load-sensitive assertions) and milestone 62 (tests that assert on time). This page is the register: how to recognize one, how to fix one, and every known site with its status. Each fix's history, runs and injections are in the appendices listed at the end.)

A load-sensitive assertion is a test that goes red because the host was busy, not because the kernel was wrong. The guest runs under QEMU on a shared machine. When other emulators, lanes or CI jobs compete for the cores, the guest's vCPUs are descheduled for milliseconds at a time. A test that measured the wrong thing then fails a pull request that could not have reached it.

The family was named on 2026-08-03, when five assertions had failed pull requests that changed no executable code. A flaky red trains people to re-run rather than read. On 2026-08-17 a loaded run produced nine reds: eight from two known timer assertions, and one real double free, wearing the same color (the first loaded acceptance run).

How to recognize one

Ask these in order; each came from a site the earlier ones missed.

1. Which direction did it fail?

A slow machine produces a deficit, never a surplus. Host contention makes work happen late or not yet, so it can only make a count lower than the test expected.

A margin cannot fix a negative failure: widening the bound only hides the defect. That is §61 (a lint is adopted on evidence), applied to assertions.

2. Is a yield count standing in for a duration?

A yield count is not a duration. Since §28 (SMP placement) scatters threads across cores, a yield on a core with an empty run queue returns in microseconds. Fifty of them can elapse before the awaited thread has been scheduled at all. The error runs both ways: a loaded host burns yields while another vCPU is descheduled, and a native host under Hypervisor.framework burns them in nanoseconds (notes/hvf-leg.md). The same holds in a user program. A retry loop over a refusal that a timer tick has to clear cannot buy the tick with system calls (the caretaker teardown wait).

3. Does the window include instructions outside the property?

Some failures are positive and still wrong. The test measures across instructions that are not part of the claim. Examples: a tick counted between the read and the lock, a probe's execution that placement never promised, a spinner sampled before it had a turn. Contention does not cause these races; it stretches the window, so a race that never lost on a quiet machine loses on a shared runner (the second round).

A per-core counter read on both sides of a wait must name its core, or a migration silently changes the subject. That is why ticks_on(core) and missed_ticks_on(core) exist on both ISAs.

4. What else lands in the band that makes it fire?

An assertion is worth keeping only if its firing band contains the defect and nothing else. Where a defect and the host produce the same band, no threshold inside it separates them. The choice is then between a flake and a false pass. From inside the guest, a 30 ms handler and a 30 ms deschedule are the same observation. That sentence is why the_handler_keeps_up_when_no_lock_is_held was deleted rather than re-cut (the timer disposition).

5. Is a count standing in for a mechanism?

The first four find assertions that fail when they should not. This one finds assertions that pass when they should not. A frame count is a weak detector of a page-table leak: eight thread stacks are 224 KiB against a 2 MiB table span. The reaper test missed the stack-reuse leak of milestone 6 (threads, the context switch, and preemption) entirely, and an injection proved it (stack reuse and proxy detectors).

What the harness tells you

A guest cannot know eleven other emulators shared its eight cores. So xtask samples the host's load average during each emulated leg and prints it when a leg goes red, with the core count and the oversubscription factor (the host-load line). Read it before theorizing; it covers the host-side checks (inbound, scanout) too.

The rule for fixing one

  1. Wait on the property, not on a proxy for it. Bound the wait with smp.rs's wait_for (a clock) or with testing::TickBudget (delivered ticks). Assert that the wait succeeded.
  2. Ask about the object, not the machine. A thread is asked about by its generational ThreadId (is_thread_present). A region is asked about by memory_region::usage, or by its own frames through testing::RegionRun. A single frame is asked about through memory::is_page_frame_used. A held tick is asked about through timer::is_tick_pending (preemption window).
  3. Denominate a budget in what the guest actually received. A descheduled emulator delivers fewer ticks per second, so a tick budget stretches under exactly the load that broke a counter deadline. A user program has no tick reading yet, so it uses a clock with a measured margin.
  4. Never widen a bound to make it pass. If the claim cannot be attributed from inside the guest, move it to an instrument where the host is not a term (script/icount), or delete it.
  5. Print the observation the predicate decided on. A panic that re-samples a global count can print an impossible quantity, and that is the message someone reads at 2 a.m.
  6. Prove the fix by injection, and prove the giving-up path too. Aim the injection inside the test's own window: a whole-machine defect kills the suite before the target test runs. An injection that fires shows only that the assertion can fail, not that it fails for the right reason.
  7. Then run it under load. Two clean matrices proved nothing about the sites that failed on a loaded third.

The instruments

The register

Status is open (known and not fixed), narrowed (the exposure is smaller and a named residual remains) or fixed. A fixed site can still carry a residual in BUGS below.

assertion file status what was done, or what is left appendix
five userspace retry loops over the refusal of §16 (object revocation) system_initializer, login.rs, swish.rs, job_undertaker.rs, timetable.rs open a yield count waiting on a timer tick; two trap on exhaustion. Milestone 185 (sweep userspace's bounded retry loops onto a clock), not started caretaker teardown
boot self-test budget boot_self_test.rs narrowed the check before it collects its own child; the window stays global budget's window
a_process_spends_memory_region_and_the_kernel_never_allocates system_tests/src/user/elf_child_builder_tests.rs open a global used() equality across a process run, which the free_page_frames() sweep did not read. Never seen red, though its boot twin budget has; found by reading on 2026-09-24 budget's window
a_user_program_that_never_yields_is_preempted_anyway user/tests.rs open a wall-clock window with no wait; needs all four cores descheduled; never seen red known residuals
every_secondary_runs_scheduled_work smp.rs open indexes by the core a probe ran on. If it fails, take the placement probe's fix known residuals
a_finished_thread_is_reaped_and_its_memory_returned sched.rs narrowed per-ThreadId reap waits, a waited used() <= before (08-03); a one-thread stack-reuse probe (08-17) first verdicts, stack reuse
a_dead_user_thread_frees_its_whole_address_space user/tests.rs narrowed per-ThreadId reap waits and a waited used() <= before (08-03) first verdicts
kernel_stacks_do_not_touch_the_frame_allocator_in_steady_state sched.rs narrowed each spawn followed to its own reap; a waited free() >= free_before (08-16) miss taxonomy
caretaker_teardown_reclaims_a_full_session_worth_of_memory user/login_tests.rs, fixtures/src/login_test_client.rs narrowed destroy_with_retry waits on the region under a 5 s clock ceiling, 40x the worst wait (08-28) caretaker teardown
ticks_arrive_at_the_configured_rate both timer.rs fixed asserts the re-arm grid law (08-03); an exhausted retry budget prints UNMEASURED (08-18) first verdicts, timer disposition
the_handler_keeps_up_when_no_lock_is_held both timer.rs fixed deleted 2026-08-18; script/icount makes the claim miss taxonomy, timer disposition
holding_a_lock_masks_the_timer, the masking window both timer.rs fixed both reads moved inside the critical section; ticks_on(core) (08-04) second round
holding_a_lock_masks_the_timer, liveness and release; the_timer_is_ticking both timer.rs fixed wait for the pending bit, or the property (09-24) preemption window
unmasking_delivers_the_tick_that_was_held, a_masked_window_takes_no_preemption preemption_window_tests.rs fixed waits for timer::is_tick_pending; QEMU raised ticks 86 ms late (09-24) preemption window
scanout check (host referee) xtask/src/scanout.rs fixed QEMU's monitor refused its dumps; one connection now (10-12) referee
inbound check (host prober) xtask/src/inbound.rs fixed an EINTR read dropped a held connection, losing its round (09-24) inbound EINTR
work_can_be_placed_on_every_cpu smp.rs fixed asserts arrival at the named core (PerCpu::adopted), not execution (08-04) second round
a_thread_that_never_yields_is_preempted_anyway sched.rs fixed the spinner is waited on, not sampled; the budget is 200 delivered ticks (08-04) second round
a_sender_blocks_until_a_receiver_arrives, other_threads_run_while_one_is_blocked sched.rs fixed five yield-count waits became wait_for (08-04) second round
threads_round_robin sched.rs fixed waits for every counter above zero, then for its own reaps (08-03) first verdicts
five sites found on the physical core, milestone 81 (an HVF leg) sched.rs (3), user/reap_tests.rs, user/supervision_tests.rs fixed yield counts became waits on the property (08-04) notes/hvf-leg.md
reclaim_frees_an_embryo_tcbs_region sched.rs fixed is_thread_present(tid) in place of a global headcount (08-16) miss taxonomy
a_migrated_kernel_thread_keeps_its_hart_pointer smp.rs fixed the drain budget is 200 delivered ticks through testing::TickBudget (08-18) migration drain
a_userspace_driver_reads_a_file_over_the_pcie_transport, and three siblings user/tests.rs, user/riscv64_virtual_io_tests.rs fixed the baseline moved before start_pci; x86_64's ROUTED_INTERRUPTS stopped counting timer ticks (09-04) PCIe interrupt counter
run_swap, "returned 277 of 224 pages" user/live_swap_tests.rs fixed the region's absence after reclaim is the measurement (09-22, #1101) unowned reds
the_page_is_returned_when_the_space_is_dropped user/current_cpu_tests.rs fixed asks the frame's own allocator bit (09-23) unowned reds
35 assertions bracketing free_page_frames() sched.rs, user/force_kill_tests.rs, user/tests.rs, user/cpu_time_tests.rs fixed testing::RegionRun asks the region's own frames (09-23) free-page-frames sweep
frame hygiene user/live_swap_tests.rs fixed removed on 2026-08-03 (#46); the property was already asserted twelve lines above first verdicts

Milestone 62's acceptance evidence is two repeat counts on one laptop under eight spinners. On 2026-08-17, 36 of 45 loaded runs were green, and the reds were the two timer assertions plus the double free. On 2026-08-22, after the disposition and the drain fix, 45 of 45 were green at a peak load of 90 (the confirmation run).

Where to look for the next one

Milestone 78's scope note counted 39 kernel sites of this shape, never audited as a set. Four greps cover everything the rounds found by reading:

  1. a global count taken as a baseline: thread_count(), free_page_frames(), memory::stats();
  2. a loop with no clock in it;
  3. a frame count standing in for a mechanism;
  4. a bounded retry count in a user program, over a system call that a timer tick has to clear.

The 2026-09-23 sweep closed the first grep for free_page_frames() only. On 2026-09-24, memory::stats() still had 22 matches in kernel/src and thread_count() had 36, and neither has been read against these questions.

BUGS

Appendices

Each appendix verifies a row or a rule above. Every dated section an older citation names is in one of them, so the citation still resolves.

appendix what it verifies dated sections it holds
global-baselines-and-the-drift-law the first verdicts and the direction diagnostic "The diagnostic that sorts the family", "The verdicts", "Postscript: a fast machine finds the same family"
host-load-line the harness's load report "The harness now says whether the host was loaded (2026-08-18)"
measurement-windows-and-the-load-recipe the window diagnostic and the load recipe "The second round, 2026-08-04", "The instrument that was missing", "The handler-latency twins", "Recommended here, not built here"
known-residuals the old BUGS list, with its corrections the former "BUGS" section
miss-taxonomy-and-clockless-loops the handler taxonomy, the embryo and kernel-stack fixes "The fourth round, 2026-08-16", the 2026-08-15 aarch64 taxonomy
stack-reuse-and-proxy-detectors a frame count blind to a stack leak, nine injections "The fifth round, 2026-08-17"
the-icount-claims the timer claims in instructions "The sixth round, 2026-08-17"
first-loaded-acceptance-run 45 loaded runs, and the double free "The acceptance run, 2026-08-17"
timer-assertion-disposition the band diagnostic, the deletion, claim 4 "The disposition, 2026-08-18"
migration-drain-tick-budget a drain budget in delivered ticks "The migration drain, 2026-08-18"
confirmation-run 45 of 45 green "The confirmation run, 2026-08-22"
caretaker-teardown-wait a user-program retry loop, and five siblings "The fifth round, 2026-08-27", "The disposition, 2026-08-28", "The measurement, and the number that settles it"
unowned-reds run_swap, the current-cpu frame, the liveness check "Two unowned reds, recorded rather than chased: 2026-08-27"
x86-pci-express-interrupt-counter a counter sampled late "A counter that could not have been late, only sampled late: 2026-09-04"
free-page-frames-sweep 46 reads of the global counter "The sweep, 2026-09-23"
preemption-window-tick a tick raised late, read as one dropped "A tick not yet raised: 2026-09-24"
inbound-eintr a signal read as a dead connection "An interrupted read: 2026-09-24"
boot-self-test-budget a neighbor's teardown in a global window "A neighbor's teardown: 2026-10-20"

See also