Rust native guest kernel: why it exists and when to try it¶
Motivation¶
pVisor builds the Rust native guest kernel to tune short commands, repeated file access, and idle periods for Agent VMs without requiring Git or compilers to use a special API. For example, when a tool reopens a dependency known to be immutable, the guest can reuse the file data it already read. It cannot make the same assumption for a workspace file the host is still editing. The pVisor VMM, guest supervisor, and virtio-fs workspace stay in place; the guest kernel changes how it cooperates with the host. Keep Linux firmware as the default; try Rust when the workload fits its experimental profile.
On the tested KVM configuration, Rust reaches the first command in 73.597 ms versus 95.546 ms with Linux firmware. It also reduces first-touch time for a 32 MiB anonymous mapping from 61.185 ms to 4.262 ms, but its getpid calls take longer than both Linux configurations. Against Linux firmware on the same VMM, Rust is faster on 12 of 18 operations, slower on two, and shows no detectable difference on four. This is an operation count, not an overall Agent task score.
Experiment design¶
Measure time to the first guest command and time to complete a fixed set of guest operations as startup and operation latency. These latencies show how quickly a new VM starts useful work and how long it then spends on specific tasks. Lower latency means less waiting at the corresponding stage.
All three configurations run on the same Fedora Linux x86_64/KVM host (Ryzen 7 9700X, Linux 7.3.3-300.fc45.x86_64, Btrfs), with 4 vCPUs, 256 MiB configured RAM, and the same four host logical CPUs on distinct physical cores. The pVisor configurations use the same VMM build and virtio-fs root, with either Linux firmware 6.12.109 or the Rust native guest kernel. Firecracker 1.13.1 uses Linux 6.1.141 and a fresh private ext4 disk over virtio-blk. Its file results measure that disk path, not host-shared access.
Linux firmware is the primary baseline for deciding whether to switch kernels in pVisor. Firecracker answers a different question: how these operations perform in a microVM with a private disk when a host-shared workspace is not required. Its VMM, kernel, filesystem, and startup marker delivery all differ, so the gap cannot be attributed to the kernel alone.
Startup runs from VMM launch to the first marker written by the same static guest command, delivered through pVisor task stdout or Firecracker's serial console. It excludes image preparation and shutdown. Other rows measure inside an already booted guest, excluding VM lifecycle and fixture setup. File reads labeled warm or shuffled over a disk-backed path follow a full read of the file; fsync rows include one final sync. The host page cache is not flushed.
Each operation has one verified warmup block followed by 30 blocks, each running one fresh VM for each configuration. Every six blocks cover all six launch orders in randomized order. The probes check results, the filesystem type, and the online CPU count for runtime operations; the cross-vCPU probe also checks placement. A failed check, abnormal exit, or timeout stops collection. Slow samples are not dropped. Configured RAM is not measured memory use. Network latency, daemon warm pools, concurrency, full Agent workflows, application compatibility, and crash durability are outside this comparison.
Data and analysis¶
2026-11-29, pVisor f94b3bfb: 1,620 measured launches and 54 warmups; no failures or exclusions. Times are milliseconds per entire operation, P50 over 30 fresh VMs per column. Cells with separated clusters show each cluster's P50 and share of the 30 samples instead. Difference columns show the median within-block difference and its 95% sign interval; positive means Rust took longer. An interval crossing zero does not establish a difference.
| Operation | Linux firmware | Rust native | Firecracker | Rust − Linux | Rust − Firecracker |
|---|---|---|---|---|---|
| First command | 95.546 | 73.597 | 625.234 | −23.171 [−30.617, −15.517] | −555.580 [−570.984, −545.505] |
| Integer loop, 8 million steps | 9.018 | 9.012 | 9.019 | −0.015 [−0.125, +0.095] | −0.051 [−0.140, +0.047] |
getpid, 131,072 calls |
4.761 (24/30); 6.661 (6/30) | 7.259 (21/30); 8.873 (9/30) | 4.487 | +2.416 [+2.118, +2.928] | +2.958 [+2.609, +3.368] |
| Pipe, 4,096 round trips | 48.575 | 40.556 | 84.868 | −6.807 [−11.180, −4.761] | −39.586 [−51.199, −31.027] |
| Pipe, 4,096 cross-vCPU round trips | 45.541 | 39.508 (23/30); 50.149 (7/30) | 78.972 | −3.224 [−6.242, −2.348] | −36.575 [−43.636, −29.744] |
| Memory copy, 16 × 16 MiB | 10.970 | 8.484 | 12.021 | −2.075 [−2.703, −1.125] | −3.204 [−4.539, −1.989] |
| Map and first-touch 32 MiB | 61.185 | 4.262 | 52.414 (25/30); 71.787 (5/30) | −57.195 [−58.107, −56.004] | −48.948 [−50.166, −47.764] |
Disk-backed sequential write + fsync |
49.159 | 33.068 | 19.324 | −18.727 [−21.797, −17.048] | +12.689 [+10.012, +15.623] |
| Disk-backed warm sequential read | 35.409 | 26.339 | 0.384 | −10.933 [−14.445, −5.724] | +25.902 [+23.103, +27.632] |
| Disk-backed warm shuffled read | 31.622 | 28.681 | 0.527 | −4.624 [−7.095, +1.093] | +28.192 [+25.184, +30.751] |
Disk-backed shuffled overwrite + fsync |
41.920 | 34.509 | 5.477 (27/30); 46.081 (3/30) | −7.340 [−11.853, −0.282] | +25.138 [+23.399, +33.290] |
| Disk-backed create, stat and remove 1,024 files | 759.925 | 486.081 (10/30); 630.183 (20/30) | 11.770 | −157.433 [−236.209, −117.851] | +604.632 [+508.894, +622.674] |
| tmpfs sequential write | 8.756 | 0.671 | 9.383 | −8.043 [−8.462, −7.809] | −8.728 [−9.194, −8.440] |
| tmpfs sequential read | 0.458 | 0.429 | 0.531 | −0.044 [−0.074, −0.002] | −0.121 [−0.145, −0.061] |
| tmpfs shuffled read | 0.380 | 0.413 | 0.471 | −0.003 [−0.102, +0.117] | −0.057 [−0.1433, −0.0001] |
| tmpfs shuffled overwrite | 0.439 | 0.428 | 0.490 | +0.037 [−0.094, +0.122] | −0.097 [−0.152, −0.027] |
| tmpfs file lifecycle, 1,024 rounds | 4.920 (26/30); 7.353 (4/30) | 3.481 (21/30); 4.218 (9/30) | 4.173 | −1.542 [−1.927, −1.123] | −0.640 [−0.914, −0.266] |
| tmpfs directory scan, 16 × 512 entries | 0.434 | 0.486 | 0.441 | +0.069 [+0.021, +0.109] | +0.067 [+0.010, +0.130] |
What the measurements support¶
Of the Rust − Linux paired intervals in the table, 12 lie below zero, two lie above zero, and four contain zero. Operations differ in size, duration, and how often applications perform them, so this count cannot predict a task speedup.
- Startup and memory: Rust is worth testing for workloads that launch many short-lived VMs or frequently allocate and first-touch memory. The Rust default uses transparent huge pages for KVM guest backing. This comparison measures the default configuration as a whole; it does not isolate huge pages or establish lower host memory use.
- CPU and IPC: The tested pipe round trips favor Rust, but the integer loop shows no detectable difference.
getpidstill costs more on Rust. None of these rows predicts compiler throughput or speedup from adding vCPUs. - Files: Rust reduces the tested sequential I/O and file-tree costs on the same pVisor virtio-fs path, but shuffled hot reads did not resolve a difference against Linux firmware. Faster sequential tmpfs writes do not imply faster directory scans or in-place overwrites. Each file-data row transfers 4 MiB. Firecracker's private ext4 serves its cached reads and file tree faster, but has no equivalent live host directory in this test. Choose the required sharing semantics before comparing times.
What works today¶
| Area | Available now | Boundary |
|---|---|---|
| Execution | Builds that embed Rust can select PVISOR_GUEST_KERNEL=rust-native for existing Docker-compatible and Agent VM workflows. Linux remains the default. |
Fresh VM only. No EFI, TEE, snapshot or restore. The root is virtio-fs, not a guest block device. |
| Platform and sizing | Linux x86_64/KVM accepts 1–64 vCPUs with at least 16 MiB or 1.5 MiB per vCPU rounded up, whichever is larger. Linux ARM64/KVM and Apple Silicon/HVF require one vCPU and at least 256 MiB. | These are launch limits, not workload sizing advice. The performance table covers only x86_64/KVM at 4 vCPUs and 256 MiB. |
| Host cooperation | Rust can retain data from qualifying immutable lower files across opens. Single-vCPU x86_64/KVM also has an opt-in idle handoff. | Immutable-file reuse does not change live writable directory semantics. The table does not measure idle savings, production density, or Linux application compatibility. |
How to evaluate your own workload¶
On Linux x86_64/KVM, use a pvisor build with the Rust kernel embedded and check that a basic VM command prints hello. The environment variable applies only to this command.
Then compare a real task against the default Linux firmware with the same image, resource budget, and mounts. Check the files the task produces as well as its output and exit status. Separate the first image pull from prepared VM startup, and the first task run from repeat runs. Keep Linux for workflows that depend on snapshots or restore. Broader Agent deployment still needs evidence on task success, host resident memory, idle cost, and completion under concurrency; these microbenchmarks do not replace those checks.
Build and selection requirements · Benchmark reproduction and source receipts · Shared workspace and batch publication engineering follow-up
See startup and filesystem for broader configurations such as Docker and QEMU. Their experiments use different timing boundaries and cannot be combined with this table into a single ranking.