Repository navigation
Description
Objective
Bring the serial socket commits of feature/microvm/dev in line with microsoft/openvmm#4605, which review narrowed to the read path, keep the write-failure behavior that NVX's consoles rely on as a fork-only commit, and update the roadmap.
Background
Fork position 015 (92d6de98f, PR06) carries the first revision of microsoft/openvmm#4605: a failed write drops the socket and returns the error. It argued that the backend otherwise never reported the disconnect, which was true of virtio-console: without a guest receive buffer, it neither read nor polled poll_disconnect.
In review, jstarks proposed fixing virtio-console instead. microsoft/openvmm#4778 (df6f8884b), which every fork base since v2.4 includes, makes it poll poll_disconnect without a receive queue and while it waits for a receive buffer. microsoft/openvmm#4605 is now narrowed to the read path in 3f0ef5c71: a read error is traced, drops the socket, and is reported as EOF, while writes, flushes, and closes keep upstream's handling, which reports BrokenPipe as success and keeps the socket. The chain and the pull request therefore no longer share a change:
- The chain lacks the read fix. At the pin,
4713c539a, a read error is returned and the socket stays attached. On Windows the error is sticky, so the 16550 reconnects to the dead socket each time it is polled, and upstream's virtio-console retries the read whenever the guest has a receive buffer posted. NVX's own consumers cope: the direct console's disconnected state awaitspoll_disconnect, the broker detaches withdisconnect_current, and portb never reads. - NVX still needs the write-failure drop, for output rather than disconnects. On Linux, writing to an AF_UNIX peer that has closed fails with
EPIPE; against upstream's backend at the fork basec6d3da0ff, such writes returnedOkand the socket stayed connected. Windows reportsConnectionResetthere instead, which upstream returns. Two consumers depend on the failure:- The microVM boot console uses
VirtioConsoleDisconnectPolicy::Retainunless its attachment discards while disconnected. Its worker skips the transmit drain while disconnected and keepspartial_transmiton a failed write. If the write reported success, the worker could complete the guest's queued output before its receive side noticed the hangup, losing that output. - portb keeps its buffered output for the next peer only when a write fails with
BrokenPipe, which position 213 ([DO NOT REVIEW] microVM: remove portb's host input openvmm#4887) relies on to deliver it once the next peer connects.
- The microVM boot console uses
- Position 016 has the same split. serial_socket: keep Windows named-pipe listeners reconnectable openvmm#4609 drops a Windows named pipe on a failed write, flush, or close, and position 016 (
04c5b9465) on a failed write, while upstream's named-pipe backend also reportsBrokenPipewrites as successful. The reasoning that narrowed serial_socket: report read errors as EOF and drop the connection openvmm#4605 applies to that part of serial_socket: keep Windows named-pipe listeners reconnectable openvmm#4609 too, and aRetainconsole on a named pipe needs it for the same reason.
Work
- On
feature/microvm/dev, replace position 015 with two commits:- the read fix of serial_socket: report read errors as EOF and drop the connection openvmm#4605 at
3f0ef5c71, with its two tests, mapped to that pull request in PR06. Position 114 (f2dbfa315) adds a Linux-onlytestsmodule tonet.rs, so the two modules have to merge; - a fork-only commit that drops the socket and returns the error on a failed write, whose message gives the output-retention reason above rather than disconnect detection, with a Linux test that a write to an AF_UNIX peer that has closed fails and lets the listener accept a replacement client.
- the read fix of serial_socket: report read errors as EOF and drop the connection openvmm#4605 at
- Decide where the fork-only commit goes: with its consumers, the
Retainpolicy of PR13's position 046 and the portb console of PR15's position 064, or as an N-class commit. Decide the same for position 016's write handling, and narrow serial_socket: keep Windows named-pipe listeners reconnectable openvmm#4609 if its review raises the same question. - Promote the OpenVMM revision into NVX with the
nvx-openvmm-promoteworkflow. - Update
doc/openvmm-upstream-roadmap.md: PR06's entries and the open-pull-request table for positions 015 and 016, the new fork-only commit and its class, and a note for the rebase that lands serial_socket: report read errors as EOF and drop the connection openvmm#4605: drop only the read fix there and keep the write-failure drop, orRetainconsoles and portb start losing output on Linux.
Acceptance criteria
-
poll_readonfeature/microvm/devmatches serial_socket: report read errors as EOF and drop the connection openvmm#4605: a read error is traced, drops the socket, and is reported as EOF. - A failed write still drops the socket and returns the error, and a Linux test pins it for an AF_UNIX peer that has closed.
- A test shows that a
Retainconsole keeps the guest output written after its peer leaves and delivers it to the next peer. - The roadmap maps the read fix to serial_socket: report read errors as EOF and drop the connection openvmm#4605, classifies the write-failure drop, and carries the rebase note.
- Package-scoped OpenVMM checks of
serial_socket,virtio_console, andchipsetpass on Linux and Windows, through available hosts or CI, recording unavailable coverage explicitly.
Coordination
| Related work | Integration |
|---|---|
| microsoft/openvmm#4605 | Narrowed to the read path in 3f0ef5c71; the chain's read-fix commit tracks it and is dropped when it lands. |
| microsoft/openvmm#4778 | Merged as df6f8884b, in every fork base since v2.4; replaces the write-failure drop for disconnect detection. |
| microsoft/openvmm#4609 | Same write-failure drop for named pipes; may need the same narrowing. |
| microsoft/openvmm#4887 | Position 213; portb's output reaches the next peer only through a failed BrokenPipe write. |
Activity
openvmm: pin the serial socket's read fix and output retention tests