CVSROOT: /cvs Module name: src Changes by: d...@cvs.openbsd.org 2023/09/14 09:25:43
Modified files: usr.sbin/vmd : vioblk.c vioqcow2.c vioraw.c virtio.c virtio.h Log message: vmd(8)/vioblk: use zero-copy approach & vectored io. The original version of the virtio block device dynamically allocated buffers to hold intermediate data when reading or writing to the underlying disk fd(s). Since vioblk drivers may chain multiple segments together, this leads to overly complex logic and on read(2)/write(2) call per data segment. Additionally, the virtio block logic in vmd didn't handle segments that weren't block aligned (e.g. 512 bytes). If a guest provided unaligned segments, garbage will be read or written. Since virtio descriptors mimic iovec structures, this changes vmd's device emulation to use that model. (This is how other hypervisors emulate virtio devices.) This allows for zero-copy semantics using iovec's, reducing memcpy and multiple read/write syscalls per io transaction. Testing by phessler@ and mlarkin@. OK mlarkin@.