wasm: make virtio console handoff explicit and reset-safe - #44
Merged
Conversation
The host previously delivered stdin as soon as receive descriptors appeared, but Linux queues those descriptors before the console port is connected and intentionally discards data received in that window. Single-port virtio-console provides no guest-open notification, so descriptor availability is not a sufficient readiness signal. Advertise a one-port multiport console and gate input on the guest PORT_OPEN message. Implement the DEVICE_READY, PORT_ADD, PORT_READY, CONSOLE_PORT, RESIZE, and PORT_OPEN state machine synchronously, including scatter/gather control buffers and multiport resize notifications. No timers or pacing are used. Also propagate virtio reset from the wasm transport to host devices. Packed queues are invalidated so stale chains and pending kicks cannot survive reset, while console and network backends retain host-side pending data for restored guest queues. Validation: - TypeScript checks - 14/14 device tests, repeated ten times - immediate launch-time stdin and virtiofs shares integration tests - runner lifecycle suite - 60/60 four-CPU lifecycle stress runs, plus three- and eight-CPU smoke tests Agent-Session: codex:019fe115-244a-76c1-b716-b8af6827da00
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.
The host previously delivered stdin as soon as receive descriptors appeared, but Linux queues those descriptors before the console port is connected and intentionally discards data received in that window. Single-port virtio-console provides no guest-open notification, so descriptor availability is not a sufficient readiness signal.
Advertise a one-port multiport console and gate input on the guest PORT_OPEN message. Implement the DEVICE_READY, PORT_ADD, PORT_READY, CONSOLE_PORT, RESIZE, and PORT_OPEN state machine synchronously, including scatter/gather control buffers and multiport resize notifications. No timers or pacing are used.
Also propagate virtio reset from the wasm transport to host devices. Packed queues are invalidated so stale chains and pending kicks cannot survive reset, while console and network backends retain host-side pending data for restored guest queues.
Validation:
Agent-Session: codex:019fe115-244a-76c1-b716-b8af6827da00