From owner-freebsd-virtualization@FreeBSD.ORG Mon Aug 11 14:51:56 2014 Return-Path: Delivered-To: freebsd-virtualization@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 ESMTPS id 0556E76D for ; Mon, 11 Aug 2014 14:51:56 +0000 (UTC) Received: from mail-pd0-x232.google.com (mail-pd0-x232.google.com [IPv6:2607:f8b0:400e:c02::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D49D9243D for ; Mon, 11 Aug 2014 14:51:55 +0000 (UTC) Received: by mail-pd0-f178.google.com with SMTP id w10so10949571pde.9 for ; Mon, 11 Aug 2014 07:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=ppasApl3vVVRXUPlbJ52j8fSHMxBwQYD21NsOcpa7SU=; b=J4Mxr9ylRz0/wWww7PMk/c6t/oqNZ002SxZILGH/IFlITSbGzuIz0NdLoRfHjJXMbC hoTV8qM9FSseiz1G+vbTf5YethLYs9NQ3X0z3L9liW5ekm8LMIP6F+sGg+RmWQEct4Vg 6tttlYxA4KqpVJaKl0PXdjfYOzKJHDtBTlVOQGQPW7jrV53vLMFmlAxRAJZ0WZboPrei Gum1HjMvq7tzua71bVzSQUaoncxHKhfMTt9/0RNMoVUcoLdUf9pk4UbbxxUZD2BdMzj5 wYlUTlLB4w4xSn/KmK6+b3eaw1oaDzjgAOXmkAGDxMAeXwxAMIO8U40EPFyzVFOUj/JS pzIQ== X-Received: by 10.66.124.226 with SMTP id ml2mr1838042pab.142.1407768715340; Mon, 11 Aug 2014 07:51:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.70.53.227 with HTTP; Mon, 11 Aug 2014 07:51:40 -0700 (PDT) From: Jordan Starcher Date: Mon, 11 Aug 2014 10:51:40 -0400 Message-ID: Subject: Shared CPU in Bhyve To: freebsd-virtualization@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18 X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2014 14:51:56 -0000 Hello, As I understand, one of the great features of bhyve is the ability to have completely isolated resources where a guest OS can only consume N number of CPUs. However, I only have 4 CPUs on my machine and would like to use bhyve to create a Linux guest on my FreeBSD host. I don't want to dedicate an entire CPU to the bhyve guest. Is it possible to limit the CPU execution of a bhyve guest, or better yet, change the CPU priority so if other processes on the host machine need the CPU they can have it? Is it as simple as changing the niceness of the bhyve process? Thank you, Jordan Starcher From owner-freebsd-virtualization@FreeBSD.ORG Mon Aug 11 15:36:40 2014 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D49F96B9 for ; Mon, 11 Aug 2014 15:36:40 +0000 (UTC) Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12]) by mx1.freebsd.org (Postfix) with ESMTP id 975DB290C for ; Mon, 11 Aug 2014 15:36:40 +0000 (UTC) Received: from dommail.onthenet.com.au (dommail.OntheNet.com.au [203.13.70.57]) by alto.onthenet.com.au (Postfix) with ESMTPS id 5E4D1124E8; Tue, 12 Aug 2014 01:36:33 +1000 (EST) Received: from Peter-Grehans-MacBook-Pro-2.local (c-67-161-27-37.hsd1.ca.comcast.net [67.161.27.37]) by dommail.onthenet.com.au (MOS 4.4.4-GA) with ESMTP id BXP61456 (AUTH peterg@ptree32.com.au); Tue, 12 Aug 2014 01:36:32 +1000 Message-ID: <53E8E2F8.4090603@freebsd.org> Date: Mon, 11 Aug 2014 08:36:24 -0700 From: Peter Grehan User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Jordan Starcher Subject: Re: Shared CPU in Bhyve References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2014 15:36:40 -0000 Hi Jordan, > As I understand, one of the great features of bhyve is the ability to have > completely isolated resources where a guest OS can only consume N number of > CPUs. However, I only have 4 CPUs on my machine and would like to use bhyve > to create a Linux guest on my FreeBSD host. I don't want to dedicate an > entire CPU to the bhyve guest. Is it possible to limit the CPU execution of > a bhyve guest, or better yet, change the CPU priority so if other processes > on the host machine need the CPU they can have it? Is it as simple as > changing the niceness of the bhyve process? Yes, that should work. bhyve also has idle detection, so it should only use as much CPU as the guest is using. For instance, an idle guest uses almost no host CPU. later, Peter. From owner-freebsd-virtualization@FreeBSD.ORG Tue Aug 12 09:44:25 2014 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6DA0AEF for ; Tue, 12 Aug 2014 09:44:25 +0000 (UTC) Received: from srv1.unix-users.de (srv1.unix-users.de [81.20.131.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.unix-users.de", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id ED2CE23FF for ; Tue, 12 Aug 2014 09:44:24 +0000 (UTC) Received: from localhost (bchm-4db63cff.pool.mediaWays.net [77.182.60.255]) (authenticated bits=0) by srv1.unix-users.de (8.14.9/8.14.5) with ESMTP id s7C9O8nh028213 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO) for ; Tue, 12 Aug 2014 11:24:08 +0200 (CEST) (envelope-from martin@unix-users.de) X-Authentication-Warning: srv1.unix-users.de: Host bchm-4db63cff.pool.mediaWays.net [77.182.60.255] claimed to be localhost Date: Tue, 12 Aug 2014 11:24:07 +0200 From: Martin Steegmanns To: freebsd-virtualization@freebsd.org Subject: Problem with vmexit on mtrap Message-ID: <20140812092407.GC11403@mail.demonism.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="zYM0uCDKw75PZbzx" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (srv1.unix-users.de [81.20.131.154]); Tue, 12 Aug 2014 11:24:08 +0200 (CEST) X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Aug 2014 09:44:25 -0000 --zYM0uCDKw75PZbzx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello list! I modified bhyve to toggle the MTF bit on an UD2 instruction. In a guest system, a program does: __asm__ __volatile__( "UD2" "NOP" "xor %rax,%rax" "NOP" "UD2" ); On the first UD2, MTF bit is correctly set, but the second UD2 is never reached (waited some hours). If I manually reset the MTF bit via bhyvectl --setcap, guest executione reaches the second UD2 instruction. A diff of my modifications is attached to this mail. Am I missing something on vmenter that makes the guest loop forever? Regards, Martin /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1074 vm vm1[0]: unhandled mtf vmexit at 0xffffffff804dde70 /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1063 vm vm1[0]: Resume execution at 0xffffffff804dde41 /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:2652 vm vm1[0]: returning from vmx_run: exitcode 6 /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1074 vm vm1[0]: unhandled mtf vmexit at 0xffffffff804dde41 /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1063 vm vm1[0]: Resume execution at 0xffffffff804dde39 /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:2652 vm vm1[0]: returning from vmx_run: exitcode 6 /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1074 vm vm1[0]: unhandled mtf vmexit at 0xffffffff804dde39 /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1063 vm vm1[0]: Resume execution at 0xffffffff804dde30 /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:2652 vm vm1[0]: returning from vmx_run: exitcode 6 /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1074 vm vm1[0]: unhandled mtf vmexit at 0xffffffff804dde30 /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1063 vm vm1[0]: Resume execution at 0xffffffff804dde27 /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:2652 vm vm1[0]: returning from vmx_run: exitcode 6 /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1074 vm vm1[0]: unhandled mtf vmexit at 0xffffffff804dde27 /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1063 vm vm1[0]: Resume execution at 0xffffffff804dde1f --zYM0uCDKw75PZbzx Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="mtrap_r269497.diff" Index: sys/amd64/vmm/intel/vmcs.c =================================================================== --- sys/amd64/vmm/intel/vmcs.c (revision 269497) +++ sys/amd64/vmm/intel/vmcs.c (working copy) @@ -418,7 +418,7 @@ goto done; /* exception bitmap */ - exc_bitmap = 1 << IDT_MC; + exc_bitmap = 1 << IDT_MC | 1 << IDT_UD; if ((error = vmwrite(VMCS_EXCEPTION_BITMAP, exc_bitmap)) != 0) goto done; Index: sys/amd64/vmm/intel/vmx.c =================================================================== --- sys/amd64/vmm/intel/vmx.c (revision 269497) +++ sys/amd64/vmm/intel/vmx.c (working copy) @@ -1024,6 +1024,20 @@ } static int +vmx_handle_exception(struct vmx *vmx, int vcpu, struct vm_exit *vme) +{ + + return (HANDLED); +} + +static int +vmx_handle_ud_exception(struct vmx *vmx, int vcpu, struct vm_exit *vme) +{ + + return (UNHANDLED); +} + +static int vmx_handle_cpuid(struct vm *vm, int vcpu, struct vmxctx *vmxctx) { int handled, func; @@ -2256,6 +2270,8 @@ break; case EXIT_REASON_MTF: vmm_stat_incr(vmx->vm, vcpu, VMEXIT_MTRAP, 1); + vmexit_inst_emul(vmexit, vmcs_gpa(), vmcs_gla()); + vmexit->inst_length = vmexit_instruction_length(); vmexit->exitcode = VM_EXITCODE_MTRAP; break; case EXIT_REASON_PAUSE: @@ -2334,6 +2350,14 @@ KASSERT((intr_info & VMCS_INTR_VALID) != 0, ("VM exit interruption info invalid: %#x", intr_info)); + if (intr_info & IDT_UD) { + vmexit->exitcode = VM_EXITCODE_UD; + handled = vmx_handle_ud_exception(vmx, vcpu, vmexit); + } else { + vmexit->exitcode = VM_EXITCODE_EXCEPTION; + handled = vmx_handle_exception(vmx, vcpu, vmexit); + } + /* * If Virtual NMIs control is 1 and the VM-exit is due to a * fault encountered during the execution of IRET then we must Index: sys/amd64/vmm/vmm.c =================================================================== --- sys/amd64/vmm/vmm.c (revision 269497) +++ sys/amd64/vmm/vmm.c (working copy) @@ -1153,6 +1153,14 @@ } static int +vm_handle_mtf(struct vm *vm, int vcpuid, bool *retu) +{ + *retu = true; + + return (0); +} + +static int vm_handle_paging(struct vm *vm, int vcpuid, bool *retu) { int rv, ftype; @@ -1380,6 +1388,7 @@ bool retu, intr_disabled; pmap_t pmap; void *rptr, *sptr; + int val; vcpuid = vmrun->cpuid; @@ -1441,6 +1450,9 @@ intr_disabled = ((vme->u.hlt.rflags & PSL_I) == 0); error = vm_handle_hlt(vm, vcpuid, intr_disabled, &retu); break; + case VM_EXITCODE_MTRAP: + error = vm_handle_mtf(vm, vcpuid, &retu); + break; case VM_EXITCODE_PAGING: error = vm_handle_paging(vm, vcpuid, &retu); break; @@ -1451,6 +1463,12 @@ case VM_EXITCODE_INOUT_STR: error = vm_handle_inout(vm, vcpuid, vme, &retu); break; + case VM_EXITCODE_UD: + val = 1; + VMGETCAP(vm->cookie, vcpuid, VM_CAP_MTRAP_EXIT, &val); + val = (val == 1)? 0 : 1; + VMSETCAP(vm->cookie, vcpuid, VM_CAP_MTRAP_EXIT, val); + break; default: retu = true; /* handled in userland */ break; Index: sys/modules/vmm/Makefile =================================================================== --- sys/modules/vmm/Makefile (revision 269497) +++ sys/modules/vmm/Makefile (working copy) @@ -4,7 +4,7 @@ SRCS= opt_acpi.h opt_ddb.h device_if.h bus_if.h pci_if.h -CFLAGS+= -DVMM_KEEP_STATS -DSMP +CFLAGS+= -DVMM_KEEP_STATS -DSMP -DKTR CFLAGS+= -I${.CURDIR}/../../amd64/vmm CFLAGS+= -I${.CURDIR}/../../amd64/vmm/io CFLAGS+= -I${.CURDIR}/../../amd64/vmm/intel --zYM0uCDKw75PZbzx-- From owner-freebsd-virtualization@FreeBSD.ORG Wed Aug 13 01:39:20 2014 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 24C62D99 for ; Wed, 13 Aug 2014 01:39:20 +0000 (UTC) Received: from mail-qa0-x234.google.com (mail-qa0-x234.google.com [IPv6:2607:f8b0:400d:c00::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DBD9024BE for ; Wed, 13 Aug 2014 01:39:19 +0000 (UTC) Received: by mail-qa0-f52.google.com with SMTP id j15so9658840qaq.11 for ; Tue, 12 Aug 2014 18:39:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=6ISVV57mRlzcz7Fr89U2vgzNxnlVud7RB4HwMkyOcXM=; b=DjgIsqdEiV7N3BREQPt1zSSvAfneA1OCOfofi+f83x+80DA/1ZWDDiDjVJMujbnXpW k+2EkLoxuuNBxGJmuf0K9wSxybrWFg/nzL7rgEQlTAH4sfD+5SyqpQQuT1WVUZ45S8UF 3mYyyXiDGueNO0Vl08u8qed+CeQHcp0H3ywHEUHAOQry4Ff78W5i2arxaoMqQz3CCOhk ApzBM1F8nMgYPRCQvIhg0RpJ92Vu/VfTrcoc0KDWA7ROa4OD81DSuax9fclgwVX77xEB 0ExyHS/kbuJoKzD+AXzDYj4kHZ3sGCqsh9jHKO+ggeem8+WKEbFD59v8foHfyx1VpRG6 mMXg== MIME-Version: 1.0 X-Received: by 10.224.95.74 with SMTP id c10mr1849905qan.35.1407893958886; Tue, 12 Aug 2014 18:39:18 -0700 (PDT) Received: by 10.140.84.80 with HTTP; Tue, 12 Aug 2014 18:39:18 -0700 (PDT) In-Reply-To: <20140812092407.GC11403@mail.demonism.de> References: <20140812092407.GC11403@mail.demonism.de> Date: Tue, 12 Aug 2014 18:39:18 -0700 Message-ID: Subject: Re: Problem with vmexit on mtrap From: Neel Natu To: Martin Steegmanns Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-virtualization@freebsd.org" X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 01:39:20 -0000 Hi Martin, On Tue, Aug 12, 2014 at 2:24 AM, Martin Steegmanns wrote: > Hello list! > I modified bhyve to toggle the MTF bit on an UD2 instruction. > In a guest system, a program does: > __asm__ __volatile__( > "UD2" > "NOP" > "xor %rax,%rax" > "NOP" > "UD2" > ); > > On the first UD2, MTF bit is correctly set, but the second > UD2 is never reached (waited some hours). > If I manually reset the MTF bit via bhyvectl --setcap, > guest executione reaches the second UD2 instruction. > > A diff of my modifications is attached to this mail. > > Am I missing something on vmenter that makes the guest loop forever? > The VM-exit instruction length field is valid only for a subset of VM exits. See section 27.2.4 "Information for VM exits due to instruction execution" in the Intel SDM. In particular, the instruction length is not guaranteed to be valid if the VM-exit is due to a hardware exception. Therefore it cannot be used to "skip over" the UD2 instruction. On my machine the VM-exit instruction length field was set to '2' for the first UD2 and '5' for the second UD2. For this specific test, you can either hardcode the instruction length to '2' if the VM exit is due to a UD2 or use an instruction like "OUT" to a specific I/O port to trigger the monitor-trap-flag on and off. A VM-exit due to "OUT" will have the correct value in the VM-exit instruction length field. best Neel > Regards, > Martin > > > /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1074 vm vm1[0]: unhandled mtf vmexit at 0xffffffff804dde70 > /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1063 vm vm1[0]: Resume execution at 0xffffffff804dde41 > /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:2652 vm vm1[0]: returning from vmx_run: exitcode 6 > /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1074 vm vm1[0]: unhandled mtf vmexit at 0xffffffff804dde41 > /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1063 vm vm1[0]: Resume execution at 0xffffffff804dde39 > /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:2652 vm vm1[0]: returning from vmx_run: exitcode 6 > /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1074 vm vm1[0]: unhandled mtf vmexit at 0xffffffff804dde39 > /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1063 vm vm1[0]: Resume execution at 0xffffffff804dde30 > /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:2652 vm vm1[0]: returning from vmx_run: exitcode 6 > /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1074 vm vm1[0]: unhandled mtf vmexit at 0xffffffff804dde30 > /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1063 vm vm1[0]: Resume execution at 0xffffffff804dde27 > /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:2652 vm vm1[0]: returning from vmx_run: exitcode 6 > /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1074 vm vm1[0]: unhandled mtf vmexit at 0xffffffff804dde27 > /usr/src/sys/modules/vmm/../../amd64/vmm/intel/vmx.c:1063 vm vm1[0]: Resume execution at 0xffffffff804dde1f > > > _______________________________________________ > freebsd-virtualization@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization > To unsubscribe, send any mail to "freebsd-virtualization-unsubscribe@freebsd.org" From owner-freebsd-virtualization@FreeBSD.ORG Wed Aug 13 09:12:29 2014 Return-Path: Delivered-To: freebsd-virtualization@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 ESMTPS id B7F76AC; Wed, 13 Aug 2014 09:12:29 +0000 (UTC) Received: from smtpo.poczta.interia.pl (smtpo.poczta.interia.pl [217.74.65.156]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 798A6284F; Wed, 13 Aug 2014 09:12:28 +0000 (UTC) Date: Wed, 13 Aug 2014 11:12:19 +0200 From: vermaden Subject: USB 2.0 Storage Device Pass Through on FreeBSD 10.x and VirtualBox 4.3.x To: freebsd-virtualization@freebsd.org, freebsd-emulation@freebsd.org X-Mailer: interia.pl/pf09 X-Originating-IP: 82.177.252.131 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=interia.pl; s=biztos; t=1407921139; bh=Dsy8Ii/GGZ9oU77jR0TRd0EVUQLeBQn+80I3Hacri3U=; h=Date:From:Subject:To:X-Mailer:X-Originating-IP:Message-Id: MIME-Version:Content-Type:Content-Transfer-Encoding; b=ox8sy4JVANAtApMjGxDnVWyKChYJbQpkzwS/NnwHa/L8MsLuywI7fMdLo9yPxeYWM /+wCutweeArbTsMjAnxClZIPpHX2GZGFijIlBi14JntCZ9PtMUgwGYG/97OiCYbpHh FsbRL97MrWlFr8AZcLDgZci39lFU39aE41ioVSis= X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 09:12:29 -0000 Hi, in older versions of Virtualbox (4.2.x) and FreeBSD (9.x) I was able to pass through the USB 2.0 storage devices (pendrives/disks/...) to the VirtualBox virtual machine, but it does not work now with FreeBSD 10.x and VirtualBox 4.3.x. The older known 'workaround' with **sysctl hw.usb.ehci.no_hs=1** also does not work, any hints? Regards, vermaden From owner-freebsd-virtualization@FreeBSD.ORG Wed Aug 13 19:20:03 2014 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D8EF7BB9 for ; Wed, 13 Aug 2014 19:20:03 +0000 (UTC) Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2lp0204.outbound.protection.outlook.com [207.46.163.204]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 50ED92252 for ; Wed, 13 Aug 2014 19:20:02 +0000 (UTC) Received: from BN1PR05CA002.namprd05.prod.outlook.com (10.255.197.22) by DM2PR05MB734.namprd05.prod.outlook.com (10.141.178.22) with Microsoft SMTP Server (TLS) id 15.0.995.14; Wed, 13 Aug 2014 19:19:55 +0000 Received: from BN1AFFO11FD041.protection.gbl (2a01:111:f400:7c10::163) by BN1PR05CA002.outlook.office365.com (2a01:111:e400:400::22) with Microsoft SMTP Server (TLS) id 15.0.1005.10 via Frontend Transport; Wed, 13 Aug 2014 19:19:54 +0000 Received: from P-EMF01-SAC.jnpr.net (66.129.239.15) by BN1AFFO11FD041.mail.protection.outlook.com (10.58.52.252) with Microsoft SMTP Server (TLS) id 15.0.1010.11 via Frontend Transport; Wed, 13 Aug 2014 19:19:54 +0000 Received: from magenta.juniper.net (172.17.27.123) by P-EMF01-SAC.jnpr.net (172.24.192.21) with Microsoft SMTP Server (TLS) id 14.3.146.0; Wed, 13 Aug 2014 12:19:52 -0700 Received: from juniper.net (eta.jnpr.net [172.21.19.189]) by magenta.juniper.net (8.11.3/8.11.3) with ESMTP id s7DJJln63745 for ; Wed, 13 Aug 2014 12:19:47 -0700 (PDT) (envelope-from amesh@juniper.net) Date: Wed, 13 Aug 2014 12:19:47 -0700 From: Arthur Mesh To: Subject: bhyve userboot -- lack of inb()/outb() in ficl Message-ID: <20140813191947.GO73055@juniper.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dBmMfAlnUmK8h9+K" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:66.129.239.15; CTRY:US; IPV:NLI; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(189002)(199003)(36756003)(110136001)(74662001)(81542001)(512954002)(106466001)(20776003)(81156004)(107886001)(77982001)(107046002)(83072002)(16796002)(74502001)(19580405001)(81342001)(4396001)(86362001)(80022001)(83506001)(6806004)(69596002)(87936001)(99396002)(92726001)(84676001)(84326002)(50986999)(19580395003)(76482001)(46102001)(33656002)(85306004)(71186001)(105596002)(54356999)(44976005)(95666004)(229853001)(21056001)(97736001)(68736004)(83322001)(85852003)(2351001)(79102001); DIR:OUT; SFP:; SCL:1; SRVR:DM2PR05MB734; H:P-EMF01-SAC.jnpr.net; FPR:; MLV:sfv; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-Forefront-PRVS: 0302D4F392 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.15 as permitted sender) Authentication-Results: spf=softfail (sender IP is 66.129.239.15) smtp.mailfrom=amesh@juniper.net; X-OriginatorOrg: juniper.net X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 19:20:04 -0000 --dBmMfAlnUmK8h9+K Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Folks, I noticed that userboot doesn't contain inb()/outb() bindings: =66rom loader(8): inb (port -- char) Reads a byte from a port. outb (port char --) Writes a byte to a port. Yet, manual page for bhyveload(8) claims: bhyveload is based on loader(8) and will present an interface identical to the FreeBSD loader on the user's terminal. Is there any interest in adding this functionality? Thanks --=20 Arthur Mesh Juniper Networks +1 408 936-4968 --dBmMfAlnUmK8h9+K Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQGcBAEBCAAGBQJT67pTAAoJEO/ZUtudxDntYrYL/1DIiEX+W3Ws5+hM1oyNpKoj t9fkYJ9oVt+9xpIWZZ+TY9aloAzfXhL2ms2owwvn3mLonmG2l1Fum59iuAAEGAz7 7iXxxqxg886kSgruD0onTXjTzpFTitnKN21/jgdUBI8GNzYE6LScTa/HC7hFdh/l rP55O3QP2vPjLmQPxFFEsoAtS0Hh5CxVlrOtHZ1C9qCBP8F4lM/GZTICcEVIbmxt JCnxuKWQC64Hem5Kw4cQQK1pDBMzLrdulNj32YS7hQgYpiBtBel1zlQH0lHif0Tx POA/jMYGqu4D1+fvDtTv/HqiSX5GF4H/t6pkm7TozmvaiBMXQ4vvjtySsBLz3vPV VfEV7fosxmt1HMwHSMWS3Ms7ACSZ3sLZK6qj/5vvG416gq6QdNYWLrVK6EI70R3E Rf1X+aPhQ8w3ZfUqv1OMqO0xLELAp9s0XA+cYN9aR82GoaijzuRsQzLewmp1Q5SV rdsROwY0+QpmNVJTvdy0oH5B+BBDp1WD7E8+tUjRKQ== =nQCE -----END PGP SIGNATURE----- --dBmMfAlnUmK8h9+K-- From owner-freebsd-virtualization@FreeBSD.ORG Wed Aug 13 21:20:32 2014 Return-Path: Delivered-To: freebsd-virtualization@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 ESMTPS id 490472D4 for ; Wed, 13 Aug 2014 21:20:32 +0000 (UTC) Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12]) by mx1.freebsd.org (Postfix) with ESMTP id 0C90420CC for ; Wed, 13 Aug 2014 21:20:31 +0000 (UTC) Received: from dommail.onthenet.com.au (dommail.OntheNet.com.au [203.13.70.57]) by alto.onthenet.com.au (Postfix) with ESMTPS id 68FF7124AE; Thu, 14 Aug 2014 07:20:23 +1000 (EST) Received: from Peter-Grehans-MacBook-Pro-2.local ([64.245.0.210]) by dommail.onthenet.com.au (MOS 4.4.4-GA) with ESMTP id BXS12848 (AUTH peterg@ptree32.com.au); Thu, 14 Aug 2014 07:20:22 +1000 Message-ID: <53EBD693.5080407@freebsd.org> Date: Wed, 13 Aug 2014 14:20:19 -0700 From: Peter Grehan User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Arthur Mesh Subject: Re: bhyve userboot -- lack of inb()/outb() in ficl References: <20140813191947.GO73055@juniper.net> In-Reply-To: <20140813191947.GO73055@juniper.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 21:20:32 -0000 Hi Arthur, > I noticed that userboot doesn't contain inb()/outb() bindings: > > from loader(8): > inb (port -- char) > Reads a byte from a port. > > outb (port char --) > Writes a byte to a port. > > > Yet, manual page for bhyveload(8) claims: > > bhyveload is based on loader(8) and will present an interface identical > to the FreeBSD loader on the user's terminal. > > > Is there any interest in adding this functionality? It won't work for bhyveload/userboot - the VM isn't actually running at that point so there's nowhere for the commands to go. I also don't think these commands are supported on non-x86 loaders either, so it could be claimed an issue with the man page :) I can put some text in the bhyveload man page to indicate that not all x86 commands are supported (smap, pnpscan etc). Were you looking at using inb/outb for anything in particular ? later, Peter. From owner-freebsd-virtualization@FreeBSD.ORG Wed Aug 13 23:46:54 2014 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 002C7D23; Wed, 13 Aug 2014 23:46:53 +0000 (UTC) Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2lp0204.outbound.protection.outlook.com [207.46.163.204]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3F6F22119; Wed, 13 Aug 2014 23:46:52 +0000 (UTC) Received: from BY2PR05CA002.namprd05.prod.outlook.com (10.242.32.32) by BLUPR05MB723.namprd05.prod.outlook.com (10.141.207.153) with Microsoft SMTP Server (TLS) id 15.0.1005.10; Wed, 13 Aug 2014 23:32:07 +0000 Received: from BN1BFFO11FD036.protection.gbl (2a01:111:f400:7c10::1:178) by BY2PR05CA002.outlook.office365.com (2a01:111:e400:2c2a::32) with Microsoft SMTP Server (TLS) id 15.0.1005.10 via Frontend Transport; Wed, 13 Aug 2014 23:32:06 +0000 Received: from P-EMF01-SAC.jnpr.net (66.129.239.15) by BN1BFFO11FD036.mail.protection.outlook.com (10.58.144.99) with Microsoft SMTP Server (TLS) id 15.0.1010.11 via Frontend Transport; Wed, 13 Aug 2014 23:32:05 +0000 Received: from magenta.juniper.net (172.17.27.123) by P-EMF01-SAC.jnpr.net (172.24.192.21) with Microsoft SMTP Server (TLS) id 14.3.146.0; Wed, 13 Aug 2014 16:32:05 -0700 Received: from juniper.net (eta.jnpr.net [172.21.19.189]) by magenta.juniper.net (8.11.3/8.11.3) with ESMTP id s7DNW2n39279; Wed, 13 Aug 2014 16:32:02 -0700 (PDT) (envelope-from amesh@juniper.net) Date: Wed, 13 Aug 2014 16:32:02 -0700 From: Arthur Mesh To: Peter Grehan Subject: Re: bhyve userboot -- lack of inb()/outb() in ficl Message-ID: <20140813233202.GT73055@juniper.net> References: <20140813191947.GO73055@juniper.net> <53EBD693.5080407@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="RXktk6VS9YWqgSjw" Content-Disposition: inline In-Reply-To: <53EBD693.5080407@freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:66.129.239.15; CTRY:US; IPV:NLI; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(199003)(189002)(24454002)(69596002)(76482001)(85852003)(46102001)(81342001)(106466001)(80022001)(92726001)(84326002)(31966008)(74502001)(74662001)(83506001)(84676001)(4396001)(92566001)(77982001)(107046002)(20776003)(81542001)(68736004)(19580395003)(85306004)(512954002)(79102001)(83322001)(83072002)(105596002)(71186001)(99396002)(76176999)(36756003)(33656002)(64706001)(97736001)(19580405001)(87936001)(81156004)(6806004)(95666004)(110136001)(16796002)(50986999)(21056001)(86362001)(102836001)(54356999); DIR:OUT; SFP:; SCL:1; SRVR:BLUPR05MB723; H:P-EMF01-SAC.jnpr.net; FPR:; MLV:sfv; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;UriScan:; X-Forefront-PRVS: 0302D4F392 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.15 as permitted sender) Authentication-Results: spf=softfail (sender IP is 66.129.239.15) smtp.mailfrom=amesh@juniper.net; X-OriginatorOrg: juniper.net Cc: freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 23:46:54 -0000 --RXktk6VS9YWqgSjw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 13, 2014 at 02:20:19PM -0700, Peter Grehan wrote: > It won't work for bhyveload/userboot - the VM isn't actually running=20 > at that point so there's nowhere for the commands to go. Interesting. Is it really the case that inb/outb need to go through VM? > I also don't think these commands are supported on non-x86 loaders=20 > either, so it could be claimed an issue with the man page :) I can put=20 > some text in the bhyveload man page to indicate that not all x86=20 > commands are supported (smap, pnpscan etc). That's probably true. > Were you looking at using inb/outb for anything in particular ? We're reading/writing x86-specific attributes such as nextboot,bootcause,etc to RTC memory.. Thanks --=20 Arthur Mesh Juniper Networks +1 408 936-4968 --RXktk6VS9YWqgSjw Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQGcBAEBCAAGBQJT6/VyAAoJEO/ZUtudxDntYN4L/A85KPTBSIvPBym9OdHFHnU3 y1nVnhKfhTLaUnFl2p+jn5SV+52LS//Ljrq7L8KIh/5aR3LUq4cVTTu72KXorb2v NLiysvAtr1C1DvWW7nRqoX5oOiaaqpI94WaxkC3/ZodfpOxZ67M/YKPXDNzU5RpH rHGlOy9TlhWHofyXgeySMtb7XMxG5i3p8dy8mWkaN9UxjrctwtPfhO+aJpFYzudI csmsZgvWIFsyr7uMm7eD3OGdHKflc/DWOzP5luPIUD4ITilIOhiLL4upoltzk8TK 2+foEqNsKIpJ0z4uEPcPGYPPr9MmXPKZTCyuzo19W+P6Z+jE/Ulak9lt6gbPyEIy M5IYtouMuQjftcdCNELLTpXJ4J2D2PQVCGjvUqkSwYMapNO0LTs5qrspep+qlqbL Tl5wxXO3YiNsFUecyDh50nQE2otRNdxyJPNHZjrAp7Z0Wz8O+/0HFXNg3cbwyunN 9crvfZH5/Q+baZzGeCpides/nSdvfZxBcQ4cYHcn5g== =XmJu -----END PGP SIGNATURE----- --RXktk6VS9YWqgSjw-- From owner-freebsd-virtualization@FreeBSD.ORG Thu Aug 14 00:58:55 2014 Return-Path: Delivered-To: freebsd-virtualization@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 ESMTPS id 3D680C45 for ; Thu, 14 Aug 2014 00:58:55 +0000 (UTC) Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12]) by mx1.freebsd.org (Postfix) with ESMTP id 00F5A27CA for ; Thu, 14 Aug 2014 00:58:54 +0000 (UTC) Received: from dommail.onthenet.com.au (dommail.OntheNet.com.au [203.13.70.57]) by alto.onthenet.com.au (Postfix) with ESMTPS id 8187A12630; Thu, 14 Aug 2014 10:58:52 +1000 (EST) Received: from Peter-Grehans-MacBook-Pro-2.local ([64.245.0.210]) by dommail.onthenet.com.au (MOS 4.4.4-GA) with ESMTP id BXS25978 (AUTH peterg@ptree32.com.au); Thu, 14 Aug 2014 10:58:51 +1000 Message-ID: <53EC09C9.7000600@freebsd.org> Date: Wed, 13 Aug 2014 17:58:49 -0700 From: Peter Grehan User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Arthur Mesh Subject: Re: bhyve userboot -- lack of inb()/outb() in ficl References: <20140813191947.GO73055@juniper.net> <53EBD693.5080407@freebsd.org> <20140813233202.GT73055@juniper.net> In-Reply-To: <20140813233202.GT73055@juniper.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2014 00:58:55 -0000 Hi Arthur, > On Wed, Aug 13, 2014 at 02:20:19PM -0700, Peter Grehan wrote: >> It won't work for bhyveload/userboot - the VM isn't actually >> running at that point so there's nowhere for the commands to go. > > Interesting. Is it really the case that inb/outb need to go through > VM? Yes - the device emulations that process inb/outb vm-exits are in /usr/sbin/bhyve so can only be accessed by a running guest. >> Were you looking at using inb/outb for anything in particular ? > > We're reading/writing x86-specific attributes such as > nextboot,bootcause,etc to RTC memory.. Ah, I suspected as such :( A possible solution might be to fix the lack of RTC nvram save/restore in bhyve, and modify bhyveload so that there is just enough emulation of inb/outb to access the RTC nvram file. The real solution for this, hopefully not too far away, is for bhyveload to disappear and have bhyve boot directly into UEFI (with CSM BIOS emulation). In that case, the guest's boot process would be run directly. later, Peter. From owner-freebsd-virtualization@FreeBSD.ORG Fri Aug 15 23:26:51 2014 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3AB3A88D; Fri, 15 Aug 2014 23:26:51 +0000 (UTC) Received: from mail-lb0-x22c.google.com (mail-lb0-x22c.google.com [IPv6:2a00:1450:4010:c04::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8D3562AB2; Fri, 15 Aug 2014 23:26:50 +0000 (UTC) Received: by mail-lb0-f172.google.com with SMTP id z11so2445029lbi.17 for ; Fri, 15 Aug 2014 16:26:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:cc:content-type; bh=N4tkImAiRb5laLnXG2HAeJcTMuCHm+RU2UIveuL/4JQ=; b=nYVR7S+xw/b1RPxnKet5XE9bLUB9ZkjNXiPp9oANpCb7oNN3cWuxdvdbdO7DcSZYDA KwZO4fOnI7Krbe1XG0U5Y1caZFdWFSN2WUo/qu9vSPltMbwA05Kt1TN8/Z9Ae0is5x7k cv8oM2504nC5zRgBVTPL3qM84TbSUXmxqyMdOU7lTJ3OSQ8JuyMokefJqZhU2VV7Mpd6 /UScwQknRNvJc9R3H5tOEBjBCNEr9bp92xLcnyhauScGNaQ9+5jKpkmCGYR2iuNVGE/2 dgINvoJ3nzz+gzOm63pNep+aPd2TZhRh7si+lHNfz45+1BtCE4qsWZPrMO9McTHynrIo ZhgA== MIME-Version: 1.0 X-Received: by 10.152.7.70 with SMTP id h6mr187404laa.96.1408145208399; Fri, 15 Aug 2014 16:26:48 -0700 (PDT) Sender: crodr001@gmail.com Received: by 10.112.197.107 with HTTP; Fri, 15 Aug 2014 16:26:48 -0700 (PDT) Date: Fri, 15 Aug 2014 16:26:48 -0700 X-Google-Sender-Auth: kn0CEr3m_NU67cx6E01mXdd06ns Message-ID: Subject: Patch to virt-manager port for bhyve From: Craig Rodrigues To: Jason Helfman Content-Type: text/plain; charset=ISO-8859-1 Cc: "freebsd-virtualization@freebsd.org" X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Aug 2014 23:26:51 -0000 Jason, Can you apply this patch to the virt-manager port: https://people.freebsd.org/~rodrigc/libvirt/patch-virtmanager-bhyve.txt This allows using virt-manager to start a bhyve VM. I gave a presentation on this at Bay Area FreeBSD Users Group (BAFUG) recently: http://www.slideshare.net/CraigRodrigues1/libvirt-bhyve Roman Bogorodskiy has pushed a similar patch upstream, but the upstream virt-manager code now depends on gtk3, and we don't fully have that supported in ports yet. Getting the newer virt-manager in ports with gtk3 supported is a big job, that I don't have the bandwidth for right now, but this patch helps a lot. Thanks! -- Craig From owner-freebsd-virtualization@FreeBSD.ORG Sat Aug 16 19:33:56 2014 Return-Path: Delivered-To: freebsd-virtualization@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 ESMTPS id 1A01E1FA for ; Sat, 16 Aug 2014 19:33:56 +0000 (UTC) Received: from srv1.unix-users.de (srv1.unix-users.de [81.20.131.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.unix-users.de", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E30A2EBD for ; Sat, 16 Aug 2014 19:33:54 +0000 (UTC) Received: from localhost (bchm-4db63574.pool.mediaWays.net [77.182.53.116]) (authenticated bits=0) by srv1.unix-users.de (8.14.9/8.14.5) with ESMTP id s7GJXjej010834 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Sat, 16 Aug 2014 21:33:46 +0200 (CEST) (envelope-from martin@unix-users.de) X-Authentication-Warning: srv1.unix-users.de: Host bchm-4db63574.pool.mediaWays.net [77.182.53.116] claimed to be localhost Date: Sat, 16 Aug 2014 21:33:45 +0200 From: Martin Steegmanns To: Neel Natu Subject: Re: Problem with vmexit on mtrap Message-ID: <20140816193345.GC5519@mail.demonism.de> References: <20140812092407.GC11403@mail.demonism.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (srv1.unix-users.de [81.20.131.154]); Sat, 16 Aug 2014 21:33:46 +0200 (CEST) Cc: "freebsd-virtualization@freebsd.org" X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 19:33:56 -0000 On Tue, Aug 12, 2014 at 06:39:18PM -0700, Neel Natu wrote: > The VM-exit instruction length field is valid only for a subset of VM > exits. See section 27.2.4 "Information for VM exits due to instruction > execution" in the Intel SDM. > > In particular, the instruction length is not guaranteed to be valid if > the VM-exit is due to a hardware exception. Therefore it cannot be > used to "skip over" the UD2 instruction. > > On my machine the VM-exit instruction length field was set to '2' for > the first UD2 and '5' for the second UD2. OK, thx for the clarification. > For this specific test, you can either hardcode the instruction length > to '2' if the VM exit is due to a UD2 or use an instruction like "OUT" > to a specific I/O port to trigger the monitor-trap-flag on and off. A > VM-exit due to "OUT" will have the correct value in the VM-exit > instruction length field. But this "instruction length" issue only affects my way to toggle the MTF bit. The MTF itself does not rely internally on the "instruction length" field, or does it? As far as I understand, bhyve does not need a valid instruction length for MTF, because the handler returns VMEXIT_RESTART. No need for bhyve to adjust the rip on vmentry. If I set the MTF bit via bhyvectl, the guest system still seems to enter a loop. My mtrap handler writes the RIP to a file, but all I see are high addresses e.g: 0xffffffff806bf0b0 Xapic_isr1 According to kdb, these are addresses point to Xapic_isr1 and interrupt handlers. I wonder if a vmexit caused by the MTF could overlay with another vmexit. With the MTF bit set, I expect the guest system to behave exactly as without the MTF bit. Of course slower due to single stepping :). Regards, Martin