From owner-svn-src-head@FreeBSD.ORG Fri Oct 4 23:29:08 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C640CFB6; Fri, 4 Oct 2013 23:29:08 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A445E2D31; Fri, 4 Oct 2013 23:29:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r94NT8vD061189; Fri, 4 Oct 2013 23:29:08 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r94NT8x7061186; Fri, 4 Oct 2013 23:29:08 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201310042329.r94NT8x7061186@svn.freebsd.org> From: Peter Grehan Date: Fri, 4 Oct 2013 23:29:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r256062 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Oct 2013 23:29:08 -0000 Author: grehan Date: Fri Oct 4 23:29:07 2013 New Revision: 256062 URL: http://svnweb.freebsd.org/changeset/base/256062 Log: Remove obsolete cmd-line options and code associated with these. The mux-vcpus option may return at some point, given it's utility in finding bhyve (and FreeBSD) bugs. Approved by: re@ (blanket) Discussed with: neel@ Modified: head/usr.sbin/bhyve/bhyverun.c head/usr.sbin/bhyve/bhyverun.h head/usr.sbin/bhyve/pit_8254.c Modified: head/usr.sbin/bhyve/bhyverun.c ============================================================================== --- head/usr.sbin/bhyve/bhyverun.c Fri Oct 4 22:05:23 2013 (r256061) +++ head/usr.sbin/bhyve/bhyverun.c Fri Oct 4 23:29:07 2013 (r256062) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -61,9 +60,6 @@ __FBSDID("$FreeBSD$"); #include "spinup_ap.h" #include "rtc.h" -#define DEFAULT_GUEST_HZ 100 -#define DEFAULT_GUEST_TSLICE 200 - #define GUEST_NIO_PORT 0x488 /* guest upcalls via i/o port */ #define VMEXIT_SWITCH 0 /* force vcpu switch in mux mode */ @@ -77,14 +73,11 @@ __FBSDID("$FreeBSD$"); typedef int (*vmexit_handler_t)(struct vmctx *, struct vm_exit *, int *vcpu); -int guest_tslice = DEFAULT_GUEST_TSLICE; -int guest_hz = DEFAULT_GUEST_HZ; char *vmname; int guest_ncpus; static int pincpu = -1; -static int guest_vcpu_mux; static int guest_vmexit_on_hlt, guest_vmexit_on_pause, disable_x2apic; static int foundcpus; @@ -102,7 +95,7 @@ static void vm_loop(struct vmctx *ctx, i struct vm_exit vmexit[VM_MAXCPU]; -struct fbsdstats { +struct bhyvestats { uint64_t vmexit_bogus; uint64_t vmexit_bogus_switch; uint64_t vmexit_hlt; @@ -125,28 +118,24 @@ usage(int code) { fprintf(stderr, - "Usage: %s [-aehABHIP][-g ][-z ][-s ]" - "[-S ][-p pincpu][-n ][-m lowmem][-M highmem]" + "Usage: %s [-aehAHIP][-g ][-s ][-S ]" + "[-c vcpus][-p pincpu][-m mem]" " \n" " -a: local apic is in XAPIC mode (default is X2APIC)\n" " -A: create an ACPI table\n" " -g: gdb port (default is %d and 0 means don't open)\n" " -c: # cpus (default 1)\n" " -p: pin vcpu 'n' to host cpu 'pincpu + n'\n" - " -B: inject breakpoint exception on vm entry\n" " -H: vmexit from the guest on hlt\n" " -I: present an ioapic to the guest\n" " -P: vmexit from the guest on pause\n" " -e: exit on unhandled i/o access\n" " -h: help\n" - " -z: guest hz (default is %d)\n" " -s: PCI slot config\n" " -S: legacy PCI slot config\n" - " -m: memory size in MB\n" - " -x: mux vcpus to 1 hcpu\n" - " -t: mux vcpu timeslice hz (default %d)\n", - progname, DEFAULT_GDB_PORT, DEFAULT_GUEST_HZ, - DEFAULT_GUEST_TSLICE); + " -m: memory size in MB\n", + progname, DEFAULT_GDB_PORT); + exit(code); } @@ -178,13 +167,6 @@ fbsdrun_vmexit_on_hlt(void) return (guest_vmexit_on_hlt); } -int -fbsdrun_muxed(void) -{ - - return (guest_vcpu_mux); -} - static void * fbsdrun_start_thread(void *param) { @@ -226,7 +208,7 @@ fbsdrun_addcpu(struct vmctx *ctx, int vc vmexit[vcpu].rip = rip; vmexit[vcpu].inst_length = 0; - if (vcpu == BSP || !guest_vcpu_mux){ + if (vcpu == BSP) { mt_vmm_info[vcpu].mt_ctx = ctx; mt_vmm_info[vcpu].mt_vcpu = vcpu; @@ -264,17 +246,10 @@ static int vmexit_handle_notify(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu, uint32_t eax) { -#if PG_DEBUG /* put all types of debug here */ - if (eax == 0) { - pause_noswitch = 1; - } else if (eax == 1) { - pause_noswitch = 0; - } else { - pause_noswitch = 0; - if (eax == 5) { - vm_set_capability(ctx, *pvcpu, VM_CAP_MTRAP_EXIT, 1); - } - } +#if BHYVE_DEBUG + /* + * put guest-driven debug here + */ #endif return (VMEXIT_CONTINUE); } @@ -337,11 +312,6 @@ vmexit_wrmsr(struct vmctx *ctx, struct v newcpu = emulate_wrmsr(ctx, *pvcpu, vme->u.msr.code,vme->u.msr.wval); - if (guest_vcpu_mux && *pvcpu != newcpu) { - retval = VMEXIT_SWITCH; - *pvcpu = newcpu; - } - return (retval); } @@ -354,11 +324,6 @@ vmexit_spinup_ap(struct vmctx *ctx, stru newcpu = spinup_ap(ctx, *pvcpu, vme->u.spinup_ap.vcpu, vme->u.spinup_ap.rip); - if (guest_vcpu_mux && *pvcpu != newcpu) { - retval = VMEXIT_SWITCH; - *pvcpu = newcpu; - } - return (retval); } @@ -378,58 +343,42 @@ vmexit_vmx(struct vmctx *ctx, struct vm_ return (VMEXIT_ABORT); } -static int bogus_noswitch = 1; - static int vmexit_bogus(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { + stats.vmexit_bogus++; - if (!guest_vcpu_mux || guest_ncpus == 1 || bogus_noswitch) { - return (VMEXIT_RESTART); - } else { - stats.vmexit_bogus_switch++; - vmexit->inst_length = 0; - *pvcpu = -1; - return (VMEXIT_SWITCH); - } + return (VMEXIT_RESTART); } static int vmexit_hlt(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { + stats.vmexit_hlt++; - if (fbsdrun_muxed()) { - *pvcpu = -1; - return (VMEXIT_SWITCH); - } else { - /* - * Just continue execution with the next instruction. We use - * the HLT VM exit as a way to be friendly with the host - * scheduler. - */ - return (VMEXIT_CONTINUE); - } -} -static int pause_noswitch; + /* + * Just continue execution with the next instruction. We use + * the HLT VM exit as a way to be friendly with the host + * scheduler. + */ + return (VMEXIT_CONTINUE); +} static int vmexit_pause(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { + stats.vmexit_pause++; - if (fbsdrun_muxed() && !pause_noswitch) { - *pvcpu = -1; - return (VMEXIT_SWITCH); - } else { - return (VMEXIT_CONTINUE); - } + return (VMEXIT_CONTINUE); } static int vmexit_mtrap(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { + stats.vmexit_mtrap++; return (VMEXIT_RESTART); @@ -460,39 +409,6 @@ vmexit_paging(struct vmctx *ctx, struct return (VMEXIT_CONTINUE); } -static void -sigalrm(int sig) -{ - return; -} - -static void -setup_timeslice(void) -{ - struct sigaction sa; - struct itimerval itv; - int error; - - /* - * Setup a realtime timer to generate a SIGALRM at a - * frequency of 'guest_tslice' ticks per second. - */ - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = sigalrm; - - error = sigaction(SIGALRM, &sa, NULL); - assert(error == 0); - - itv.it_interval.tv_sec = 0; - itv.it_interval.tv_usec = 1000000 / guest_tslice; - itv.it_value.tv_sec = 0; - itv.it_value.tv_usec = 1000000 / guest_tslice; - - error = setitimer(ITIMER_REAL, &itv, NULL); - assert(error == 0); -} - static vmexit_handler_t handler[VM_EXITCODE_MAX] = { [VM_EXITCODE_INOUT] = vmexit_inout, [VM_EXITCODE_VMX] = vmexit_vmx, @@ -511,9 +427,6 @@ vm_loop(struct vmctx *ctx, int vcpu, uin int error, rc, prevcpu; enum vm_exitcode exitcode; - if (guest_vcpu_mux) - setup_timeslice(); - if (pincpu >= 0) { CPU_ZERO(&mask); CPU_SET(pincpu + vcpu, &mask); @@ -550,15 +463,6 @@ vm_loop(struct vmctx *ctx, int vcpu, uin rc = (*handler[exitcode])(ctx, &vmexit[vcpu], &vcpu); switch (rc) { - case VMEXIT_SWITCH: - assert(guest_vcpu_mux); - if (vcpu == -1) { - stats.cpu_switch_rotate++; - vcpu = fbsdrun_get_next_cpu(prevcpu); - } else { - stats.cpu_switch_direct++; - } - /* fall through */ case VMEXIT_CONTINUE: rip = vmexit[vcpu].rip + vmexit[vcpu].inst_length; break; @@ -594,21 +498,20 @@ num_vcpus_allowed(struct vmctx *ctx) int main(int argc, char *argv[]) { - int c, error, gdb_port, inject_bkpt, tmp, err, ioapic, bvmcons; + int c, error, gdb_port, tmp, err, ioapic, bvmcons; int max_vcpus; struct vmctx *ctx; uint64_t rip; size_t memsize; bvmcons = 0; - inject_bkpt = 0; progname = basename(argv[0]); gdb_port = DEFAULT_GDB_PORT; guest_ncpus = 1; ioapic = 0; memsize = 256 * MB; - while ((c = getopt(argc, argv, "abehABHIPxp:g:c:z:s:S:n:m:")) != -1) { + while ((c = getopt(argc, argv, "abehAHIPp:g:c:s:S:m:")) != -1) { switch (c) { case 'a': disable_x2apic = 1; @@ -619,12 +522,6 @@ main(int argc, char *argv[]) case 'b': bvmcons = 1; break; - case 'B': - inject_bkpt = 1; - break; - case 'x': - guest_vcpu_mux = 1; - break; case 'p': pincpu = atoi(optarg); break; @@ -634,12 +531,6 @@ main(int argc, char *argv[]) case 'g': gdb_port = atoi(optarg); break; - case 'z': - guest_hz = atoi(optarg); - break; - case 't': - guest_tslice = atoi(optarg); - break; case 's': if (pci_parse_slot(optarg, 0) != 0) exit(1); @@ -677,16 +568,6 @@ main(int argc, char *argv[]) if (argc != 1) usage(1); - /* No need to mux if guest is uni-processor */ - if (guest_ncpus <= 1) - guest_vcpu_mux = 0; - - /* vmexit on hlt if guest is muxed */ - if (guest_vcpu_mux) { - guest_vmexit_on_hlt = 1; - guest_vmexit_on_pause = 1; - } - vmname = argv[0]; ctx = vm_open(vmname); @@ -765,11 +646,6 @@ main(int argc, char *argv[]) error = vm_get_register(ctx, BSP, VM_REG_GUEST_RIP, &rip); assert(error == 0); - if (inject_bkpt) { - error = vm_inject_event(ctx, BSP, VM_HW_EXCEPTION, IDT_BP); - assert(error == 0); - } - /* * build the guest tables, MP etc. */ Modified: head/usr.sbin/bhyve/bhyverun.h ============================================================================== --- head/usr.sbin/bhyve/bhyverun.h Fri Oct 4 22:05:23 2013 (r256061) +++ head/usr.sbin/bhyve/bhyverun.h Fri Oct 4 23:29:07 2013 (r256062) @@ -36,8 +36,6 @@ #endif struct vmctx; -extern int guest_hz; -extern int guest_tslice; extern int guest_ncpus; extern char *vmname; Modified: head/usr.sbin/bhyve/pit_8254.c ============================================================================== --- head/usr.sbin/bhyve/pit_8254.c Fri Oct 4 22:05:23 2013 (r256061) +++ head/usr.sbin/bhyve/pit_8254.c Fri Oct 4 23:29:07 2013 (r256062) @@ -153,10 +153,10 @@ pit_update_counter(struct counter *c, in * of the program. * * If the counter's initial value is not programmed we - * assume a value that would be set to generate 'guest_hz' + * assume a value that would be set to generate 100 * interrupts per second. */ - c->initial = TIMER_DIV(PIT_8254_FREQ, guest_hz); + c->initial = TIMER_DIV(PIT_8254_FREQ, 100); gettimeofday(&c->tv, NULL); }