Repository navigation
ateworker-microvm: run containers on EROFS layer images over virtio-pmem with DAX - #2610
Open
ajaysundar.k (ajaysundark) wants to merge 6 commits into
Open
ajaysundar.k (ajaysundark) wants to merge 6 commits into
ajaysundar.k (ajaysundark) wants to merge 6 commits into
Conversation
ajaysundar.k (ajaysundark)
force-pushed
the
pr4-microvm-erofs
branch
2 times, most recently
from
October 14, 2026 17:52
f770df0 to
acd3199
Compare
ajaysundar.k (ajaysundark)
marked this pull request as ready for review
October 14, 2026 17:52
This was referenced Oct 14, 2026
ajaysundar.k (ajaysundark)
force-pushed
the
pr4-microvm-erofs
branch
from
October 16, 2026 02:05
acd3199 to
744783d
Compare
ajaysundar.k (ajaysundark)
marked this pull request as draft
October 16, 2026 02:05
jiayimeow
reviewed
Oct 16, 2026
ajaysundar.k (ajaysundark)
force-pushed
the
pr4-microvm-erofs
branch
from
October 17, 2026 09:56
744783d to
64a3cbd
Compare
ajaysundar.k (ajaysundark)
marked this pull request as ready for review
October 17, 2026 09:56
2 tasks done
ajaysundar.k (ajaysundark)
force-pushed
the
pr4-microvm-erofs
branch
2 times, most recently
from
October 18, 2026 11:41
571448c to
7e09937
Compare
2 tasks done
ajaysundar.k (ajaysundark)
force-pushed
the
pr4-microvm-erofs
branch
from
October 18, 2026 16:24
7e09937 to
21b17bf
Compare
ajaysundar.k (ajaysundark)
force-pushed
the
pr4-microvm-erofs
branch
from
October 19, 2026 22:51
21b17bf to
f2c4fa5
Compare
ajaysundar.k (ajaysundark)
force-pushed
the
pr4-microvm-erofs
branch
3 times, most recently
from
October 23, 2026 02:22
6eb4821 to
9f07487
Compare
A pure Go EROFS writer and reader, so atelet can build layer images without mkfs.erofs or privilege. It is pinned to a main commit because v0.3.1 lacks Link, RemoveAll, Lstat and ReadLink, which the builder needs for hardlinks and for replacing earlier entries in a layer.
EnsureImageAs takes a Form. Form{EROFS: true} streams the layer tar
through go-erofs into layer.erofs and its sha256, for a guest to mount
over virtio-pmem with DAX (4 KiB blocks, no inline data, 2 MiB aligned).
The image carries whiteouts, ownership and xattrs, so the build needs no
privilege. A layer stays in the form it was first pulled in, and atelet
still asks for Form{} everywhere.
A guest that mounts the layer images itself leaves the host no merged view to write into before boot. PrepareEROFSUpper resolves paths across the images with overlayfs lookup rules and creates the directories the host needs, plus the implicit-parent repairs, in a fresh upper. SetupBundleRootfs refuses an EROFS bundle.
A node that runs gVisor and micro-VM actors needs a shared layer as both fs/ and layer.erofs. ensureLayer downloads the blob again and builds the missing form in the same layer directory, under the same per-layer flight. Adding fs/ to an EROFS layer rewrites whiteouts.json, since the image build records only implicit directories.
Let CreateSandboxOpts carry pmem mounts so the agent mounts them when it creates the sandbox, before any container starts. They use the virtio-fs storage driver, which mounts Source directly. The block and nvdimm drivers wait for a hotplug uevent or an ACPI NFIT, and the VM provides neither for a cold-plugged virtio-pmem device.
Attach each image layer to the guest as a read-only EROFS image on virtio-pmem with DAX, and let the guest mount the overlay over an upper on the virtio-fs share. Image pages stay in the node's page cache, shared by actors and out of guest RAM and the memory snapshot. Layers get PCI segments of their own, 31 per segment, up to 155 per actor. Snapshots record the layer digests, and a restore checks them first.
ajaysundar.k (ajaysundark)
force-pushed
the
pr4-microvm-erofs
branch
from
November 11, 2026 17:56
9f07487 to
28aa1e8
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Run micro-VM containers on EROFS layer images mapped over virtio-pmem with DAX.
Motivation
With the host-merged rootfs, each guest copies the image bytes it reads into its own page cache and its memory snapshot, and every
open,statandreadis a FUSE round trip. With DAX the guest maps the node's page cache for the layer image directly, so actors on the same layer share those pages and snapshots don't carry them. Kata already carries the dependencies:erofs,virtio_pmemandFS_DAXin the guest kernel.Fixes #2440
What changed
Form{EROFS: true}(imagecache: build EROFS layers #2609). Cleanup for removing the unused host-merged code fromateworker-microvmis a follow-up./dev/pmem1..). Layer devices sit on their own PCI segments from segment 2 up (31 slots / layers) per segment, and the VM creates only the segments it needs. Currently the limit is set as 5 segments, allowing up to 155 layer images per actor across its containers.erofs ro,daxwhen it creates the sandbox. The guest mounts the overlay, with the upper and work dirs on the virtio-fs share (<cid>/rw,userxattr,volatile).erofs-layers.jsonand archives upper and work together inrootfs-rw-<cid>.tar. Restore checks the node's layer digests against this record, and accepts a layer pmem device from the snapshot config only if the record names its file anddiscard_writesis set. MEMORY and ROOTFS snapshots taken before this change cannot be restored./etcfor resolv.conf), a ROOTFS restore replaces that whiteout with an opaque directory, as overlayfs does for a mkdir over a whiteout.Numbers
SWE-bench astropy (14 layers), one c3-highcpu-192-metal node (COS), suspend to object storage, 15 users, 10 min per run, same tree.
Verified against swe-perf prow jobs (150 users on the c3-highcpu-metal), for two days against main of the same day.
Inside a guest, reading 568 MB of
.sofiles raisedCachedby 579 MB with the host-merged rootfs and by 0 with DAX.Testing
go test -race ./cmd/ateworker-microvm/... ./cmd/atelet/... ./internal/imagecache/... ./internal/ocispec/..., the root-gated imagecache tests underdocker run --privileged(7.1 kernel), andhack/verify/{gofmt,go-modules,licenses,boilerplate,golangci-lint}.sh. Each commit builds alone.On a c3 metal node (COS): cold boot, MEMORY suspend and resume, and golden restore with a 14-layer image (segment 2) and a 40-layer image (segments 2 and 3). In the guest, the
/dev/pmemNsizes match the VM config's order for all 40 devices, and a file from the 40th layer reads through the overlay. Golden restores (solo, 15 concurrent, and 38 in a 15-user run) took 0.09 to 0.25 s.Tests pass
Appropriate changes to documentation are included in the PR (
hack/microvm-assets/README.md,docs/api-guide.md)