Up to [local] / src / usr.sbin / vmd
Request diff between arbitrary revisions
Default branch: MAIN
Revision 1.14 / (download) - annotate - [select for diffs], Thu Feb 22 02:38:53 2024 UTC (3 months, 2 weeks ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE,
OPENBSD_7_5,
HEAD
Changes since 1.13: +6 -10 lines
Diff to previous 1.13 (colored)
vmd(8): only add vionet tap read events after a notify event. My recent refactor introduced a bug where the vionet device will add the tap(4) read event on an unpause regardless of driver and device state, causing the cpu to peg as the read event fires indefinitely because the guest's virtqueue isn't ready to receive the data. Add in a global flag that tracks if the rx-side is enabled or not to coordinate adding the tap read event. ok mlarkin@
Revision 1.13 / (download) - annotate - [select for diffs], Tue Feb 20 21:40:37 2024 UTC (3 months, 2 weeks ago) by dv
Branch: MAIN
Changes since 1.12: +413 -102 lines
Diff to previous 1.12 (colored)
Utilize separate threads for RX and TX in vmd(8)'s vionet. This commit adds multithreading to allow both virtqueues to be processed in parallel along with additional synchronization primitives to protect device configuration state. Allowing RX and TX to operate independently reduces overall network latency for guests and helps alleviate the TX side dominating cpu time. Tested with help from phessler@, kn@, and mlarkin@. ok mlarkin@.
Revision 1.12 / (download) - annotate - [select for diffs], Sat Feb 10 02:19:12 2024 UTC (3 months, 4 weeks ago) by dv
Branch: MAIN
Changes since 1.11: +4 -3 lines
Diff to previous 1.11 (colored)
Fix locked address interfaces in vmd(8). Before comparing the amount of bytes read to the size of a packet struct, make sure the fd being read was actually the packet injection pipe(2). Locked address interfaces force using the same copy-based approach used for the internal dhcp service for "local" interfaces but were accidentally being treated as reads from the pipe(2) and not the tap. This broke networking for any locked address interfaces in vmd(8). Reported by and ok kn@
Revision 1.11 / (download) - annotate - [select for diffs], Fri Feb 9 14:52:39 2024 UTC (4 months ago) by dv
Branch: MAIN
Changes since 1.10: +4 -3 lines
Diff to previous 1.10 (colored)
Only debug log dhcp packet info if packet is found. No functional change. vmd(8) was being chatty and incorrect.
Revision 1.10 / (download) - annotate - [select for diffs], Mon Feb 5 21:58:09 2024 UTC (4 months ago) by dv
Branch: MAIN
Changes since 1.9: +1 -6 lines
Diff to previous 1.9 (colored)
Cleanup fcntl(3) usage and fd lifetimes in vmd(8). Remove extraneous fcntl(3) usage for setting fd features that can be set at time of open(2), pipe2(2), or socketpair(2). Also cleans up pty creation switching to using functions from libutil instead of direct ioctl(2) calls. ok mlarkin@, original diff ok claudio@ as well.
Revision 1.9 / (download) - annotate - [select for diffs], Sat Feb 3 21:41:35 2024 UTC (4 months ago) by dv
Branch: MAIN
Changes since 1.8: +10 -11 lines
Diff to previous 1.8 (colored)
Add tap(4) read events after rx virtqueue notification. The recent vmd(8) vionet refactor caused cpu spinning when the device would be activated by a driver but before virtqueues were provided. (e.g. booting a ramdisk kernel and not running `ifconfig vio0 up`) Defer adding the tap and packet injection read events until after the first RX queue notification from the driver. ok mlarkin@
Revision 1.8 / (download) - annotate - [select for diffs], Tue Jan 30 23:01:49 2024 UTC (4 months, 1 week ago) by dv
Branch: MAIN
Changes since 1.7: +442 -294 lines
Diff to previous 1.7 (colored)
Rewrite vmd(8)'s vionet to be zero-copy. Similar to the rewrite of the virtio block device to use zero-copy semantics, this rewrites how the virtio network device works with the virtqueue ring buffers to minimize data copying. For guests that don't use the built-in DNS and mac filtering capabilities, data can now be transfered to/from the virtqueue and the tap(4) directly without temporary buffers. A lot of the virtio semantics are cleaned up as well, including proper error states. Tested with help by mbuhl@, friehm@, mlarkin@, and others. "go for it," mlarkin@
Revision 1.7 / (download) - annotate - [select for diffs], Wed Jan 3 03:14:16 2024 UTC (5 months, 1 week ago) by dv
Branch: MAIN
Changes since 1.6: +2 -6 lines
Diff to previous 1.6 (colored)
vmd(8): remove unused variable from vionet_notify_tx. num_enq was assigned and incremented, but never used. clang started pointing out via warnings. No functional change.
Revision 1.6 / (download) - annotate - [select for diffs], Tue Sep 26 01:53:54 2023 UTC (8 months, 2 weeks ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE,
OPENBSD_7_4
Changes since 1.5: +9 -4 lines
Diff to previous 1.5 (colored)
vmd(8): disambiguate log messages per vm and device. The logging output from vmd(8) often specifies the function performing the logging, but leaves which vm or vm device to guesswork and reading tea leaves. Change the logging formatting to prefix with information about the specific vm and potentially the device subprocess. Most of this logging is behind the "verbose" mode, but for warnings this will clarify which vm or device logged the warning. The format of vm/<name>/<device><index> is chosen to be concise and less ugly than other approaches. This adjusts the process naming for devices to match, dropping the use of brackets. In the process of this change, updating log settings dynamically via vmctl(8) is fixed by properly broadcasting that information to the device subprocesses. The "vmm" process also now updates its own state properly, so settings survive vm reboots. ok mlarkin@
Revision 1.5 / (download) - annotate - [select for diffs], Sat Sep 23 12:31:41 2023 UTC (8 months, 2 weeks ago) by dv
Branch: MAIN
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)
vmd(8): correct log messages, no functional change. Some log messages incorrectly said "vionet" or "vioblk". Fix based on the context.
Revision 1.4 / (download) - annotate - [select for diffs], Fri Sep 1 19:42:26 2023 UTC (9 months, 1 week ago) by dv
Branch: MAIN
Changes since 1.3: +9 -5 lines
Diff to previous 1.3 (colored)
vmd(8): ignore masks on asserts, use synchronous deasserts. The i8259 was considering the state of the mask register when a device requested raising the bit in the interrupt request register. This caused a race condition where if the virtio device asserted the irq while it was masked in the i8259 by the vm, we'd miss the interrupt request. The device and the pic would become out of sync and users reported virtio block device stalls as the vioblk(4) driver would starve, waiting for an interrupt that will never arrive. The mask is now considered only at ack time, when finding possible interrupts to inject. This bug was never a problem previously as virtio devices were emulated synchronously. Deasserts related to the vcpu reading the virtio isr register are also made now in response to the read request instead of issued asynchronously. This removes a subsequent race condition. Testing from mbuhl@, stsp@, and Florian Riehm. ok mlarkin@
Revision 1.3 / (download) - annotate - [select for diffs], Sat May 13 23:15:28 2023 UTC (12 months, 4 weeks ago) by dv
Branch: MAIN
Changes since 1.2: +21 -8 lines
Diff to previous 1.2 (colored)
vmm(4)/vmd(8): switch to anonymous shared mappings. While splitting out emulated virtio network and block devices into separate processes, I originally used named mappings via shm_mkstemp(3). While this functionally achieved the desired result, it had two unintended consequences: 1) tearing down a vm process and its child processes required excessive locking as the guest memory was tied into the VFS layer. 2) it was observed by mlarkin@ that actions in other parts of the VFS layer could cause some of the guest memory to flush to storage, possibly filling /tmp. This commit adds a new vmm(4) ioctl dedicated to allowing a process request the kernel share a mapping of guest memory into its own vm space. This requires an open fd to /dev/vmm (requiring root) and both the "vmm" and "proc" pledge(2) promises. In addition, the caller must know enough about the original memory ranges to reconstruct them to make the vm's ranges. Tested with help from Mischa Peters. ok mlarkin@
Revision 1.2 / (download) - annotate - [select for diffs], Fri Apr 28 18:52:22 2023 UTC (13 months, 1 week ago) by dv
Branch: MAIN
Changes since 1.1: +1 -3 lines
Diff to previous 1.1 (colored)
Remove unneeded header includes in vmd. No functional change. virtio block/networking emulation do not need to know about vmm or any kernel types.
Revision 1.1 / (download) - annotate - [select for diffs], Thu Apr 27 22:47:27 2023 UTC (13 months, 2 weeks ago) by dv
Branch: MAIN
vmd(8): introduce multi-process model for virtio devices. Isolate virtio network and block device emulation in dedicated processes, forked and exec'd from the vm process. This allows for tightening pledge promises to just "stdio". Communication between the vcpu's and these devices now occurs via imsg channels, which adds the benefit of not always blocking the vcpu thread while emulating the device. With this commit, it's possible that vmd is the first open source hypervisor that *defaults* to a multi-process device emulation model without requiring any additional configuration from the operator. Testing help from phessler@ and Mischa Peters. ok mlarkin@