Skip to content

vsock: add Firecracker-compatible hybrid host surface - #10

Merged
vandycknick merged 18 commits into
mainfrom
feat/adr15
Sep 1, 2026
Merged

vsock: add Firecracker-compatible hybrid host surface#10
vandycknick merged 18 commits into
mainfrom
feat/adr15

Conversation

@vandycknick

Copy link
Copy Markdown
Owner

Summary

  • replace ADR 0005 endpoint plugins with a Firecracker-compatible hybrid Unix-socket surface owned by vmmon
  • add backend-neutral dynamic vsock streams, listener registration, connection capacity, path validation, and runtime discovery
  • migrate the krun helper to the pinned libkrun v2 fork and attach vmmon as an embedded vhost-user-vsock backend
  • align the Virtualization.framework backend with the same observable host contract
  • remove the plugin runtime and guest forwarding plumbing superseded by the hybrid surface
  • cover mux, listener, reset, capacity, process, and real-KVM startup behavior

Linux datapath

  • keep one private vhost-user control socket per VM for feature negotiation, guest-memory memfds, and queue eventfds
  • process normal vsock payloads through shared virtqueues rather than the control socket
  • preserve host connection requests across guest-memory and vring initialization, and bound the internal connection handshake
  • pin libkrun to published silo/v2 revision 10b6f752ba8ea735c3d9edaa549599dcf3f98d18

Compatibility

  • replace the endpoint/plugin-shaped VmSpec.vsock contract with explicit public-surface enablement and an optional mux filename
  • reject removed plugin fields rather than silently ignoring or migrating them
  • retain unconditional internal vsock access for managed SSH and guest-agent ports when the public surface is disabled

Verification

  • make test
  • make clippy (passes with existing unrelated warnings)
  • cargo fmt --check
  • cargo test -p vhost-vsock (38 passed)
  • cargo test -p vmmon --features mock-backend connect_response (3 passed)
  • musl guest builds and Go race/vet checks from the full implementation pass
  • fresh cargo fetch --locked and cargo build --locked -p krun --features krun-bin --bin krun with an isolated Cargo home and no Git URL rewrite
  • real KVM launch reached guest readiness in 1.5 seconds with the vring worker remaining active

macOS runtime validation was not run in this Linux environment.

Host connection attempts can arrive before libkrun has shared guest memory and before the RX and TX vrings are active. The backend consumed the connection wakeup and then attempted queue processing. The resulting NoMemoryConfigured or queue iteration error escaped handle_event and terminated the vring worker permanently.

Defer queue processing across both initialization boundaries while preserving queued requests and pending vsock packets. Memory setup and the first guest queue kick can then replay the connection after the device becomes usable.

Add regression coverage for events received before memory setup and before vring activation. Include dynamic source-port diagnostics to correlate host requests with guest responses.

Bound the internal OK handshake to five seconds so a stopped backend cannot retain a connection-capacity lease indefinitely.
Document the persistent vhost-user control socket, shared-memory virtqueue dataplane, eventfd notifications, and per-connection stream adapters.

Compare vhost-user-vsock with libkrun built-in vsock port-path API, clarify the remaining relay boundaries, and record the expected performance tradeoffs without claiming unmeasured benchmark results.
The public silo/v2 branch now contains the exact revision already pinned by Cargo.toml and Cargo.lock. Remove the temporary local URL rewrite and unpublished-revision instructions while retaining the immutable commit pin for reproducible builds.
Reset connections when epoll registration cannot be restored, and avoid
advancing receive accounting after monitoring has failed.

Own the vring completion worker so spawn failures are reported and teardown
closes the channel, drains pending completions, and joins the worker.

Normalize SPDX expressions and remove stale comments.
@vandycknick
vandycknick merged commit 8e50ddc into main Sep 1, 2026
9 checks passed
@vandycknick
vandycknick deleted the feat/adr15 branch September 1, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant