#
e497fe86 |
|
02-Apr-2024 |
Mark Johnston <markj@FreeBSD.org> |
bhyve: Use vm_get_highmem_base() instead of hard-coding the value This reduces the coupling between libvmmapi (which creates the highmem segment) and bhyve, in preparation for the arm64 port. No functional change intended. Reviewed by: corvink, jhb MFC after: 2 weeks Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40992
|
#
b831c773 |
|
29-Dec-2023 |
Vitaliy Gusev <gusev.vitaliy@gmail.com> |
bhyve: increase SNAPSHOT_BUFFER_SIZE After commit fb51ddb20d57, suspending a vm fails with the error: vm_snapshot_buf: buffer too small Sponsored by: vStack Reviewed by: markj, rew Fixes: fb51ddb20d57 ("bhyve: increase fbuf display resolution limit") Differential Revision: https://reviews.freebsd.org/D43218
|
#
4d65a7c6 |
|
24-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
usr.sbin: Automated cleanup of cdefs and other formatting Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
|
#
7de58287 |
|
17-Oct-2023 |
Vitaliy Gusev <gusev.vitaliy@gmail.com> |
bhyve: Remove init_snapshot() and initialize static vars vCPU threads are starting before init_snapshot() is called. That can lead to corruption of vcpu_lock userspace mutex (snapshot.c) and then VM hangs in acquiring that mutex. init_snapshot() initializes only static variables (mutex, cv) and that code can be optimized and removed. Fixes: 9a9a248964696 ("bhyve: init checkput before caph_enter") Reviewed by: markj MFC after: 1 week Sponsored by: vStack
|
#
b0936440 |
|
16-Oct-2023 |
John Baldwin <jhb@FreeBSD.org> |
bhyve: Replace many fprintf(stderr, ...) calls with EPRINTLN EPRINTLN handles newlines appropriately when stdout/stderr have been reused as the backend for a serial port. For bhyverun.c itself, the rule this attempts to follow is to use regular fprintf/perror/warn/err prior to init_pci() (which is when serial ports are configured) and to switch to EPRINTLN afterwards. Reviewed by: corvink, markj Differential Revision: https://reviews.freebsd.org/D42182
|
#
145ffd5d |
|
03-Oct-2023 |
Mark Johnston <markj@FreeBSD.org> |
bhyve: Remove some unneeded includes from snapshot.c MFC after: 1 week Sponsored by: Innovate UK
|
#
4fe5b70c |
|
03-Oct-2023 |
Mark Johnston <markj@FreeBSD.org> |
bhyve: Move more amd64-specific code under amd64/ mptable and the e820 are both rather amd64-specific and can be moved easily. In the case of e820, move the registration with qemu_fwcfg into e820.c, as it simplifies bhyverun.c a bit and I can't see any downsides. No functional change intended. Reviewed by: corvink, jhb, emaste MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40552
|
#
f927afc1 |
|
03-Oct-2023 |
Mark Johnston <markj@FreeBSD.org> |
bhyve: Move some more amd64-specific drivers to their own subdir No functional change intended. Reviewed by: corvink, jhb, emaste MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40551
|
#
4f2bd402 |
|
03-Oct-2023 |
Mark Johnston <markj@FreeBSD.org> |
bhyve: Start moving machine-dependent code into subdirectories In preparation for an arm64 port, make an easy change which puts some machine-dependent code in its own directory. Going forward, code which is only used on one platform should live in a MD directory. We should strive to layer modules in such a way as to avoid polluting shared code with lots of ifdefs. For some existing files this will take some effort. task_switch.c and fwctl.c are an easy place to start: the former is very x86-specific, and the latter provides an I/O port interface which can't be used on anything other than x86. (fwcfg as implemented has the same problem, but QEMU also supports a MMIO fwcfg interface.) So I propose that we start by simply making those files conditional. Reviewed by: corvink, jhb MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40501
|
#
1d386b48 |
|
16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: one-line .c pattern Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
#
1e8d0c6c |
|
21-Jun-2023 |
Corvin Köhne <corvink@FreeBSD.org> |
Revert "bhyve: add command line parameter and parsing for migration" Unfortunately, this feature didn't receive much feedback in the past. However, after committing this, some people came up and complain that this feature requires some more discussion before upstreaming it. Additionally, it wasn't a good idea to start this new feature by adding a new command line parameter as it fixes the user interface. This reverts commit c9fdd4f3cc18c03683de85318ba8d318f96b58c4.
|
#
6d1dfc87 |
|
08-Jun-2023 |
Mark Johnston <markj@FreeBSD.org> |
bhyve: Remove some unneeded includes of segments.h They are not needed and are specific to x86. No functional change intended. MFC after: 1 week Sponsored by: Innovate UK
|
#
c9fdd4f3 |
|
19-Jun-2023 |
Mihai Burcea <mihaiburcea15@gmail.com> |
bhyve: add command line parameter and parsing for migration This covers warm and live migration. Reviewed by: corvink MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D34717
|
#
381ef27d |
|
15-May-2023 |
Vitaliy Gusev <gusev.vitaliy@gmail.com> |
bhyve: use pci_next() to save/restore pci devices Current snapshot implementation doesn't support multiple devices with similar type. For example, two virtio-blk or two CD-ROM-s, etc. So the following configuration cannot be restored. bhyve \ -s 3,virtio-blk,disk.img \ -s 4,virtio-blk,disk2.img In some cases it is restored silently, but doesn't work. In some cases it fails during restore stage. This commit fixes that issue. Reviewed by: corvink, rew MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D40109
|
#
b10d65a4 |
|
15-May-2023 |
Vitaliy Gusev <gusev.vitaliy@gmail.com> |
bhyve: rename 'user_dev' with 'devices' Bhyve don't use 'user' specifier for emulated devices. And using 'user' adds duality. Reviewed by: corvink, rew MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D40106
|
#
ee5023f3 |
|
15-May-2023 |
Vitaliy Gusev <gusev.vitaliy@gmail.com> |
bhyve: simplify restore of kernel structs Both devices and kernel struct can use the same 'lookup_dev' function instead of having duplicated code. Reviewed by: corvink, rew MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D40105
|
#
50aef9f6 |
|
15-May-2023 |
Vitaliy Gusev <gusev.vitaliy@gmail.com> |
bhyve: rename 'structs' snapshot key with 'kern_structs' Using key 'structs' is ambiguous. This section contains data related to the kernel. It should use a more informative naming. Reviewed by: corvink, rew MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D40104
|
#
4d846d26 |
|
10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
|
#
18126b64 |
|
28-Apr-2023 |
Vitaliy Gusev <gusev.vitaliy@gmail.com> |
bhyve: use directory file descriptor for checkpoint This is required to enable capsicum for the snapshot code. Reviewed by: corvink Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D38858
|
#
0f735657 |
|
24-Mar-2023 |
John Baldwin <jhb@FreeBSD.org> |
bhyve: Remove vmctx member from struct vm_snapshot_meta. This is a userland-only pointer that isn't relevant to the kernel and doesn't belong in the ioctl structure shared between userland and the kernel. For the kernel, the old structure for the ioctl is still supported under COMPAT_FREEBSD13. This changes vm_snapshot_req() in libvmmapi to accept an explicit vmctx argument. It also changes vm_snapshot_guest2host_addr to take an explicit vmctx argument. As part of this change, move the declaration for this function and its wrapper macro from vmm_snapshot.h to snapshot.h as it is a userland-only API. Reviewed by: corvink, markj Differential Revision: https://reviews.freebsd.org/D38125
|
#
7d9ef309 |
|
24-Mar-2023 |
John Baldwin <jhb@FreeBSD.org> |
libvmmapi: Add a struct vcpu and use it in most APIs. This replaces the 'struct vm, int vcpuid' tuple passed to most API calls and is similar to the changes recently made in vmm(4) in the kernel. struct vcpu is an opaque type managed by libvmmapi. For now it stores a pointer to the VM context and an integer id. As an immediate effect this removes the divergence between the kernel and userland for the instruction emulation code introduced by the recent vmm(4) changes. Since this is a major change to the vmmapi API, bump VMMAPI_VERSION to 0x200 (2.0) and the shared library major version. While here (and since the major version is bumped), remove unused vcpu argument from vm_setup_pptdev_msi*(). Add new functions vm_suspend_all_cpus() and vm_resume_all_cpus() for use by the debug server. The underyling ioctl (which uses a vcpuid of -1) remains unchanged, but the userlevel API now uses separate functions for global CPU suspend/resume. Reviewed by: corvink, markj Differential Revision: https://reviews.freebsd.org/D38124
|
#
577ddca9 |
|
05-Mar-2023 |
Vitaliy Gusev <gusev.vitaliy@gmail.com> |
bhyve: add cap limits for ipc socket Reviewed by: corvink, markj MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D38856
|
#
8104fc31 |
|
28-Feb-2023 |
Vitaliy Gusev <gusev.vitaliy@gmail.com> |
bhyve: fix restore of kernel structs vmx_snapshot() and svm_snapshot() do not save any data and error occurs at resume: Restoring kernel structs... vm_restore_kern_struct: Kernel struct size was 0 for: vmx Failed to restore kernel structs. Reviewed by: corvink, markj Fixes: 39ec056e6dbd89e26ee21d2928dbd37335de0ebc ("vmm: Rework snapshotting of CPU-specific per-vCPU data.") MFC after: 2 weeks Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D38476
|
#
6a284cac |
|
19-Jan-2023 |
John Baldwin <jhb@FreeBSD.org> |
bhyve: Remove vmctx argument from PCI device model methods. Most of these arguments were unused. Device models which do need access to the vmctx in one of these methods can obtain it from the pi_vmctx member of the pci_devinst argument instead. Reviewed by: corvink, markj Differential Revision: https://reviews.freebsd.org/D38096
|
#
8b1adff8 |
|
11-Nov-2022 |
Mark Johnston <markj@FreeBSD.org> |
bhyve: Drop volatile qualifiers from snapshot code They accomplish nothing since the qualifier is casted away in calls to memcpy() and copyin()/copyout(). No functional change intended. MFC after: 2 weeks Reviewed by: corvink, jhb Differential Revision: https://reviews.freebsd.org/D37292
|
#
ed721684 |
|
23-Oct-2022 |
Mark Johnston <markj@FreeBSD.org> |
bhyve: Address some signed/unsigned comparison warnings MFC after: 1 week
|
#
c9faf698 |
|
22-Oct-2022 |
Mark Johnston <markj@FreeBSD.org> |
bhyve: Fix some warnings in the snapshot code - Qualify unexported symbols with "static". - Drop some unnecessary and incorrect casts. - Avoid arithmetic on void pointers. - Avoid signed/unsigned comparisons in loops which use nitems() as a bound. No functional change intended. MFC after: 1 week
|
#
63898728 |
|
22-Oct-2022 |
Mark Johnston <markj@FreeBSD.org> |
bhyve: Avoid arithmetic on void pointers No functional change intended. MFC after: 1 week
|
#
98d920d9 |
|
08-Oct-2022 |
Mark Johnston <markj@FreeBSD.org> |
bhyve: Annotate unused function parameters MFC after: 1 week
|
#
690b7ea0 |
|
28-Apr-2022 |
Robert Wing <rew@FreeBSD.org> |
bhyve/snapshot: ..back to SOCK_STREAM Now that nvlist_send()/nvlist_recv() are being used, ditch the datagram socket. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D34863
|
#
c79331a4 |
|
09-Apr-2022 |
Robert Wing <rew@FreeBSD.org> |
bhyve: use linker set for ipc commands Reviewed by: markj, jhb Differential Revision: https://reviews.freebsd.org/D34760
|
#
3ebe1109 |
|
17-Mar-2022 |
Robert Wing <rew@FreeBSD.org> |
bhyve: sweep MAX_VMNAME MAX_VMNAME is no longer used. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D34292
|
#
961e6a12 |
|
17-Mar-2022 |
Robert Wing <rew@FreeBSD.org> |
bhyve/snapshot: limit snapshot filename to NAME_MAX NAME_MAX is a better fit since strcat_extension() constructs the filename of the snapshot file. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D34291
|
#
3efc45f3 |
|
17-Mar-2022 |
Robert Wing <rew@FreeBSD.org> |
libvmm: constify vm_get_name() Allows callers of vm_get_name() to retrieve the vm name without having to allocate a buffer. While in the vicinity, do minor cleanup in vm_snapshot_basic_metadata(). Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D34290
|
#
4379c1da |
|
15-Feb-2022 |
Robert Wing <rew@FreeBSD.org> |
bhyve/snapshot: use a string for cmd element in the nvlist The nvlist for a checkpoint request will now look like: { cmd="checkpoint", suspend="true/false", filename="afilename" } Reviewed by: jhb Suggested by: jhb Differential Revision: https://reviews.freebsd.org/D34237
|
#
edfb339d |
|
09-Feb-2022 |
Robert Wing <rew@FreeBSD.org> |
bhyve/snapshot: switch to nvlist for snapshot requests Switch to using an nvlist with nvlist_send()/nvlist_recv() to communicate from bhyvectl(8) to bhyve(8). The idea is that a bhyve process receives a command with with a set of arguments. The nvlist here is structured to reflect that premise. For example, to snapshot the vm, the expected nvlist looks like: { cmd=START_CHECKPOINT, filename="filename" } Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D33977
|
#
51fbd894 |
|
19-Jan-2022 |
Robert Wing <rew@FreeBSD.org> |
bhyve/snapshot: fix pthread_create() error check pthread_create() returns 0 on success or an error number on failure. Reviewed by: khng, markj Differential Revision: https://reviews.freebsd.org/D33930
|
#
fdbc86cf |
|
15-May-2021 |
Robert Wing <rew@FreeBSD.org> |
bhyve/snapshot: split up mutex/cond initialization from socket creation Move initialization of the mutex/condition variables required by the save/restore feature to their own function. The unix domain socket that facilitates communication between bhyvectl and bhyve doesn't rely on these variables in order to be functional. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D30281
|
#
d4870e3a |
|
02-Mar-2021 |
Robert Wing <rew@FreeBSD.org> |
bhyve/snapshot: provide a way to send other messages/data to bhyve This is a step towards sending messages (other than suspend/checkpoint) from bhyvectl to bhyve. Introduce a new struct, ipc_message - this struct stores the type of message and a union containing message specific structures for the type of message being sent. Reviewed by: grehan Differential Revision: https://reviews.freebsd.org/D30221
|
#
38dfb062 |
|
07-Mar-2021 |
Robert Wing <rew@FreeBSD.org> |
bhyve/snapshot: use SOCK_DGRAM instead of SOCK_STREAM The save/restore feature uses a unix domain socket to send messages from bhyvectl(8) to a bhyve(8) process. A datagram socket will suffice for this. An added benefit of using a datagram socket is simplified code. For bhyve, the listen/accept calls are dropped; and for bhyvectl, the connect() call is dropped. EPRINTLN handles raw mode for bhyve(8), use it to print error messages. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D28983
|
#
5ce2d4a1 |
|
18-Feb-2021 |
Robert Wing <rew@FreeBSD.org> |
bhyve/snapshot: drop mkdir when creating the unix domain socket Add /var/run/bhyve/ to BSD.var.dist so we don't have to call mkdir when creating the unix domain socket for a given bhyve vm. The path to the unix domain socket for a bhyve vm will now be /var/run/bhyve/vmname instead of /var/run/bhyve/checkpoint/vmname Move BHYVE_RUN_DIR from snapshot.c to snapshot.h so it can be shared to bhyvectl(8). Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D28783
|
#
c4df8cbf |
|
23-Dec-2020 |
Robert Wing <rew@FreeBSD.org> |
Remove bvmconsole and bvmdebug. Now that bhyve(8) supports UART, bvmconsole and bvmdebug are no longer needed. This also removes the '-b' and '-g' flag from bhyve(8). These two flags were marked deprecated in r368519. Reviewed by: grehan, kevans Approved by: kevans (mentor) Differential Revision: https://reviews.freebsd.org/D27490
|
#
1b9c7861 |
|
27-Nov-2020 |
John Baldwin <jhb@FreeBSD.org> |
Suspend I/O on ahci-cd devices during a snapshot. Submitted by: Vitaliy Gusev <gusev.vitaliy@gmail.com>
|
#
bb481f67 |
|
27-Nov-2020 |
John Baldwin <jhb@FreeBSD.org> |
bhyve: Add snapshot support for virtio-rnd. This uses the same snapshot routine as other VirtIO devices. Submitted by: Vitaliy Gusev <gusev.vitaliy@gmail.com> Differential Revision: https://reviews.freebsd.org/D26265
|
#
483d953a |
|
04-May-2020 |
John Baldwin <jhb@FreeBSD.org> |
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
|