Repository navigation
Description
Summary
Helios has no suspend/hibernate/resume story and no fast-start roadmap. This tracks both, decomposed into the pieces that actually differ. "Sleep" (idle power) mostly dissolves on a VM — WFI idle, display blank, and the balloon already returns memory — so it is not a work item here; real-hardware S3 is out of scope.
The key insight that makes guest-native hibernate tractable
Linux's swsusp does not serialize processes semantically: it freezes tasks, quiesces devices, and writes a compressed image of RAM — kernel structures and user pages alike — to disk, then restores it verbatim. No per-process serializer exists or is needed, because a process's state is its memory plus kernel bookkeeping, and kernel bookkeeping lives in RAM too.
The same mechanism works on Helios's wasm instances for free: linear memories are pages, and the component's TaskStates, futures, Wasmtime fibers and allocator internals are all just bytes in RAM. A whole-memory image preserves them identically — pointers stay valid, fibers resume in place. There is no need for a Wasmtime "serialize instance" API, and the absence of one upstream is not a blocker. (Per-instance semantic serialization is a different, genuinely hard problem — and not this one.)
Helios is arguably easier than Linux here: kernel state is explicitly owned (RuntimeState, pools, registries) rather than global; component tasks are cooperative and park cleanly at await points (no mid-syscall freezer pathology); and the device surface is five or six virtio drivers, whose live state sits mostly in rings — i.e., in RAM, which the image already preserves.
Work item A — guest-native hibernate (swsusp analog)
- Freeze barrier: park all instance tasks and stop non-bootstrap processors.
- Device suspend/resume ops across the virtio drivers (gpu/blk/net/input/snd/rng/9p): drain queues, save the little state that isn't in rings.
- Image writer: allocated frames → compression → disk with a header (signature, format version, memory map). The existing virtio-blk scratch disk is the natural target but is currently 256 MiB < 512 MiB RAM — needs either a larger device or allocated-pages-only-plus-compression sizing.
- Early-boot resume path: detect a valid image, restore pages to their original frames, re-initialize devices, re-attach channels, unpark.
- Resume checklist: immediate entropy reseed (snapshot-resume nonce-reuse is a real bug class), monotonic clock reconciliation, host-channel reconnect (9p hostfs, serial, debugger RPC). Live TCP stays dead — applications reconnect, same contract as Linux.
Work item B — QEMU-level snapshot route (savevm/migrate)
Cheaper on disk mechanics — QEMU dumps RAM plus virtio device state — and shares most of the resume checklist (channel reconnect, entropy, clock). Two distinct additions:
- Consume
vmgenid: QEMU's VM Generation ID device exists precisely to tell a guest it has been resumed from a snapshot; on counter change → reseed entropy, rebuild the 9p session, mark host channels stale. - Inspector commands for
savevm/-incomingrestore.
A and B share ~80% of the resume-side work; B is the near-term "instant-on" demo, A the self-contained feature.
Work item C — fast startup, decomposed into three latencies
- Boot → desktop (~10 s observed under aarch64 HVF): drive from kernel: launch-phase timing on the exec path, and its x86 KVM measurement for #311 #352's launch-phase timing. Suspects visible in logs: UEFI/edk2 phase, component engine build (4 GiB reservation, 1024 stacks), bootfs artifact signature verification, serial device probing.
- First program run:
building cached compiler plugin runtime (one-time per kernel boot)— the compiler runtime spins up on first use. Prewarm it in the background once the desktop is online, or persist a content-hash-keyed cwasm cache on the scratch disk. - Program spawn: the pooling allocator already makes instantiation cheap; a prewarmed instance pool for hot programs (
dash,debugger) is the classic next step.
Explicitly out of scope
Swap design and guest memory compression are separate topics with their own discussion and are not covered here. Real-hardware suspend-to-RAM is out of scope.
Why it matters
For an interactive desktop — and for workloads like an agent living in the guest — resume is the difference between a sub-second "open the lid" experience and a ~10 s cold boot, and it survives any amount of boot-path optimization: resume latency does not depend on how fast cold boot gets.
Activity