diff options
author | Mike Zeller <mike@mikezeller.net> | 2021-06-24 16:30:51 -0400 |
---|---|---|
committer | Mike Zeller <mike@mikezeller.net> | 2021-07-27 16:25:06 -0400 |
commit | 104b08ff82d4eacfced98592710a8d27db4bf41f (patch) | |
tree | c2850ffc7d6f63ab1c81f023e451126d6b6868b6 | |
parent | 359c7fef8f9958b51fa2670e2e52e3d3c1eb9bf4 (diff) | |
download | illumos-joyent-104b08ff82d4eacfced98592710a8d27db4bf41f.tar.gz |
OS-8287 Back out OS-8005 in favor of illumos#13822
-rw-r--r-- | usr/src/cmd/bhyve/bhyverun.c | 7 | ||||
-rw-r--r-- | usr/src/lib/libvmmapi/common/mapfile-vers | 3 | ||||
-rw-r--r-- | usr/src/lib/libvmmapi/common/vmmapi.c | 8 | ||||
-rw-r--r-- | usr/src/lib/libvmmapi/common/vmmapi.h | 3 | ||||
-rw-r--r-- | usr/src/uts/common/fs/zfs/arc.c | 56 | ||||
-rw-r--r-- | usr/src/uts/i86pc/io/vmm/sys/vmm_kernel.h | 2 | ||||
-rw-r--r-- | usr/src/uts/i86pc/io/vmm/vmm.c | 26 | ||||
-rw-r--r-- | usr/src/uts/i86pc/io/vmm/vmm_sol_dev.c | 7 | ||||
-rw-r--r-- | usr/src/uts/i86pc/sys/vmm_dev.h | 3 | ||||
-rw-r--r-- | usr/src/uts/i86pc/vmm/Makefile | 5 |
10 files changed, 11 insertions, 109 deletions
diff --git a/usr/src/cmd/bhyve/bhyverun.c b/usr/src/cmd/bhyve/bhyverun.c index 66aab60faa..9531db8fef 100644 --- a/usr/src/cmd/bhyve/bhyverun.c +++ b/usr/src/cmd/bhyve/bhyverun.c @@ -1582,13 +1582,6 @@ main(int argc, char *argv[]) #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); diff --git a/usr/src/lib/libvmmapi/common/mapfile-vers b/usr/src/lib/libvmmapi/common/mapfile-vers index f8fe6f058e..2489376b62 100644 --- a/usr/src/lib/libvmmapi/common/mapfile-vers +++ b/usr/src/lib/libvmmapi/common/mapfile-vers @@ -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 @@ SYMBOL_VERSION ILLUMOSprivate { vm_activate_cpu; vm_active_cpus; vm_apicid2vcpu; - vm_arc_resv; vm_assign_pptdev; vm_capability_name2type; vm_capability_type2name; diff --git a/usr/src/lib/libvmmapi/common/vmmapi.c b/usr/src/lib/libvmmapi/common/vmmapi.c index 0810eb9251..ba3fb7f8dd 100644 --- a/usr/src/lib/libvmmapi/common/vmmapi.c +++ b/usr/src/lib/libvmmapi/common/vmmapi.c @@ -1942,14 +1942,6 @@ vm_set_run_state(struct vmctx *ctx, int vcpu, enum vcpu_run_state state, 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__ diff --git a/usr/src/lib/libvmmapi/common/vmmapi.h b/usr/src/lib/libvmmapi/common/vmmapi.h index c244e03815..79c7dc02ee 100644 --- a/usr/src/lib/libvmmapi/common/vmmapi.h +++ b/usr/src/lib/libvmmapi/common/vmmapi.h @@ -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 @@ int vm_get_run_state(struct vmctx *ctx, int vcpu, enum vcpu_run_state *state, 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__ diff --git a/usr/src/uts/common/fs/zfs/arc.c b/usr/src/uts/common/fs/zfs/arc.c index 37ec80e4b3..1e3e3b7a24 100644 --- a/usr/src/uts/common/fs/zfs/arc.c +++ b/usr/src/uts/common/fs/zfs/arc.c @@ -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 @@ typedef enum free_memory_reason_t { 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,48 +4559,6 @@ int64_t arc_pages_pp_reserve = 64; */ 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 @@ -4665,17 +4622,6 @@ arc_available_memory(void) 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 diff --git a/usr/src/uts/i86pc/io/vmm/sys/vmm_kernel.h b/usr/src/uts/i86pc/io/vmm/sys/vmm_kernel.h index 4b4260f430..8441b51e03 100644 --- a/usr/src/uts/i86pc/io/vmm/sys/vmm_kernel.h +++ b/usr/src/uts/i86pc/io/vmm/sys/vmm_kernel.h @@ -196,8 +196,6 @@ int vm_service_mmio_read(struct vm *vm, int cpuid, uint64_t gpa, uint64_t *rval, 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); diff --git a/usr/src/uts/i86pc/io/vmm/vmm.c b/usr/src/uts/i86pc/io/vmm/vmm.c index c15a1118d8..425969d622 100644 --- a/usr/src/uts/i86pc/io/vmm/vmm.c +++ b/usr/src/uts/i86pc/io/vmm/vmm.c @@ -38,8 +38,8 @@ * http://www.illumos.org/license/CDDL. * * Copyright 2015 Pluribus Networks Inc. - * Copyright 2021 Joyent, Inc. - * Copyright 2021 Oxide Computer Company + * Copyright 2018 Joyent, Inc. + * Copyright 2020 Oxide Computer Company * Copyright 2021 OmniOS Community Edition (OmniOSce) Association. */ @@ -189,7 +189,6 @@ struct vm { 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 void vcpu_notify_event_locked(struct vcpu *vcpu, vcpu_notify_t); 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 @@ vm_cleanup(struct vm *vm, bool destroy) VMSPACE_FREE(vm->vmspace); vm->vmspace = NULL; - - arc_virt_machine_release(vm->arc_resv); - vm->arc_resv = 0; } } @@ -3663,18 +3656,3 @@ vmm_kstat_update_vcpu(struct kstat *ksp, int rw) 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); -} diff --git a/usr/src/uts/i86pc/io/vmm/vmm_sol_dev.c b/usr/src/uts/i86pc/io/vmm/vmm_sol_dev.c index f5c1fa8d82..56869e4c01 100644 --- a/usr/src/uts/i86pc/io/vmm/vmm_sol_dev.c +++ b/usr/src/uts/i86pc/io/vmm/vmm_sol_dev.c @@ -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 @@ vmmdev_do_ioctl(vmm_softc_t *sc, int cmd, intptr_t arg, int md, 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 @@ vmmdev_do_ioctl(vmm_softc_t *sc, int cmd, intptr_t arg, int md, */ break; } - case VM_ARC_RESV: - error = vm_arc_resv(sc->vmm_vm, (uint64_t)arg); - break; + default: error = ENOTTY; break; diff --git a/usr/src/uts/i86pc/sys/vmm_dev.h b/usr/src/uts/i86pc/sys/vmm_dev.h index a0f4569be2..15c64355c4 100644 --- a/usr/src/uts/i86pc/sys/vmm_dev.h +++ b/usr/src/uts/i86pc/sys/vmm_dev.h @@ -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 @@ struct vm_run_state { #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) diff --git a/usr/src/uts/i86pc/vmm/Makefile b/usr/src/uts/i86pc/vmm/Makefile index 2c0843f165..0106dd0a0f 100644 --- a/usr/src/uts/i86pc/vmm/Makefile +++ b/usr/src/uts/i86pc/vmm/Makefile @@ -11,7 +11,7 @@ # # Copyright 2013 Pluribus Networks Inc. -# Copyright 2020 Joyent, Inc. +# Copyright 2019 Joyent, Inc. # # @@ -43,6 +43,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # Overrides and additions # + # 3rd party code SMOFF += all_func_returns @@ -59,7 +60,7 @@ AS_INC_PATH += -I$(UTSBASE)/i86pc/io/vmm -I$(OBJS_DIR) # 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 |