--- old/usr/src/cmd/bhyve/bhyverun.c	Tue Jul 27 14:35:26 2021
+++ new/usr/src/cmd/bhyve/bhyverun.c	Tue Jul 27 14:35:26 2021
@@ -1582,13 +1582,6 @@
 #ifdef	__FreeBSD__
 	err = vm_setup_memory(ctx, memsize, VM_MMAP_ALL);
 #else
-	err = vm_arc_resv(ctx, memsize);
-	if (err != 0) {
-		(void) fprintf(stderr, "Could not shrink ARC: %s\n",
-		    strerror(err));
-		exit(4);
-	}
-
 	do {
 		errno = 0;
 		err = vm_setup_memory(ctx, memsize, VM_MMAP_ALL);
--- old/usr/src/lib/libvmmapi/common/mapfile-vers	Tue Jul 27 14:35:27 2021
+++ new/usr/src/lib/libvmmapi/common/mapfile-vers	Tue Jul 27 14:35:27 2021
@@ -11,7 +11,7 @@
 
 #
 # Copyright 2013 Pluribus Networks Inc.
-# Copyright 2020 Joyent, Inc.
+# Copyright 2019 Joyent, Inc.
 # Copyright 2020 Oxide Computer Company
 # Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
 #
@@ -38,7 +38,6 @@
 		vm_activate_cpu;
 		vm_active_cpus;
 		vm_apicid2vcpu;
-		vm_arc_resv;
 		vm_assign_pptdev;
 		vm_capability_name2type;
 		vm_capability_type2name;
--- old/usr/src/lib/libvmmapi/common/vmmapi.c	Tue Jul 27 14:35:27 2021
+++ new/usr/src/lib/libvmmapi/common/vmmapi.c	Tue Jul 27 14:35:27 2021
@@ -1942,14 +1942,6 @@
 	return (0);
 }
 
-int
-vm_arc_resv(struct vmctx *ctx, size_t len)
-{
-	if (ioctl(ctx->fd, VM_ARC_RESV, (uint64_t)len) != 0) {
-		return (errno);
-	}
-	return (0);
-}
 #endif /* __FreeBSD__ */
 
 #ifdef __FreeBSD__
--- old/usr/src/lib/libvmmapi/common/vmmapi.h	Tue Jul 27 14:35:27 2021
+++ new/usr/src/lib/libvmmapi/common/vmmapi.h	Tue Jul 27 14:35:27 2021
@@ -38,7 +38,7 @@
  * http://www.illumos.org/license/CDDL.
  *
  * Copyright 2015 Pluribus Networks Inc.
- * Copyright 2020 Joyent, Inc.
+ * Copyright 2019 Joyent, Inc.
  * Copyright 2020 Oxide Computer Company
  */
 
@@ -316,7 +316,6 @@
     uint8_t *sipi_vector);
 int vm_set_run_state(struct vmctx *ctx, int vcpu, enum vcpu_run_state state,
     uint8_t sipi_vector);
-int	vm_arc_resv(struct vmctx *ctx, size_t);
 #endif	/* __FreeBSD__ */
 
 #ifdef	__FreeBSD__
--- old/usr/src/uts/common/fs/zfs/arc.c	Tue Jul 27 14:35:28 2021
+++ new/usr/src/uts/common/fs/zfs/arc.c	Tue Jul 27 14:35:28 2021
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2020 Joyent, Inc.
+ * Copyright (c) 2019, Joyent, Inc.
  * Copyright (c) 2011, 2018 by Delphix. All rights reserved.
  * Copyright (c) 2014 by Saso Kiselkov. All rights reserved.
  * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
@@ -4544,7 +4544,6 @@
 	FMR_PAGES_PP_MAXIMUM,
 	FMR_HEAP_ARENA,
 	FMR_ZIO_ARENA,
-	FMR_VIRT_MACHINE,	/* 'VM' seems ambiguous in this context */
 } free_memory_reason_t;
 
 int64_t last_free_memory;
@@ -4560,49 +4559,7 @@
  */
 int64_t arc_swapfs_reserve = 64;
 
-static volatile uint64_t arc_virt_machine_reserved;
-
 /*
- * XXX: A possible concern is that we allow arc_virt_machine_reserved to
- * get so large that we cause the arc to perform a lot of additional
- * work to keep the arc extremely small. We may want to set limits to
- * the size of arc_virt_machine_reserved and disallow reservations
- * beyond that limit.
- */
-int
-arc_virt_machine_reserve(size_t pages)
-{
-	uint64_t newv;
-
-	newv = atomic_add_64_nv(&arc_virt_machine_reserved, pages);
-
-	/*
-	 * Since arc_virt_machine_reserved effectively lowers arc_c_max
-	 * as needed for vmm memory, if this request would put the arc
-	 * under arc_c_min, we reject it.  arc_c_min should be a value that
-	 * ensures reasonable performance for non-VMM stuff, as well as keep
-	 * us from dipping below lotsfree, which could trigger the pager
-	 * (and send the system toa grinding halt while it pages).
-	 *
-	 * XXX: This is a bit hacky and might be better done w/ a mutex
-	 * instead of atomic ops.
-	 */
-	if (newv + arc_c_min > arc_c_max) {
-		atomic_add_64(&arc_virt_machine_reserved, -(int64_t)pages);
-		return (ENOMEM);
-	}
-
-	zthr_wakeup(arc_reap_zthr);
-	return (0);
-}
-
-void
-arc_virt_machine_release(size_t pages)
-{
-	atomic_add_64(&arc_virt_machine_reserved, -(int64_t)pages);
-}
-
-/*
  * Return the amount of memory that can be consumed before reclaim will be
  * needed.  Positive if there is sufficient free memory, negative indicates
  * the amount of memory that needs to be freed up.
@@ -4665,17 +4622,6 @@
 		r = FMR_PAGES_PP_MAXIMUM;
 	}
 
-	/*
-	 * Check that we have enough memory for any virtual machines that
-	 * are running or starting. We add desfree to keep us out of
-	 * particularly dire circumstances.
-	 */
-	n = PAGESIZE * (availrmem - arc_virt_machine_reserved - desfree);
-	if (n < lowest) {
-		lowest = n;
-		r = FMR_VIRT_MACHINE;
-	}
-
 #if defined(__i386)
 	/*
 	 * If we're on an i386 platform, it's possible that we'll exhaust the
--- old/usr/src/uts/i86pc/io/vmm/sys/vmm_kernel.h	Tue Jul 27 14:35:29 2021
+++ new/usr/src/uts/i86pc/io/vmm/sys/vmm_kernel.h	Tue Jul 27 14:35:29 2021
@@ -196,8 +196,6 @@
 int vm_service_mmio_write(struct vm *vm, int cpuid, uint64_t gpa, uint64_t wval,
     int wsize);
 
-int vm_arc_resv(struct vm *vm, size_t);
-
 #ifdef _SYS__CPUSET_H_
 cpuset_t vm_active_cpus(struct vm *vm);
 cpuset_t vm_debug_cpus(struct vm *vm);
--- old/usr/src/uts/i86pc/io/vmm/vmm.c	Tue Jul 27 14:35:29 2021
+++ new/usr/src/uts/i86pc/io/vmm/vmm.c	Tue Jul 27 14:35:29 2021
@@ -38,7 +38,7 @@
  * http://www.illumos.org/license/CDDL.
  *
  * Copyright 2015 Pluribus Networks Inc.
- * Copyright 2021 Joyent, Inc.
+ * Copyright 2018 Joyent, Inc.
  * Copyright 2021 Oxide Computer Company
  * Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
  */
@@ -189,7 +189,6 @@
 	uint16_t	threads;		/* (o) num of threads/core */
 	uint16_t	maxcpus;		/* (o) max pluggable cpus */
 	uint64_t	boot_tsc_offset;	/* (i) TSC offset at VM boot */
-	size_t		arc_resv;		/* # of pages take from ARC */
 
 	struct ioport_config ioports;		/* (o) ioport handling */
 };
@@ -275,9 +274,6 @@
 static bool vcpu_sleep_bailout_checks(struct vm *vm, int vcpuid);
 static int vcpu_vector_sipi(struct vm *vm, int vcpuid, uint8_t vector);
 
-extern int arc_virt_machine_reserve(size_t);
-extern void arc_virt_machine_release(size_t);
-
 /* Flags for vtc_status */
 #define	VTCS_FPU_RESTORED	1 /* guest FPU restored, host FPU saved */
 #define	VTCS_FPU_CTX_CRITICAL	2 /* in ctx where FPU restore cannot be lazy */
@@ -623,9 +619,6 @@
 
 		VMSPACE_FREE(vm->vmspace);
 		vm->vmspace = NULL;
-
-		arc_virt_machine_release(vm->arc_resv);
-		vm->arc_resv = 0;
 	}
 }
 
@@ -3663,18 +3656,3 @@
 
 	return (0);
 }
-
-int
-vm_arc_resv(struct vm *vm, uint64_t len)
-{
-	/* Since we already have the compat macros included, we use those */
-	size_t pages = (size_t)roundup2(len, PAGE_SIZE) >> PAGE_SHIFT;
-	int err = 0;
-
-	err = arc_virt_machine_reserve(pages);
-	if (err != 0)
-		return (err);
-
-	vm->arc_resv += pages;
-	return (0);
-}
--- old/usr/src/uts/i86pc/io/vmm/vmm_sol_dev.c	Tue Jul 27 14:35:30 2021
+++ new/usr/src/uts/i86pc/io/vmm/vmm_sol_dev.c	Tue Jul 27 14:35:30 2021
@@ -12,7 +12,7 @@
 
 /*
  * Copyright 2015 Pluribus Networks Inc.
- * Copyright 2020 Joyent, Inc.
+ * Copyright 2019 Joyent, Inc.
  * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
  * Copyright 2021 Oxide Computer Company
  */
@@ -476,7 +476,6 @@
 	case VM_MUNMAP_MEMSEG:
 	case VM_WRLOCK_CYCLE:
 	case VM_PMTMR_LOCATE:
-	case VM_ARC_RESV:
 		vmm_write_lock(sc);
 		lock_type = LOCK_WRITE_HOLD;
 		break;
@@ -1412,9 +1411,7 @@
 		 */
 		break;
 	}
-	case VM_ARC_RESV:
-		error = vm_arc_resv(sc->vmm_vm, (uint64_t)arg);
-		break;
+
 	default:
 		error = ENOTTY;
 		break;
@@ -2189,7 +2186,7 @@
 	}
 
 	if (r != 0 && arg != (intptr_t)NULL) {
-		if (copyoutstr(msg, (char *)arg, strlen(msg), NULL) != 0)
+		if (copyoutstr(msg, (char *)arg, strlen(msg) + 1, NULL) != 0)
 			return (EFAULT);
 	}
 	return (r);
--- old/usr/src/uts/i86pc/sys/vmm_dev.h	Tue Jul 27 14:35:30 2021
+++ new/usr/src/uts/i86pc/sys/vmm_dev.h	Tue Jul 27 14:35:30 2021
@@ -38,7 +38,7 @@
  * http://www.illumos.org/license/CDDL.
  *
  * Copyright 2015 Pluribus Networks Inc.
- * Copyright 2020 Joyent, Inc.
+ * Copyright 2019 Joyent, Inc.
  */
 
 #ifndef	_VMM_DEV_H_
@@ -372,7 +372,6 @@
 #define	VM_RESUME_CPU			(VMM_IOC_BASE | 0x1e)
 
 #define	VM_PPTDEV_DISABLE_MSIX		(VMM_IOC_BASE | 0x1f)
-#define	VM_ARC_RESV			(VMM_IOC_BASE | 0xfe)
 
 #define	VM_DEVMEM_GETOFFSET		(VMM_IOC_BASE | 0xff)
 
--- old/usr/src/uts/i86pc/vmm/Makefile	Tue Jul 27 14:35:30 2021
+++ new/usr/src/uts/i86pc/vmm/Makefile	Tue Jul 27 14:35:30 2021
@@ -11,7 +11,7 @@
 
 #
 # Copyright 2013 Pluribus Networks Inc.
-# Copyright 2020 Joyent, Inc.
+# Copyright 2019 Joyent, Inc.
 #
 
 #
@@ -43,6 +43,7 @@
 #	Overrides and additions
 #
 
+
 # 3rd party code
 SMOFF += all_func_returns
 
@@ -59,7 +60,7 @@
 # enable collection of VMM statistics
 CFLAGS		+= -DVMM_KEEP_STATS
 
-LDFLAGS         += -N misc/acpica -N misc/pcie -N fs/dev -N fs/zfs
+LDFLAGS         += -N misc/acpica -N misc/pcie -N fs/dev
 LDFLAGS         += -z type=kmod -M $(MAPFILE)
 
 OFFSETS_VMX	= $(CONF_SRCDIR)/intel/offsets.in
