notes

Can a userspace process hold a timer?

(Written 2026-09-05 for milestone 263, a spike. This note prices a design and does not build one: nothing here adds a system call or an object, and the fork it informs is an architect's. Name provisional: timer-capability.md is a sibling of timed-wait.md rather than a second copy of it, and the two answer different halves of it.)

Since then, verified 2026-10-11 (UTC): the fork was decided as §147 (a timer a userspace service cannot hold), and milestone 151 (notification objects) is built. Milestone 106 (a wait that ends on either the interrupt or the deadline) built objtype::TIMER on 2026-09-26 on all three architectures. timer.md has what was built. This note stays as the pricing record, and it describes the tree of 2026-09-05 and 2026-09-13.

The answer, first. The userspace-timer-service answer to milestone 106 does not survive §19 (architectural) parity, and the reason is not the one the milestone block predicted.

Two clauses, and both are needed:

  1. On riscv64 no architected timer can be granted to U-mode, on any machine, by the privileged architecture rather than by a gap in this kernel. There is no U-mode timer-compare CSR, no enable bit that would create one, and no route to SBI from U-mode.
  2. The only mechanism that works on all three is per-board MMIO, and it is not uniformly available. The two real boards have generous MMIO timer blocks (argon fourteen channels, radon four, each with its own interrupt line). But QEMU's aarch64 virt has no MMIO timer device at all, and that is the machine every gate in this tree runs on. So a userspace timer service would be a different driver per board, absent on the aarch64 CI machine, which is §19's own definition of the bug rather than a parity story.

The correction worth having is on the third architecture the block wrote off. aarch64 can grant a timer comparator to one thread rather than to all of EL0, using machinery this tree built for a different reason three days ago.

What each specification actually says

Three specifications, read rather than recalled, because milestone 263's own BUGS section says the table it was scoped from is this tree's doc comments and "the maintainer's reading is the thing most likely to be wrong here." It was wrong about one of three. The register fields, the quoted text and the code behind each verdict are in specifications.md.

The other route: an MMIO timer the kernel already knows how to delegate

An MMIO timer block is a DeviceFrame plus an Object::Interrupt, which is how every userspace driver here already owns a device, so a machine with a spare one can give it to a userspace service today. argon has fourteen channels and radon four, each with its own interrupt line. xenon's HPET is presumed and not confirmed. QEMU's aarch64 virt has none, and its riscv64 virt has only the goldfish RTC's single alarm. The table and its sources are in mmio-timers.md.

Why this route does not rescue the userspace-service answer. It is a per-board driver rather than a portable capability, so §19's "a kernel capability ships on every supported architecture, proven by the same suite" is not met by it: the suite runs on QEMU, and QEMU's aarch64 virt has nothing to drive. A userspace timer service would exist on argon, exist differently on radon, exist a third way on xenon, and not exist at all on the machine this tree gates against. That is three drivers and a hole, against one system call method.

It is a good answer to a different question. If a particular workload on a particular board wants a private high-resolution timer, this is how it gets one, and it needs nothing built. It is not how a kernel serves thread::sleep.

What the fourth shape costs

Timer::ARM(deadline, notification) -> the kernel signals that notification at the deadline.

The deadline bookkeeping was already priced in notes/timed-wait.md and is not re-measured: one comparison per idle tick and a per-thread deadline at zero bytes. What was unpriced is the object. A throwaway scaffold built it on 2026-09-05, passed script/test on all three architectures, and was deleted. Three figures came out of it:

The scaffold used the crudest expiry table, built no revocation, measured nothing in time and priced no kernel-side consumer. The method, the tables and those gaps are in first-scaffold.md.

What the second scaffold priced, 2026-09-13

A second scaffold, page-resident like a real implementation, priced what the first left out. It was compiled on all three architectures and deleted, never run. The reasoning, the four builds and the symbol-level working are in second-scaffold.md.

The dependency on milestone 151, stated

The fourth shape signals a notification, and notification objects are §101 (notification objects), decided 2026-08-20 and unbuilt when this was written (milestone 151, BUILT since; see the note under the title). What the pricing above assumes about it:

  1. That the signal target is a Rendezvous, not a separate object. The scaffold signaled through sched::interrupt_notify, which takes a RendezvousId, because that is what exists today. §101's whole argument is that a notification should be its own object with its own queue, separate from the endpoint. If 151 builds that, Timer::ARM's second argument names a Notification and not a Rendezvous, and the dispatch arm's capability check changes shape. The byte figures do not move much; the system call's meaning does.
  2. That binding to a TCB is what makes the shape useful. Milestone 106's title is met only if a thread blocked in RECEIVE on an endpoint wakes on either a message or the deadline, and §101 says that is what TCB binding is for. Without 151 the fourth shape gives a thread a timer it can block on and no way to block on a timer and a message at once, which is milestone 106's actual complaint. So the fourth shape is not independently useful: it is 151 plus one object.
  3. That §101's carve-out still stands. §101 anticipated a userspace timer process and named a kernel timed wait as the alternative for kernel needs. This spike's finding is that the userspace process cannot exist on riscv64, which moves the fourth shape from "an option nobody listed" to "the only one of the four that is buildable on all three architectures". That is a finding for calef, not a recommendation from this lane.

BUGS