Skip to content

wasm: make virtio console handoff explicit and reset-safe - #44

Merged
tombl merged 1 commit into
wasmfrom
wasm-virtio-console-handoff
Aug 8, 2026
Merged

wasm: make virtio console handoff explicit and reset-safe#44
tombl merged 1 commit into
wasmfrom
wasm-virtio-console-handoff

Conversation

@tombl

@tombl tombl commented Aug 8, 2026

Copy link
Copy Markdown
Owner

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

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
@tombl
tombl marked this pull request as ready for review August 8, 2026 14:09
@tombl
tombl merged commit c72012c into wasm Aug 8, 2026
1 check passed
@tombl
tombl deleted the wasm-virtio-console-handoff branch August 8, 2026 14:10
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