notes

The tick route: how the soak was made to cross cores

Name: provisional.

An appendix to notes/soak.md. It is milestone 221 (the soak never crosses cores, so build the hook that makes it): the mechanism, the two ordering bugs it had, and what it establishes about risk 5.

The decision

design/decisions/0138-cross-core-handoff-under-load.md (how a saturated workload is made to hand threads across cores) put four options in front of calef. He approved option D on 2026-09-02.

The mechanism, and it is short

Under --features soak_test and nowhere else, sched::on_tick signals a rendezvous. One worker per group blocks on that rendezvous through the Interrupt::WAIT a device driver uses. All three architectures' timer dispatchers call on_tick in real interrupt context on every core. So a tick runs the identical sequence a device interrupt runs:

soak::signal_waiters -> sched::interrupt_notify -> Rendezvous::signal -> handshake.serve
                     -> sched::wake_load_aware -> pick_wake_target -> place_on -> the reschedule IPI

Each group has its own route, and each tick signals one of them, round-robin across the machine. Both halves of that are fixes rather than flourishes, and the section below says what they fix.

That last chain is why this was worth building rather than the alternatives. wake_load_aware is where risk 5's one observed defect lived, on radon. It had exactly one caller (sched::interrupt_notify), which no user workload could reach.

Four properties, each of which was a requirement rather than a bonus:

What crosses is the waiters, not the pairs

This must not be misquoted. Rendezvous wakes are local by design whatever else is happening, so the callers and responders are as pinned as they ever were. This sustains the wake protocol across cores under load. It does not make the IPC workload migrate. Only a periodic rebalancer would, and DECISIONS 138 declines one on the reopening trigger of DECISIONS ยง28 (a real workload where fairness visibly fails), which has not fired. The kernel says this in words at the start of every run, and script/soak-test says it again in its summary. The flattering reading is available, and a summary gets quoted.

The soak-only interrupt numbers

bind_tick_routes binds group g's route to intid 255 - g. None of those names hardware or can be delivered on any of the three architectures. On aarch64 and riscv64 a routed interrupt arrives only if something enabled it at the controller, and nothing enables these. On x86_64 the top of the band is the local APIC's spurious vector, answered in its own arm before interrupt_route is asked. The rest sit at the far end of an MSI band allocated upward from 0xc0.

None of that is what makes it safe. soak::bind_tick_routes asks sched::interrupt_route about every number before it takes any of them. It refuses to start a soak whose routes would steal somebody else's interrupt. A soak boot runs the whole tour first, so every device has already claimed what it is going to claim by the time that check runs.

Two bugs this mechanism had, both found by running it, both about ordering

Neither is visible in review, and getting either wrong produces the same symptom: a soak reporting workers as wedged when the defect is in the instrument.

One rendezvous for every waiter starves all but one, on a loaded host, so each group has its own. crates/inter_process_communication's Rendezvous::receive takes a pending signal before it looks at the receiver queue. That is right for a driver, since an interrupt that already happened must not be missed. It is wrong for four peers sharing a source. When ticks arrive in a burst, whichever waiter is already running drains the whole backlog through the pending path and never queues, and the others sit at the head of a queue nothing pops. A rendezvous per group means a backlog can only ever belong to the waiter it accumulated for. A shared rendezvous passes on an idle machine: the starvation needs a busy host to appear at all.

The kernel binds the routes before it spawns the first waiter, and switches the signaling on last. Arming last is correct for the signaling. A route signaled before anyone waits on it hands the first waiter a backlog, and makes the first beat measure setup. It is wrong for the routing. A waiter that reaches Interrupt::WAIT before its route exists gets WrongObject, and with no channel to report a refusal on, it stops counting. The run fails a beat later with workers apparently wedged. aarch64 tolerates the race and riscv64 does not, which is the ordinary shape of this class.

What it establishes about risk 5, and what it does not