Repository navigation
Commit 5aa8b02
microVM: drain the boot console's terminal output at guest exit
A guest-requested exit drained portb's output and its host relay, and
then OpenVMM terminated the process. When --virtio-console console
attaches the boot console to the terminal, its relay copies the
anonymous pair to stdout on a thread of its own, which nothing awaited,
so the process could end before the relay wrote the output that the
guest had printed last. The guest's virtio-console driver waits until
the device completes each of its writes, and the device writes each
descriptor to the pair before completing it, so the output was already
in the pair; only the relay, waiting for the reactor to report it, was
behind. microsoft/nvx#549 moves NVX's interactive and test consoles to
the boot console, where a benchmark lost its completion marker at
nvx-exit.
The boot console's relay now takes drain requests. It holds a
non-blocking duplicate of its end of the pair, from which it reads what
the pair holds without waiting for the reactor, and writes and flushes
it before it answers. MicrovmOutputDrain asks it at a guest-requested
exit, after portb, within the same five-second deadline, and before a
guest-requested capture, whose source process ends once the snapshot
commits. Without a boot console on the terminal, nothing changes.
Tests: the exit drain writes the output that the reactor has yet to
report, which it lost before this change; the capture flush writes the
pending output and the relay keeps copying; a failed write fails the
drain; and on both Linux sockets and Windows pipes, the duplicate reads
a pair until it is empty without waiting for more.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent eda13d8 commit 5aa8b02
7 files changed
Lines changed: 408 additions & 37 deletions
File tree
- Guide/src/reference/openvmm/management
- openvmm/openvmm_entry
- src
- microvm
- ttrpc
- vm_controller
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1023 | 1023 | | |
1024 | 1024 | | |
1025 | 1025 | | |
1026 | | - | |
| 1026 | + | |
| 1027 | + | |
1027 | 1028 | | |
1028 | 1029 | | |
1029 | 1030 | | |
| |||
1144 | 1145 | | |
1145 | 1146 | | |
1146 | 1147 | | |
1147 | | - | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
1148 | 1152 | | |
1149 | 1153 | | |
1150 | 1154 | | |
1151 | 1155 | | |
1152 | | - | |
1153 | | - | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
1154 | 1159 | | |
1155 | 1160 | | |
1156 | 1161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| 83 | + | |
| 84 | + | |
81 | 85 | | |
82 | 86 | | |
83 | 87 | | |
| |||
224 | 228 | | |
225 | 229 | | |
226 | 230 | | |
| 231 | + | |
227 | 232 | | |
228 | 233 | | |
229 | 234 | | |
| |||
264 | 269 | | |
265 | 270 | | |
266 | 271 | | |
267 | | - | |
| 272 | + | |
268 | 273 | | |
269 | 274 | | |
270 | 275 | | |
271 | 276 | | |
272 | 277 | | |
273 | | - | |
| 278 | + | |
| 279 | + | |
274 | 280 | | |
275 | 281 | | |
276 | 282 | | |
| |||
320 | 326 | | |
321 | 327 | | |
322 | 328 | | |
323 | | - | |
| 329 | + | |
324 | 330 | | |
325 | 331 | | |
326 | 332 | | |
327 | 333 | | |
328 | 334 | | |
329 | 335 | | |
| 336 | + | |
330 | 337 | | |
331 | 338 | | |
332 | 339 | | |
| |||
407 | 414 | | |
408 | 415 | | |
409 | 416 | | |
410 | | - | |
| 417 | + | |
| 418 | + | |
411 | 419 | | |
412 | 420 | | |
413 | 421 | | |
| |||
856 | 864 | | |
857 | 865 | | |
858 | 866 | | |
859 | | - | |
| 867 | + | |
| 868 | + | |
860 | 869 | | |
861 | 870 | | |
862 | 871 | | |
863 | 872 | | |
864 | 873 | | |
865 | 874 | | |
866 | | - | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
867 | 880 | | |
868 | 881 | | |
869 | 882 | | |
870 | 883 | | |
871 | 884 | | |
872 | | - | |
| 885 | + | |
| 886 | + | |
873 | 887 | | |
874 | 888 | | |
875 | 889 | | |
876 | 890 | | |
877 | 891 | | |
878 | | - | |
879 | | - | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
880 | 895 | | |
881 | 896 | | |
882 | 897 | | |
883 | 898 | | |
884 | | - | |
| 899 | + | |
885 | 900 | | |
886 | 901 | | |
887 | 902 | | |
| |||
0 commit comments