]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
17 months agovmm: VM_GET/SET_KERNEMU_DEV should run with the vCPU locked.
John Baldwin [Fri, 9 Dec 2022 18:25:30 +0000 (10:25 -0800)]
vmm: VM_GET/SET_KERNEMU_DEV should run with the vCPU locked.

Reviewed by: corvink, kib, markj
Differential Revision: https://reviews.freebsd.org/D37638

(cherry picked from commit 62be9ffd82fb1a03db5e04d32ab75550f1f4f2c7)

17 months agovmm: Remove stale comment for vm_rendezvous.
John Baldwin [Wed, 30 Nov 2022 21:06:46 +0000 (13:06 -0800)]
vmm: Remove stale comment for vm_rendezvous.

Support for rendezvous outside of a vcpu context (vcpuid of -1) was
removed in commit 949f0f47a4e7, and the vm, vcpuid argument pair was
replaced by a single struct vcpu pointer in commit d8be3d523dd5.

Reported by: andrew

(cherry picked from commit 1f6db5d6b5de5e0cafcdb141a988120b0faea049)

17 months agovmm: Fix build w/o KDTRACE_HOOKS.
Dmitry Chagin [Sun, 20 Nov 2022 15:00:55 +0000 (18:00 +0300)]
vmm: Fix build w/o KDTRACE_HOOKS.

Reviewed by: imp
Differential revision: https://reviews.freebsd.org/D37446

(cherry picked from commit 2ee1a18d51ed68ee34df7dcfd05f6cfc16110202)

17 months agovmm: Fix non-INVARIANTS build
Cy Schubert [Fri, 18 Nov 2022 21:20:13 +0000 (13:20 -0800)]
vmm: Fix non-INVARIANTS build

Reported by: O. Hartmann <freebsd@walstatt-de.de>
Reviewed by: jhb
Fixes: 58eefc67a1cf
Differential Revision: https://reviews.freebsd.org/D37444

(cherry picked from commit d487cba33d777efb9f6f7d7967ad2eaa629bcb90)

17 months agovmm: Trim some pointless #ifdef KTR.
John Baldwin [Fri, 18 Nov 2022 18:06:20 +0000 (10:06 -0800)]
vmm: Trim some pointless #ifdef KTR.

Reported by: markj
Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37272

(cherry picked from commit 49fd5115a9b244c599e068977324e8f6a9993066)

17 months agovmm: Convert VM_MAXCPU into a loader tunable hw.vmm.maxcpu.
John Baldwin [Fri, 18 Nov 2022 18:06:08 +0000 (10:06 -0800)]
vmm: Convert VM_MAXCPU into a loader tunable hw.vmm.maxcpu.

The default is now the number of physical CPUs in the system rather
than 16.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37175

(cherry picked from commit ee98f99d7a68b284a669fefb969cbfc31df2d0ab)

17 months agovmm: Allocate vCPUs on first use of a vCPU.
John Baldwin [Fri, 18 Nov 2022 18:05:35 +0000 (10:05 -0800)]
vmm: Allocate vCPUs on first use of a vCPU.

Convert the vcpu[] array in struct vm to an array of pointers and
allocate vCPUs on first use.  This avoids always allocating VM_MAXCPU
vCPUs for each VM, but instead only allocates the vCPUs in use.  A new
per-VM sx lock is added to serialize attempts to allocate vCPUs on
first use.  However, a given vCPU is never freed while the VM is
active, so the pointer is read via an unlocked read first to avoid the
need for the lock in the common case once the vCPU has been created.

Some ioctls need to lock all vCPUs.  To prevent races with ioctls that
want to allocate a new vCPU, these ioctls also lock the sx lock that
protects vCPU creation.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37174

(cherry picked from commit 98568a005a193ce2c37702a8377ddd10c570e452)

17 months agovmm: don't lock a mtx in the icr_low write handler
Corvin Köhne [Mon, 21 Nov 2022 14:00:04 +0000 (15:00 +0100)]
vmm: don't lock a mtx in the icr_low write handler

x2apic accesses are handled by a wrmsr exit. This handler is called in a
critical section. So, we can't lock a mtx in the icr_low handler.

Reported by: kp, pho
Tested by: kp, pho
Approved by: manu (mentor)
Fixes: c0f35dbf19c3c8825bd2b321d8efd582807d1940 vmm: Use a cpuset_t for vCPUs waiting for STARTUP IPIs.
MFC after: 1 week
MFC with: c0f35dbf19c3c8825bd2b321d8efd582807d1940
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D37452

(cherry picked from commit 7c326ab5bb9aced8dcbc2465ac1c9ff8df2ba46b)

17 months agovmm: Use a cpuset_t for vCPUs waiting for STARTUP IPIs.
John Baldwin [Fri, 18 Nov 2022 18:05:10 +0000 (10:05 -0800)]
vmm: Use a cpuset_t for vCPUs waiting for STARTUP IPIs.

Retire the boot_state member of struct vlapic and instead use a cpuset
in the VM to track vCPUs waiting for STARTUP IPIs.  INIT IPIs add
vCPUs to this set, and STARTUP IPIs remove vCPUs from the set.
STARTUP IPIs are only reported to userland for vCPUs that were removed
from the set.

In particular, this permits a subsequent change to allocate vCPUs on
demand when the vCPU may not be allocated until after a STARTUP IPI is
reported to userland.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37173

(cherry picked from commit c0f35dbf19c3c8825bd2b321d8efd582807d1940)

17 months agovmm devmem_mmap_single: Bump object reference under memsegs lock.
John Baldwin [Fri, 18 Nov 2022 18:04:58 +0000 (10:04 -0800)]
vmm devmem_mmap_single: Bump object reference under memsegs lock.

Reported by: markj
Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37273

(cherry picked from commit 223de44c93659457e05036dec25b0af610a773a6)

17 months agovmm: take exclusive mem_segs_lock in vm_cleanup()
Robert Wing [Fri, 20 Jan 2023 11:10:53 +0000 (11:10 +0000)]
vmm: take exclusive mem_segs_lock in vm_cleanup()

The consumers of vm_cleanup() are vm_reinit() and vm_destroy().

The vm_reinit() call path is, here vmmdev_ioctl() takes mem_segs_lock:
    vmmdev_ioctl()
    vm_reinit()
    vm_cleanup(destroy=false)

The call path for vm_destroy() is (mem_segs_lock not taken):
    sysctl_vmm_destroy()
    vmmdev_destroy()
    vm_destroy()
    vm_cleanup(destroy=true)

Fix this by taking mem_segs_lock in vm_cleanup() when destroy == true.

Reviewed by: corvink, markj, jhb
Fixes: 67b69e76e8ee ("vmm: Use an sx lock to protect the memory map.")
Differential Revision: https://reviews.freebsd.org/D38071

(cherry picked from commit c668e8173a8fc047b54a5c51b0fe4637e87836b6)

17 months agovmm: take exclusive mem_segs_lock when (un)assigning ppt dev
Robert Wing [Fri, 20 Jan 2023 10:03:59 +0000 (10:03 +0000)]
vmm: take exclusive mem_segs_lock when (un)assigning ppt dev

PR:             268744
Reported by:    mmatalka@gmail.com
Reviewed by: corvink, markj, jhb
Fixes: 67b69e76e8ee ("vmm: Use an sx lock to protect the memory map.")
Differential Revision: https://reviews.freebsd.org/D37962

(cherry picked from commit ccf32a68f821c5c724fb9a5b4b9576925122292f)

17 months agovmm: Use an sx lock to protect the memory map.
John Baldwin [Fri, 18 Nov 2022 18:04:37 +0000 (10:04 -0800)]
vmm: Use an sx lock to protect the memory map.

Previously bhyve obtained a "read lock" on the memory map for ioctls
needing to read the map by locking the last vCPU.  This is now
replaced by a new per-VM sx lock.  Modifying the map requires
exclusively locking the sx lock as well as locking all existing vCPUs.
Reading the map requires either locking one vCPU or the sx lock.

This permits safely modifying or querying the memory map while some
vCPUs do not exist which will be true in a future commit.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37172

(cherry picked from commit 67b69e76e8eecfd204f6de636d622a1d681c8d7e)

17 months agovmm: Destroy mutexes.
John Baldwin [Fri, 18 Nov 2022 18:04:30 +0000 (10:04 -0800)]
vmm: Destroy mutexes.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37171

(cherry picked from commit 08ebb360764729632e1f6bc4e3f434abdd708204)

17 months agovmm stat: Add a special nelems constant for arrays sized by vCPU count.
John Baldwin [Fri, 18 Nov 2022 18:04:23 +0000 (10:04 -0800)]
vmm stat: Add a special nelems constant for arrays sized by vCPU count.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37170

(cherry picked from commit d5118d0fc4599f69116ec8de59052606e36e6306)

17 months agovmm vmx: Allocate vpids on demand as each vCPU is initialized.
John Baldwin [Fri, 18 Nov 2022 18:04:11 +0000 (10:04 -0800)]
vmm vmx: Allocate vpids on demand as each vCPU is initialized.

Compared to the previous version this does mean that if the system as
a whole runs out of dedicated vPIDs you might end up with some vCPUs
within a single VM using dedicated vPIDs and others using shared
vPIDs, but this should not break anything.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37169

(cherry picked from commit 58eefc67a1cf16623c23354efd089f65401c0455)

17 months agovmm: Lookup vcpu pointers in vmmdev_ioctl.
John Baldwin [Fri, 18 Nov 2022 18:03:52 +0000 (10:03 -0800)]
vmm: Lookup vcpu pointers in vmmdev_ioctl.

Centralize mapping vCPU IDs to struct vcpu objects in vmmdev_ioctl and
pass vcpu pointers to the routines in vmm.c.  For operations that want
to perform an action on all vCPUs or on a single vCPU, pass pointers
to both the VM and the vCPU using a NULL vCPU pointer to request
global actions.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37168

(cherry picked from commit 3f0f4b1598e0e7005bebed7ea3458e96d0fb8e2f)

17 months agovmm ppt: Remove unused vcpu arg from MSI setup handlers.
John Baldwin [Fri, 18 Nov 2022 18:03:46 +0000 (10:03 -0800)]
vmm ppt: Remove unused vcpu arg from MSI setup handlers.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37167

(cherry picked from commit 0cbc39d53d2270fa77255c663a0cfa5ed502ab0a)

17 months agovmm: Remove unused vcpuid argument from vioapic_process_eoi.
John Baldwin [Fri, 18 Nov 2022 18:03:39 +0000 (10:03 -0800)]
vmm: Remove unused vcpuid argument from vioapic_process_eoi.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37166

(cherry picked from commit e42c24d56b3d949aafd0c916e30ab91a4fe1e24d)

17 months agovmm: Use struct vcpu in the rendezvous code.
John Baldwin [Fri, 18 Nov 2022 18:03:34 +0000 (10:03 -0800)]
vmm: Use struct vcpu in the rendezvous code.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37165

(cherry picked from commit d8be3d523dd50a17f48957c1bb2e0cd7bbf02cab)

17 months agovmm: Remove support for vm_rendezvous with a cpuid of -1.
John Baldwin [Fri, 18 Nov 2022 18:03:23 +0000 (10:03 -0800)]
vmm: Remove support for vm_rendezvous with a cpuid of -1.

This is not currently used.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37164

(cherry picked from commit 949f0f47a4e774fea7222923440851c612a3f6fa)

17 months agovmm: Remove vcpuid from I/O port handlers.
John Baldwin [Fri, 18 Nov 2022 18:03:14 +0000 (10:03 -0800)]
vmm: Remove vcpuid from I/O port handlers.

No I/O ports are vCPU-specific (unlike memory which does have
vCPU-specific ranges such as the local APIC).

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37163

(cherry picked from commit 9388bc1e3a58ac17c06e690fb9f46c9f36098f2d)

17 months agovmm: Restore the correct vm_inject_*() prototypes
Mark Johnston [Fri, 18 Nov 2022 19:11:21 +0000 (14:11 -0500)]
vmm: Restore the correct vm_inject_*() prototypes

Fixes: 80cb5d845b8f ("vmm: Pass vcpu instead of vm and vcpuid...")
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D37443

(cherry picked from commit ca6b48f08034114edf1fa19cdc088021af2eddf3)

17 months agovmm: Pass vcpu instead of vm and vcpuid to APIs used from CPU backends.
John Baldwin [Fri, 18 Nov 2022 18:03:05 +0000 (10:03 -0800)]
vmm: Pass vcpu instead of vm and vcpuid to APIs used from CPU backends.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37162

(cherry picked from commit 80cb5d845b8f4b7dc25b5dc7f4a9a653b98b0cc6)

17 months agovmm: Use struct vcpu in the instruction emulation code.
John Baldwin [Fri, 18 Nov 2022 18:02:09 +0000 (10:02 -0800)]
vmm: Use struct vcpu in the instruction emulation code.

This passes struct vcpu down in place of struct vm and and integer
vcpu index through the in-kernel instruction emulation code.  To
minimize userland disruption, helper macros are used for the vCPU
arguments passed into and through the shared instruction emulation
code.

A few other APIs used by the instruction emulation code have also been
updated to accept struct vcpu in the kernel including
vm_get/set_register and vm_inject_fault.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37161

(cherry picked from commit d3956e46736ffaee5060c9baf0a40f428bc34ec3)

17 months agovmm: Add vm_gpa_hold_global wrapper function.
John Baldwin [Fri, 18 Nov 2022 18:01:57 +0000 (10:01 -0800)]
vmm: Add vm_gpa_hold_global wrapper function.

This handles the case that guest pages are being held not on behalf of
a virtual CPU but globally.  Previously this was handled by passing a
vcpuid of -1 to vm_gpa_hold, but that will not work in the future when
vm_gpa_hold is changed to accept a struct vcpu pointer.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37160

(cherry picked from commit 28b561ad9d03617418aed33b9b8c1311e940f0c8)

17 months agovmm: Add _KERNEL guards for io headers shared with userspace.
John Baldwin [Fri, 18 Nov 2022 18:01:51 +0000 (10:01 -0800)]
vmm: Add _KERNEL guards for io headers shared with userspace.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37159

(cherry picked from commit 0f435e647645afc68076ff5b005f9366c44413eb)

17 months agobhyve: Remove unused vm and vcpu arguments from vm_copy routines.
John Baldwin [Fri, 18 Nov 2022 18:01:44 +0000 (10:01 -0800)]
bhyve: Remove unused vm and vcpu arguments from vm_copy routines.

The arguments identifying the VM and vCPU are only needed for
vm_copy_setup.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37158

(cherry picked from commit 2b4fe856f44ded02f3450bac1782bb49b60b7dd5)

17 months agovmm: Use struct vcpu with the vmm_stat API.
John Baldwin [Fri, 18 Nov 2022 18:01:18 +0000 (10:01 -0800)]
vmm: Use struct vcpu with the vmm_stat API.

The function callbacks still use struct vm and and vCPU index.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37157

(cherry picked from commit 3dc3d32ad67b38ab44ed4a7cf3020a0741b47ec1)

17 months agovmm: Expose struct vcpu as an opaque type.
John Baldwin [Fri, 18 Nov 2022 18:01:05 +0000 (10:01 -0800)]
vmm: Expose struct vcpu as an opaque type.

Pass a pointer to the current struct vcpu to the vcpu_init callback
and save this pointer in the CPU-specific vcpu structures.

Add routines to fetch a struct vcpu by index from a VM and to query
the VM and vcpuid from a struct vcpu.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37156

(cherry picked from commit 950af9ffc616ee573a1ce6ef0c841e897b13dfc4)

17 months agovmm: Use VLAPIC_CTR* in more places.
John Baldwin [Fri, 18 Nov 2022 18:00:59 +0000 (10:00 -0800)]
vmm: Use VLAPIC_CTR* in more places.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37155

(cherry picked from commit d030f941e63f5b20efa14833912aae29ff737fcf)

17 months agovmm vmx: Add VMX_CTR* wrapper macros.
John Baldwin [Fri, 18 Nov 2022 18:00:49 +0000 (10:00 -0800)]
vmm vmx: Add VMX_CTR* wrapper macros.

These macros are similar to VCPU_CTR* but accept a single vmx_vcpu
pointer as the first argument instead of separate vm and vcpuid.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37154

(cherry picked from commit 57e0119ef3a95d7faa11c44b1acbb8193aadfb35)

17 months agovmm svm: Add SVM_CTR* wrapper macros.
John Baldwin [Fri, 18 Nov 2022 18:00:38 +0000 (10:00 -0800)]
vmm svm: Add SVM_CTR* wrapper macros.

These macros are similar to VCPU_CTR* but accept a single svm_vcpu
pointer as the first argument instead of separate vm and vcpuid.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37153

(cherry picked from commit fca494dad06242aa45d3e722f0c16b405dc8039c)

17 months agovmm: Remove the per-vm cookie argument from vmmops taking a vcpu.
John Baldwin [Fri, 18 Nov 2022 18:00:00 +0000 (10:00 -0800)]
vmm: Remove the per-vm cookie argument from vmmops taking a vcpu.

This requires storing a reference to the per-vm cookie in the
CPU-specific vCPU structure.  Take advantage of this new field to
remove no-longer-needed function arguments in the CPU-specific
backends.  In particular, stop passing the per-vm cookie to functions
that either don't use it or only use it for KTR traces.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37152

(cherry picked from commit 869c8d1946eb4feb8ad651abdf87af0e5c0111b4)

17 months agovmm: Refactor storage of CPU-dependent per-vCPU data.
John Baldwin [Fri, 18 Nov 2022 17:59:21 +0000 (09:59 -0800)]
vmm: Refactor storage of CPU-dependent per-vCPU data.

Rather than storing static arrays of per-vCPU data in the CPU-specific
per-VM structure, adopt a more dynamic model similar to that used to
manage CPU-specific per-VM data.

That is, add new vmmops methods to init and cleanup a single vCPU.
The init method returns a pointer that is stored in 'struct vcpu' as a
cookie pointer.  This cookie pointer is now passed to other vmmops
callbacks in place of the integer index.  The index is now only used
in KTR traces and when calling back into the CPU-independent layer.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37151

(cherry picked from commit 1aa5150479bf35c90c6770e6ea90e8462cfb6bf9)

17 months agovmm vmx: Add a global bool to indicate if the host has the TSC_AUX MSR.
John Baldwin [Fri, 18 Nov 2022 17:58:56 +0000 (09:58 -0800)]
vmm vmx: Add a global bool to indicate if the host has the TSC_AUX MSR.

A future commit will remove direct access to vCPU structures from
struct vmx, so add a dedicated boolean for this rather than checking
the capabilities for vCPU 0.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37269

(cherry picked from commit 73abae4493782e44a3382b15f5563c3f400bf51f)

17 months agovmm: Rework snapshotting of CPU-specific per-vCPU data.
John Baldwin [Fri, 18 Nov 2022 17:58:41 +0000 (09:58 -0800)]
vmm: Rework snapshotting of CPU-specific per-vCPU data.

Previously some per-vCPU state was saved in vmmops_snapshot and other
state was saved in vmmops_vcmx_snapshot.  Consolidate all per-vCPU
state into the latter routine and rename the hook to the more generic
'vcpu_snapshot'.  Note that the CPU-independent per-vCPU data is still
stored in a separate blob as well as the per-vCPU local APIC data.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37150

(cherry picked from commit 39ec056e6dbd89e26ee21d2928dbd37335de0ebc)

17 months agovmm svm: Mark all VMCB state caches dirty on vCPU restore.
John Baldwin [Fri, 18 Nov 2022 17:58:22 +0000 (09:58 -0800)]
vmm svm: Mark all VMCB state caches dirty on vCPU restore.

Mark Johnston noticed that this was missing VMCB_CACHE_LBR.  Just set
all the bits as is done in svm_run() rather than trying to clear
individual bits.

Reported by: markj
Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37259

(cherry picked from commit 19b9dd2e08eda491ab1c181ca5a3659f7e7628fc)

17 months agovmm vmx: Refactor per-vCPU data.
John Baldwin [Fri, 18 Nov 2022 17:58:08 +0000 (09:58 -0800)]
vmm vmx: Refactor per-vCPU data.

Add a struct vmx_vcpu to hold per-vCPU data specific to VT-x and
move parallel arrays out of struct vmx into a single array of
this structure.

While here, dynamically allocate the VMCS, APIC page and PIR
descriptors for each vCPU rather than embedding them.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37149

(cherry picked from commit 0f00260c679f8d192f9d673fe4fb94b47a2ac6c5)

17 months agovmm svm: Refactor per-vCPU data.
John Baldwin [Fri, 18 Nov 2022 17:57:48 +0000 (09:57 -0800)]
vmm svm: Refactor per-vCPU data.

- Allocate VMCBs separately to avoid excessive padding in struct
  svm_vcpu.

- Allocate APIC pages dynamically directly in struct vlapic.

- Move vm_mtrr into struct svm_vcpu rather than using a separate
  parallel array.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37148

(cherry picked from commit 215d2fd53f6c254cb900e1775abae86d3fdada65)

17 months agovmm: Use vm_get_maxcpus() instead of VM_MAXCPU in various places.
John Baldwin [Fri, 18 Nov 2022 17:57:38 +0000 (09:57 -0800)]
vmm: Use vm_get_maxcpus() instead of VM_MAXCPU in various places.

Mostly these are loops that iterate over all possible vCPU IDs for a
specific virtual machine.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37147

(cherry picked from commit 35abc6c238e98e313c5b1cb5ed18b8ed68615abc)

17 months agovmm: Simplify saving of absolute TSC values in snapshots.
John Baldwin [Fri, 18 Nov 2022 17:57:29 +0000 (09:57 -0800)]
vmm: Simplify saving of absolute TSC values in snapshots.

Read the current "now" TSC value and use it to compute absolute time
saved value in vm_snapshot_vcpus rather than iterating over vCPUs
multiple times in vm_snapshot_vm.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37146

(cherry picked from commit a7db532e3a6f83067b342f569b56076d011f8a1e)

17 months agobhyve: Avoid passing a possible garbage pointer to free().
John Baldwin [Tue, 29 Nov 2022 01:10:30 +0000 (17:10 -0800)]
bhyve: Avoid passing a possible garbage pointer to free().

All of the error paths in pci_vtcon_sock_add free the sock pointer.
However, sock is not initialized until part way through the function.
An early error would pass stack garbage to free().

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37491

(cherry picked from commit bc928800723b65daa9b005bec4ffd8ad8c781a09)

17 months agobhyve: Appease warning about a potentially unaligned pointer.
John Baldwin [Tue, 29 Nov 2022 01:10:07 +0000 (17:10 -0800)]
bhyve: Appease warning about a potentially unaligned pointer.

When initializing the device model for a PCI pass through device that
uses MSI-X, bhyve reads the MSI-X capability from the real device to
save a copy in the emulated PCI config space.  It also saves a copy in
a local struct msixcap on the stack.  Since struct msixcap is packed,
GCC complains that casting a pointer to the struct to a uint32_t
pointer may result in an unaligned pointer.

This path is not performance critical, so to appease the compiler,
simply change the pointer to a char * and use memcpy to copy the 4
bytes read in each iteration of the loop.

Reviewed by: corvink, bz, markj
Differential Revision: https://reviews.freebsd.org/D37490

(cherry picked from commit 32b21dd2719f87811b66deeeb513acf7067f8fac)

17 months agobhyve: Fix sign compare warnings in the NVMe device model.
John Baldwin [Tue, 29 Nov 2022 01:09:44 +0000 (17:09 -0800)]
bhyve: Fix sign compare warnings in the NVMe device model.

Reviewed by: corvink
Differential Revision: https://reviews.freebsd.org/D37489

(cherry picked from commit 15cebe3d637f70abd1ee95e2745d6676d9b1e7dd)

17 months agobhyve: Avoid unlikely truncation of the blockif ident strings.
John Baldwin [Tue, 29 Nov 2022 01:09:15 +0000 (17:09 -0800)]
bhyve: Avoid unlikely truncation of the blockif ident strings.

The ident string for NVMe and VirtIO block deivces do not contain the
bus, and the various fields can potentially use up to three characters
when printed as unsigned values (full range of uint8_t) even if not
likely in practice.

Reviewed by: corvink, chuck
Differential Revision: https://reviews.freebsd.org/D37488

(cherry picked from commit 5d805962ca9347bbf62750452c4c980decb94793)

17 months agobhyve: Clear lid to 0 for internal device errors for NVMe AENs.
John Baldwin [Tue, 29 Nov 2022 01:08:57 +0000 (17:08 -0800)]
bhyve: Clear lid to 0 for internal device errors for NVMe AENs.

Reported by: GCC
Reviewed by: corvink, chuck, imp, markj
Differential Revision: https://reviews.freebsd.org/D37487

(cherry picked from commit 47d61162396bac8a7320a6768f218b192dd19ee1)

17 months agobhyve: Don't leak uninitialized bits in NVMe completion statuses.
John Baldwin [Tue, 29 Nov 2022 01:08:36 +0000 (17:08 -0800)]
bhyve: Don't leak uninitialized bits in NVMe completion statuses.

In some cases, some bits in the 16-bit status word were never
initialized.

Reported by: GCC
Reviewed by: corvink, chuck, markj
Differential Revision: https://reviews.freebsd.org/D37486

(cherry picked from commit 1d9e8a9e60953b148a036b39d1fe7037fdbb40a3)

17 months agobhyve: Fix sign compare warnings in the e1000 device model.
John Baldwin [Tue, 29 Nov 2022 01:08:09 +0000 (17:08 -0800)]
bhyve: Fix sign compare warnings in the e1000 device model.

Adding a bare constant to a uint16_t promotes to a signed int which
triggers these warnings.  Changing the constant to be explicitly
unsigned instead promotes the expression to unsigned int.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37485

(cherry picked from commit e7cd5ffff88f1f4dfba2693041cc78fcf3613fba)

17 months agobhyve basl: Use GCC pragmas.
John Baldwin [Tue, 29 Nov 2022 01:07:39 +0000 (17:07 -0800)]
bhyve basl: Use GCC pragmas.

These work with both clang and GCC.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37484

(cherry picked from commit 0acf696151e3c43967988c8271aa27683566a755)

17 months agobhyve: Enable the default compiler warnings
Mark Johnston [Fri, 18 Nov 2022 19:10:33 +0000 (14:10 -0500)]
bhyve: Enable the default compiler warnings

Disable -Wcast-align for now since we have many instances of that
warning (I fixed some but not most of them) and platforms on which bhyve
runs don't particularly care about unaligned accesses.

Reviewed by: corvink
Differential Revision: https://reviews.freebsd.org/D37296

(cherry picked from commit 71ebd117386cda6410ca65eb487b63e5dedf3245)

17 months agobhyve: Mark pci_de_vinput as static.
John Baldwin [Thu, 26 Jan 2023 20:19:12 +0000 (12:19 -0800)]
bhyve: Mark pci_de_vinput as static.

Originally in main this was fixed in commit 37045dfa891a.  However,
when that commit was merged to stable/13 in commit 976ed044fbbb,
pci_virtio_input was not yet merged to stable/13.  This is a direct
commit to complete the earlier MFC.

17 months agobhyve: Let BASL compile with raised warnings
Mark Johnston [Fri, 18 Nov 2022 19:07:20 +0000 (14:07 -0500)]
bhyve: Let BASL compile with raised warnings

- Make basl_dump() as unused.
- Avoid arithmetic on a void pointer.
- Avoid a signed/unsigned comparison with
  BASL_TABLE_CHECKSUM_LEN_FULL_TABLE.
- Ignore warnings about unused parameters from stuff pulled in by
  acpi.h.  In particular, any prototype wrapped by
  ACPI_DBG_DEPENDENT_RETURN_VOID() will raise such parameters unless
  ACPI_DEBUG_OUTPUT is defined.

Reviewed by: corvink, jhb
Differential Revision: https://reviews.freebsd.org/D37397

(cherry picked from commit c127c61efa4d8414be9a7373b50c7f348b6e461e)

17 months agobhyve: Avoid using a packed struct for xhci port registers
Mark Johnston [Fri, 18 Nov 2022 19:07:38 +0000 (14:07 -0500)]
bhyve: Avoid using a packed struct for xhci port registers

I believe the __packed annotation is there only because
pci_xhci_portregs_read() is treating the register set as an array of
uint32_t.  clang warns about taking the address of portregs->portsc
because it is a packed member and thus might not have expected
alignment.

Fix the problem by simply selecting the field to read with a switch
statement.  This mimics pci_xhci_portregs_write().  While here, switch
to using some symbolic constants.

There is a small semantic change here in that pci_xhci_portregs_read()
would silently truncate unaligned offsets.  For consistency with
pci_xhci_portregs_write(), which does not do that, return all ones for
unaligned reads instead.

MFC after: 2 weeks
Reviewed by: corvink, jhb
Differential Revision: https://reviews.freebsd.org/D37408

(cherry picked from commit 0705b7f4e64fdbad49a3a6d9131029a9734deb2c)

17 months agobhyve: Fix a typo in a comment
Mark Johnston [Mon, 14 Nov 2022 14:00:06 +0000 (09:00 -0500)]
bhyve: Fix a typo in a comment

Reported by: Mikaël Urankar <mikael.urankar@mailo.fr>
Fixes: 719e307f80c7 ("bhyve: Cast away const when fetching a config nvlist")

(cherry picked from commit 84b0b7ea4cd6731e91f79e008a747b502106f95a)

17 months agobhyve: Address warnings about potential unaligned accesses in fwctl.c
Mark Johnston [Fri, 11 Nov 2022 15:01:27 +0000 (10:01 -0500)]
bhyve: Address warnings about potential unaligned accesses in fwctl.c

This silences some warning about potential unaligned accesses.  No
functional change intended.

MFC after: 1 week
Reviewed by: corvink, jhb
Differential Revision: https://reviews.freebsd.org/D37288

(cherry picked from commit f64f34380925a4ddaf1c140c35f46408b74110ac)

17 months agobhyve: Implement MSR_MISC_FEATURES_ENABLES
Warner Losh [Thu, 27 Oct 2022 17:32:18 +0000 (11:32 -0600)]
bhyve: Implement MSR_MISC_FEATURES_ENABLES

Linux reads MISC_FEATURES_ENABLES to manage the CPUID faulting feature
(undocumented in the Intel SDM, but documented in 323850-004 (Intel
Virtualization Technology FlexMigration Application Note). Since bhyve
doesn't emulate this feature, we always return 0. Neither does bhyve
support the MONITOR/MWAIT fault bit also in this MSR (which is
documented in the sdm), so always return 0.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D36602

(cherry picked from commit 1d21f64149224000d74e0c850686e85aefd25ef9)

17 months agobhyve: Remove an unused parameter from pci_nvme_append_iov_req()
Mark Johnston [Thu, 27 Oct 2022 14:47:17 +0000 (10:47 -0400)]
bhyve: Remove an unused parameter from pci_nvme_append_iov_req()

No functional change intended.

MFC after: 1 week
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D37116

(cherry picked from commit ae71263c6689a475f3df293475058048c0810dd7)

17 months agobhyve: Address signed/unsigned comparison warnings in the AHCI model
Mark Johnston [Tue, 25 Oct 2022 13:39:07 +0000 (09:39 -0400)]
bhyve: Address signed/unsigned comparison warnings in the AHCI model

No functional change intended.

MFC after: 1 week

(cherry picked from commit f0553616cf78c94e7589921d2354477b948e4876)

17 months agobhyve: Address some signed/unsigned comparison warnings
Mark Johnston [Sun, 23 Oct 2022 14:32:45 +0000 (10:32 -0400)]
bhyve: Address some signed/unsigned comparison warnings

MFC after: 1 week

(cherry picked from commit ed7216843133c9d6748251b5e180ee90410131f0)

17 months agobhyve: Address signed/unsigned comparison warnings in the e1000 model
Mark Johnston [Tue, 25 Oct 2022 13:54:50 +0000 (09:54 -0400)]
bhyve: Address signed/unsigned comparison warnings in the e1000 model

No functional change intended.

MFC after: 1 week

(cherry picked from commit cea34d0705ccd3944cce1bed5b4ff31aad05d983)

17 months agobhyve: Address warnings in blockif_proc()
Mark Johnston [Tue, 25 Oct 2022 13:16:23 +0000 (09:16 -0400)]
bhyve: Address warnings in blockif_proc()

- Use unsigned types for all arithmetic.  Use a new signed variable for
  holding the return value of pread() and pwrite().
- Handle short I/O from pwrite().

MFC after: 1 week

(cherry picked from commit 46f5c828961e64646c46ff9e3bc8e55f46f3e7bb)

17 months agobhyve: Drop a bogus const qualifier
Mark Johnston [Mon, 24 Oct 2022 21:35:16 +0000 (17:35 -0400)]
bhyve: Drop a bogus const qualifier

No functional change intended.

MFC after: 1 week

(cherry picked from commit eefd863cbae9d7b2f5c83948b45be13951a0c495)

17 months agobhyve: Put the prototype for vmexit_task_switch() in a header
Mark Johnston [Sun, 23 Oct 2022 14:21:50 +0000 (10:21 -0400)]
bhyve: Put the prototype for vmexit_task_switch() in a header

No functional change intended.

MFC after: 1 week

(cherry picked from commit f703dc0ef0e1d6ac1697cb8d6662870bd5e0fba6)

17 months agobhyve: Annotate an unused function as such
Mark Johnston [Sun, 23 Oct 2022 14:46:39 +0000 (10:46 -0400)]
bhyve: Annotate an unused function as such

No functional change intended.

MFC after: 1 week

(cherry picked from commit eb805f4e0f6a7b1567aa4cf4eb1c4484dac67ae5)

17 months agobhyve: USB device model structures can be qualified with "static"
Mark Johnston [Sat, 22 Oct 2022 17:39:01 +0000 (13:39 -0400)]
bhyve: USB device model structures can be qualified with "static"

No functional change intended.

MFC after: 1 week

(cherry picked from commit cd49c066a3565a37551d50d759c8d1b5a90b3859)

17 months agobhyve: Fix some warnings in the snapshot code
Mark Johnston [Sat, 22 Oct 2022 17:41:33 +0000 (13:41 -0400)]
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

(cherry picked from commit c9faf6987406781debb06ec5e40aa1de6d11ac4f)

17 months agobhyve: Put the prototype for vga_render() in a header
Mark Johnston [Sun, 23 Oct 2022 14:22:39 +0000 (10:22 -0400)]
bhyve: Put the prototype for vga_render() in a header

No functional change intended.

MFC after: 1 week

(cherry picked from commit 84633b9d5244c5bd0438d2969e021ec01066b107)

17 months agobhyve: Use the proper type for string literals
Mark Johnston [Sat, 22 Oct 2022 17:37:46 +0000 (13:37 -0400)]
bhyve: Use the proper type for string literals

No functional change intended.

MFC after: 1 week

(cherry picked from commit 7039bdd5351a080e648c6519636227bcd38a255c)

17 months agobhyve: Avoid arithmetic on void pointers
Mark Johnston [Sat, 22 Oct 2022 17:40:20 +0000 (13:40 -0400)]
bhyve: Avoid arithmetic on void pointers

No functional change intended.

MFC after: 1 week

(cherry picked from commit 63898728b544763d85c062c8515c12a0c3a60e0a)

17 months agobhyve: Address some warnings in bhyverun.c
Mark Johnston [Sat, 22 Oct 2022 17:34:00 +0000 (13:34 -0400)]
bhyve: Address some warnings in bhyverun.c

- Annotate unused parameters as such.
- Avoid shadowing the global "vmexit".

No functional change intended.

MFC after: 1 week

(cherry picked from commit 4a1c23a708f98c1588a196041cda5d55795e2f0c)

17 months agobhyve: Make hda_ops function tables const
Mark Johnston [Sun, 23 Oct 2022 14:43:06 +0000 (10:43 -0400)]
bhyve: Make hda_ops function tables const

No functional change intended.

MFC after: 1 week

(cherry picked from commit 489392feb7dd784b6036dd6511c690e4df9726e3)

17 months agobhyve: Annotate unused function parameters
Mark Johnston [Sat, 8 Oct 2022 15:22:38 +0000 (11:22 -0400)]
bhyve: Annotate unused function parameters

MFC after: 1 week

(cherry picked from commit 98d920d9cf0b439ea351c60353626946971684f6)

17 months agobhyve: Use designated initializers for virtio_consts tables
Mark Johnston [Thu, 29 Sep 2022 15:53:04 +0000 (11:53 -0400)]
bhyve: Use designated initializers for virtio_consts tables

This is easier to read and addresses some compiler warnings.

One might expect these tables to be read-only but it seems that the
snapshot/restore code may modify them.

MFC after: 2 weeks

(cherry picked from commit 6cb261620da3a9888f7a09244a8efe691c12ae47)

17 months agobhyve: Address some warnings in bhyverun.c
Mark Johnston [Thu, 8 Sep 2022 23:08:10 +0000 (19:08 -0400)]
bhyve: Address some warnings in bhyverun.c

- Add const and __unused qualifiers where appropriate.
- Localize some global variables.
- Consistently spell vmexit state as "vme" in vmexit handlers, to avoid
  shadowing the global vm_exit state array.
- Similarly, avoid shadowing "optarg".

MFC after: 2 weeks

(cherry picked from commit 65b8109b4e07ea1fe105ab10539d5baa0a613a14)

17 months agobhyve nvme: Fix Controller init error cases
Chuck Tuffli [Sun, 14 Aug 2022 14:47:34 +0000 (07:47 -0700)]
bhyve nvme: Fix Controller init error cases

Fuzzing of bhyve uncovered an assertion failure in the NVMe emulation.
Investigation uncovered several corner cases the code did not handle.
This change handles several Controller initialization errors, including
 - bad AQ sizes
 - bad AQ vm_map_gpa
 - doorbell writes prior to RDY
 - doorbell writes to uninitialized queue
 - CSTS.RDY if CFS set

PR: 256317,256319,256320,256322
Reported by: Cheolwoo Myung <cwmyung@snu.ac.kr>
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D35453

(cherry picked from commit d7d1becad4b692b97dd1f32706947aae5118294b)

17 months agovmm: Fix snapshots for AMD CPUs
Mihai Burcea [Thu, 30 Jun 2022 23:11:17 +0000 (16:11 -0700)]
vmm: Fix snapshots for AMD CPUs

This patch fixes the AMD implementation for snapshotting.  It removes
unnecessary vmcb fields that should not be saved and duplicates.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D33431

(cherry picked from commit 9aa02d5120ab02bcbbc16fddb63e575df4ed6f61)

17 months agolibvmmapi: Add vm_close()
Vitaliy Gusev [Thu, 30 Jun 2022 21:21:57 +0000 (14:21 -0700)]
libvmmapi: Add vm_close()

Currently there is no way to safely free a vm structure without
leaking the fd.  vm_destroy() closes the fd but also destroys the VM
whereas in some cases a VM needs to be opened (vm_open) and then
closed (vm_close).

Reviewed by: jhb
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D35073

(cherry picked from commit f0880ab791a510391a12f2ab7b01889b6774bca0)

17 months agobhyve: Snapshot impovements for 'blockif' backend
Vitaliy Gusev [Thu, 23 Jun 2022 18:46:06 +0000 (11:46 -0700)]
bhyve: Snapshot impovements for 'blockif' backend

When pausing a block I/O device model as part of suspending a VM, wait
for all active block I/O requests to finish before saving snapshot
data.  This avoids having to save information about in-flight requests
both in the block_if layer and in storage device models.

For the AHCI device model, the queues are now guaranteed to be idle
when taking a snapshot, so remove the code to save queue state and
rely on the initial state in a resumed VM having all queues already
idle.

This will also simplify adding NVMe snapshot support in the future.

Reviewed by: jhb
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D26267

(cherry picked from commit cd9618bdb274375139080ee4e33ccbdc980513f3)

17 months agobhyve: Enable suspend/resume support for virtio-blk.
Vitaliy Gusev [Thu, 23 Jun 2022 18:46:06 +0000 (11:46 -0700)]
bhyve: Enable suspend/resume support for virtio-blk.

Reviewed by: jhb
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D26267

(cherry picked from commit a85bbbea91bddbd27d080fb2ad55a9f5c316adad)

17 months agobhyve: Report an error for invalid UUIDs.
James Mintram [Thu, 16 Jun 2022 20:17:44 +0000 (13:17 -0700)]
bhyve: Report an error for invalid UUIDs.

Reviewed by: rgrimes, grehan, jhb
Differential Revision: https://reviews.freebsd.org/D30050

(cherry picked from commit e16b709e2dcc45f01cf96b5e7f6d48474feff8d7)

17 months agovmm_instruction_emul.c: fix bhyve build
Robert Wing [Sun, 10 Apr 2022 21:37:24 +0000 (13:37 -0800)]
vmm_instruction_emul.c: fix bhyve build

The __diagused macro was used to cure a "set but not used" warning. This
broke the build for bhyve since __diagused is only defined in the
kernel. Define __diagused when not building the kernel.

Fixes: 5241577a223d ("vmm: fix set but not used warning")
Reported by:    Jenkins

(cherry picked from commit d4e8207317ca1827ba2529203d5cc4e67d836fcb)

17 months agovmm: fix set but not used warning
Robert Wing [Sun, 10 Apr 2022 18:30:19 +0000 (10:30 -0800)]
vmm: fix set but not used warning

(cherry picked from commit 5a17f489d5848085307e1d5fa7ca142694b4946b)

17 months agovmm: fix set but not used warning
Robert Wing [Sun, 10 Apr 2022 18:30:16 +0000 (10:30 -0800)]
vmm: fix set but not used warning

(cherry picked from commit 5241577a223d805282f726cb443a566aca653b9f)

17 months agovmm: fix set but not used warning
Robert Wing [Sun, 10 Apr 2022 18:30:14 +0000 (10:30 -0800)]
vmm: fix set but not used warning

(cherry picked from commit 3587bfa797cd66dce2e94ca93df5ce41def555df)

17 months agovmm: fix set but not used warnings
Robert Wing [Sun, 10 Apr 2022 18:30:11 +0000 (10:30 -0800)]
vmm: fix set but not used warnings

(cherry picked from commit 5c272efaba291f744191dca86f04418bfe90b222)

17 months agovmm: fix set but not used warnings
Robert Wing [Sun, 10 Apr 2022 18:30:08 +0000 (10:30 -0800)]
vmm: fix set but not used warnings

(cherry picked from commit f877977a034b41bedacdf507e79e4233b28a8bfc)

17 months agovmm: fix set but not used warning
Robert Wing [Sun, 10 Apr 2022 18:30:05 +0000 (10:30 -0800)]
vmm: fix set but not used warning

(cherry picked from commit 893a3dd697ef4ac0a432ca8ce8790661884eb1ea)

17 months agoFix a typo in previous commit.
John Baldwin [Fri, 8 Apr 2022 19:01:33 +0000 (12:01 -0700)]
Fix a typo in previous commit.

Reported by: npn
Pointy hat to: jhb
Fixes: 572edd3dae9f vmm: Re-quiet set but unused warnings.

(cherry picked from commit 6a33ecdc2f649234cc3160daec8c329f33860f45)

17 months agovmm amdvi: Move ctrl under #ifdef AMDVI_DEBUG_CMD.
John Baldwin [Fri, 8 Apr 2022 00:01:29 +0000 (17:01 -0700)]
vmm amdvi: Move ctrl under #ifdef AMDVI_DEBUG_CMD.

(cherry picked from commit a7d876f7010068d93f1d9b4bb62d1370c9a0798f)

17 months agovmm: Re-quiet set but unused warnings.
John Baldwin [Fri, 8 Apr 2022 00:01:29 +0000 (17:01 -0700)]
vmm: Re-quiet set but unused warnings.

__diagused is no longer used for KTR, so instead use #ifdef KTR or
expand KTR-only variables into their values in traces.

(cherry picked from commit 572edd3dae9fc3e67dfb1cb9ba023e8d3fe2a9bb)

17 months agovmm: fix "set but not used" warnings
Robert Wing [Tue, 1 Mar 2022 00:09:32 +0000 (15:09 -0900)]
vmm: fix "set but not used" warnings

(cherry picked from commit 2062ce996ddd39ba7a36c2caf8c898686d9cb2fe)

17 months agovmm: fix "set but not used" warnings
Robert Wing [Mon, 28 Feb 2022 23:55:37 +0000 (14:55 -0900)]
vmm: fix "set but not used" warnings

(cherry picked from commit 39d87a023567f633c6990ac7fcc3a20691a1efd6)

17 months agovmm: fix "set but not used" warnings
Robert Wing [Mon, 28 Feb 2022 23:46:08 +0000 (14:46 -0900)]
vmm: fix "set but not used" warnings

(cherry picked from commit 73505a10760c8b6f459b9c790bbf3a365f990a0b)

17 months agobhyve: Fix virtio-console legacy configuration parsing
Yan Ka Chiu [Fri, 6 May 2022 19:31:56 +0000 (15:31 -0400)]
bhyve: Fix virtio-console legacy configuration parsing

virtio-console is currently missing .pe_legacy_config, which prevents any
portN configuration from being parsed, and therefore no sockets will be
created.

Reviewed by: khng
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35142

(cherry picked from commit 3cdfaefa4b88c928bfb62e7fb6c7f7742d81f31c)

17 months agoman pages: Fix typo
Christian Weisgerber [Wed, 6 Apr 2022 14:46:39 +0000 (16:46 +0200)]
man pages: Fix typo

s/the the/the/

Approved by: ygy (doc)

(cherry picked from commit 81d1214e8a9435aa7c09b622fa6916e89138dc5c)

17 months agobhyve: missing mutex initializations
Andy Fiddaman [Wed, 16 Mar 2022 03:50:36 +0000 (19:50 -0800)]
bhyve: missing mutex initializations

Explicitly initialize the mutex that a PCI virtio module passes back to
virtio.

It so happens that these mutexes were being initialized regardless, no
functional change intended.

Reviewed by:    chuck, jhb
Differential Revision:  https://reviews.freebsd.org/D34372

(cherry picked from commit f6f357efb1067b79678d8f348333ffdfec66ad20)

17 months agobhyve: plug memory leak in topology_parse()
Andy Fiddaman [Thu, 24 Feb 2022 17:36:41 +0000 (08:36 -0900)]
bhyve: plug memory leak in topology_parse()

Reviewed by:    jhb, rew
Differential Revision:  https://reviews.freebsd.org/D34301

(cherry picked from commit ad3da82996ffe8a7959fda4a84374b1907ebb116)

17 months agobhyve: Fix getaddrinfo() error handling
Mark Johnston [Tue, 8 Feb 2022 17:34:03 +0000 (12:34 -0500)]
bhyve: Fix getaddrinfo() error handling

- Use errx() since errno will not be set.
- Print the message returned by gai_strerror().

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 927aa5fefd4c69e72d44189a04fadf80e42d0ad8)

17 months agobhyve: clean up trailing whitespaces
Toomas Soome [Sun, 26 Dec 2021 07:52:38 +0000 (09:52 +0200)]
bhyve: clean up trailing whitespaces

Clean up trailing whitespaces. No functional changes.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D33681

(cherry picked from commit c2fa905cf6c1cf1938a0353679e3bd0b617ca179)