OpenBSD CVS

CVS log for src/usr.sbin/vmd/vioraw.c


[BACK] Up to [local] / src / usr.sbin / vmd

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.11 / (download) - annotate - [select for diffs], Thu Sep 14 15:25:43 2023 UTC (8 months, 2 weeks ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.10: +15 -1 lines
Diff to previous 1.10 (colored)

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@.

Revision 1.10 / (download) - annotate - [select for diffs], Sun May 28 05:28:50 2023 UTC (12 months ago) by asou
Branch: MAIN
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored)

Used number of bytes instead of number of 512 byte sectors.

ok dv@

Revision 1.9 / (download) - annotate - [select for diffs], Thu Apr 27 22:47:27 2023 UTC (13 months ago) by dv
Branch: MAIN
Changes since 1.8: +4 -3 lines
Diff to previous 1.8 (colored)

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@

Revision 1.8 / (download) - annotate - [select for diffs], Sun Apr 16 12:52:54 2023 UTC (13 months, 2 weeks ago) by dv
Branch: MAIN
Changes since 1.7: +7 -8 lines
Diff to previous 1.7 (colored)

vmd(8): correct comment in vioraw, cleanup formatting.

Comment incorrectly mentioned returning sectors when this function
returns bytes; the logic in virtio.c computes the number of 512
byte sectors after calling virtio_raw_init.

While here, adjust the formatting of return's to match the rest of vmd.

No functional change.

Revision 1.7 / (download) - annotate - [select for diffs], Wed May 4 23:17:25 2022 UTC (2 years ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.6: +4 -4 lines
Diff to previous 1.6 (colored)

vmctl(8)/vmd(8): convert disk sizes from MB to bytes

Continue converting other parts to storing data in bytes instead
of MB. In this case, the logic for disk sizes was being scaled.

This fixes issues reported by Martin Vahlensieck where vmctl could
no longer create disks larger than 7 MiB after previous commits to
change storing memory sizes as bytes.

While this keeps the vm memory limit check in vmctl's size parser,
it skips the limit check for disks. The error messages adjust
accordingly and this removes the double error message logging.

Update comments and function types accordingly.

ok marlkin@

Revision 1.6 / (download) - annotate - [select for diffs], Wed Jun 16 16:55:02 2021 UTC (2 years, 11 months ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.5: +1 -6 lines
Diff to previous 1.5 (colored)

cleanup vmd(8) includes and header files

Lots of organic growth other the years lead to unnecessary includes
(proc.h everywhere) and odd dependencies between header files. This
cleans things up a bit to help with upcoming cleanup around dhcp
code.

No functional change.

"go for it" mlarkin@

Revision 1.5 / (download) - annotate - [select for diffs], Mon Nov 26 10:39:30 2018 UTC (5 years, 6 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.4: +41 -2 lines
Diff to previous 1.4 (colored)

Move the {qcow2,raw} create functions from vmctl into vmd/vio{qcow2,raw}.c

This way they are in the appropriate place and code can be shared with vmd.

Ok ori@ mlarkin@ ccardenas@

Revision 1.4 / (download) - annotate - [select for diffs], Mon Oct 8 16:32:01 2018 UTC (5 years, 7 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.3: +6 -4 lines
Diff to previous 1.3 (colored)

Add support for qcow2 base images (external snapshots).

This works is from Ori Bernstein, committing on his behalf:

Add support to vmd for external snapshots. That is, snapshots that are
derived from a base image. Data lookups start in the derived image,
and if the derived image does not contain some data, the search
proceeds ot the base image.  Multiple derived images may exist off of
a single base image.

A limitation of this format is that modifying the base image will
corrupt the derived image.

This change also adds support for creating disk derived disk images to
vmctl.  To use it:

	vmctl create derived.qcow2 -s 16G -b base.qcow2

From Ori Bernstein
OK mlarkin@ reyk@

Revision 1.3 / (download) - annotate - [select for diffs], Fri Sep 28 12:35:32 2018 UTC (5 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.2: +4 -3 lines
Diff to previous 1.2 (colored)

Support vmd-internal's vmboot with qcow2 disk images.

OK mlarkin@

Revision 1.2 / (download) - annotate - [select for diffs], Wed Sep 19 04:29:21 2018 UTC (5 years, 8 months ago) by ccardenas
Branch: MAIN
Changes since 1.1: +3 -1 lines
Diff to previous 1.1 (colored)

Various clean up items for disks.

- qcow2: general cleanup
- vioraw: check malloc
- virtio: add function to sync disks
- vm: call virtio_shutdown to sync disks when vm is finished executing

Thanks to Ori Bernstein.

Ok miko@

Revision 1.1 / (download) - annotate - [select for diffs], Sat Aug 25 04:16:09 2018 UTC (5 years, 9 months ago) by ccardenas
Branch: MAIN

Rework disks to have pluggable backends.

This is prep work for adding qcow2 image support.

From Ori Bernstein.  Many thanks!

Tested by many.

OK ccardenas@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.