]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Initial support for bhyve save and restore.
authorJohn Baldwin <jhb@FreeBSD.org>
Tue, 5 May 2020 00:02:04 +0000 (00:02 +0000)
committerJohn Baldwin <jhb@FreeBSD.org>
Tue, 5 May 2020 00:02:04 +0000 (00:02 +0000)
commit483d953a86a2507355f8287c5107dc827a0ff516
treeb74b1559959b80cd48bffb9763b67959fd4c182b
parent51a5392297a7a014b1cf367922359cd54fb7a393
Initial support for bhyve save and restore.

Save and restore (also known as suspend and resume) permits a snapshot
to be taken of a guest's state that can later be resumed.  In the
current implementation, bhyve(8) creates a UNIX domain socket that is
used by bhyvectl(8) to send a request to save a snapshot (and
optionally exit after the snapshot has been taken).  A snapshot
currently consists of two files: the first holds a copy of guest RAM,
and the second file holds other guest state such as vCPU register
values and device model state.

To resume a guest, bhyve(8) must be started with a matching pair of
command line arguments to instantiate the same set of device models as
well as a pointer to the saved snapshot.

While the current implementation is useful for several uses cases, it
has a few limitations.  The file format for saving the guest state is
tied to the ABI of internal bhyve structures and is not
self-describing (in that it does not communicate the set of device
models present in the system).  In addition, the state saved for some
device models closely matches the internal data structures which might
prove a challenge for compatibility of snapshot files across a range
of bhyve versions.  The file format also does not currently support
versioning of individual chunks of state.  As a result, the current
file format is not a fixed binary format and future revisions to save
and restore will break binary compatiblity of snapshot files.  The
goal is to move to a more flexible format that adds versioning,
etc. and at that point to commit to providing a reasonable level of
compatibility.  As a result, the current implementation is not enabled
by default.  It can be enabled via the WITH_BHYVE_SNAPSHOT=yes option
for userland builds, and the kernel option BHYVE_SHAPSHOT.

Submitted by: Mihai Tiganus, Flavius Anton, Darius Mihai
Submitted by: Elena Mihailescu, Mihai Carabas, Sergiu Weisz
Relnotes: yes
Sponsored by: University Politehnica of Bucharest
Sponsored by: Matthew Grooms (student scholarships)
Sponsored by: iXsystems
Differential Revision: https://reviews.freebsd.org/D19495
71 files changed:
lib/libvmmapi/vmmapi.c
lib/libvmmapi/vmmapi.h
share/man/man5/src.conf.5
share/mk/src.opts.mk
sys/amd64/include/vmm.h
sys/amd64/include/vmm_dev.h
sys/amd64/include/vmm_snapshot.h [new file with mode: 0644]
sys/amd64/vmm/amd/svm.c
sys/amd64/vmm/amd/svm.h
sys/amd64/vmm/amd/svm_msr.c
sys/amd64/vmm/amd/vmcb.c
sys/amd64/vmm/amd/vmcb.h
sys/amd64/vmm/intel/vmcs.c
sys/amd64/vmm/intel/vmcs.h
sys/amd64/vmm/intel/vmx.c
sys/amd64/vmm/io/vatpic.c
sys/amd64/vmm/io/vatpic.h
sys/amd64/vmm/io/vatpit.c
sys/amd64/vmm/io/vatpit.h
sys/amd64/vmm/io/vhpet.c
sys/amd64/vmm/io/vhpet.h
sys/amd64/vmm/io/vioapic.c
sys/amd64/vmm/io/vioapic.h
sys/amd64/vmm/io/vlapic.c
sys/amd64/vmm/io/vlapic.h
sys/amd64/vmm/io/vpmtmr.c
sys/amd64/vmm/io/vpmtmr.h
sys/amd64/vmm/io/vrtc.c
sys/amd64/vmm/io/vrtc.h
sys/amd64/vmm/vmm.c
sys/amd64/vmm/vmm_dev.c
sys/amd64/vmm/vmm_snapshot.c [new file with mode: 0644]
sys/conf/config.mk
sys/conf/kern.opts.mk
sys/conf/options.amd64
sys/modules/vmm/Makefile
tools/build/options/WITH_BHYVE_SNAPSHOT [new file with mode: 0644]
usr.sbin/bhyve/Makefile
usr.sbin/bhyve/Makefile.depend
usr.sbin/bhyve/atkbdc.c
usr.sbin/bhyve/atkbdc.h
usr.sbin/bhyve/bhyve.8
usr.sbin/bhyve/bhyverun.c
usr.sbin/bhyve/bhyverun.h
usr.sbin/bhyve/block_if.c
usr.sbin/bhyve/block_if.h
usr.sbin/bhyve/mevent.c
usr.sbin/bhyve/pci_ahci.c
usr.sbin/bhyve/pci_e82545.c
usr.sbin/bhyve/pci_emul.c
usr.sbin/bhyve/pci_emul.h
usr.sbin/bhyve/pci_fbuf.c
usr.sbin/bhyve/pci_lpc.c
usr.sbin/bhyve/pci_virtio_block.c
usr.sbin/bhyve/pci_virtio_net.c
usr.sbin/bhyve/pci_xhci.c
usr.sbin/bhyve/ps2kbd.c
usr.sbin/bhyve/ps2kbd.h
usr.sbin/bhyve/ps2mouse.c
usr.sbin/bhyve/ps2mouse.h
usr.sbin/bhyve/snapshot.c [new file with mode: 0644]
usr.sbin/bhyve/snapshot.h [new file with mode: 0644]
usr.sbin/bhyve/uart_emul.c
usr.sbin/bhyve/uart_emul.h
usr.sbin/bhyve/usb_emul.h
usr.sbin/bhyve/usb_mouse.c
usr.sbin/bhyve/virtio.c
usr.sbin/bhyve/virtio.h
usr.sbin/bhyvectl/Makefile
usr.sbin/bhyvectl/bhyvectl.8
usr.sbin/bhyvectl/bhyvectl.c