From owner-freebsd-current@FreeBSD.ORG Wed Jan 7 05:59:03 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D956DC38; Wed, 7 Jan 2015 05:59:03 +0000 (UTC) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 8DD9EEF0; Wed, 7 Jan 2015 05:59:03 +0000 (UTC) Received: from Julian-MBP3.local (ppp121-45-233-252.lns20.per1.internode.on.net [121.45.233.252]) (authenticated bits=0) by vps1.elischer.org (8.14.9/8.14.9) with ESMTP id t075wsEK007209 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 6 Jan 2015 21:58:56 -0800 (PST) (envelope-from julian@freebsd.org) Message-ID: <54ACCB18.4060107@freebsd.org> Date: Wed, 07 Jan 2015 13:58:48 +0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: John Baldwin , Craig Rodrigues , Luigi Rizzo Subject: Re: any primer on running bhyve guests sharing disk with host ? References: <20150103161511.GA94237@onelab2.iet.unipi.it> <54ABF75D.5060302@FreeBSD.org> In-Reply-To: <54ABF75D.5060302@FreeBSD.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-current Current , Neel Natu X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jan 2015 05:59:04 -0000 On 1/6/15 10:55 PM, John Baldwin wrote: > On 1/3/15 1:43 PM, Craig Rodrigues wrote: >> On Sat, Jan 3, 2015 at 8:15 AM, Luigi Rizzo wrote: >> >>> Hi, >>> in order to do some kernel testing, I would like to run bhyve guests >>> using (through NFS, probably) the host's file system. >>> diskless(8) is probably one way to go, i was wondering if >>> someone has instructions for that. >>> Specifically: >>> - how to "bhyveload" a kernel (rather than the full disk image); >>> as an alternative, given a kernel, something to build an image >>> that can be passed to bhyveload >>> >>> - how to pass the necessary config (rootpath) to the client >>> without having to rely on a specialized dhcp server >>> >>> I used to be familiar with diskless configs, so i can probably sort >>> out the server side myself. >>> > < Neel already covered -h with bhyveload which you can also use with -H > to vmrun.sh, though the other way I do this is to NFS export my work > tree from the host to the guest so I can run kgdb on the host but do the > build / install in the guest itself. > > >> I don't think there is a way to do exactly what you want. >> I would recommend doing the following: >> >> (1) Enable bvmdebug in your kernel config: >> https://wiki.freebsd.org/BHyVe/gdb >> This allows you to do kgdb remote debugging into a bhyve VM. > At this point it is probably simpler to use the serial port instead. I > have hacked up vmrun.sh locally to always create a /dev/nmdm2B > device hooked up to com2 and to add 0x80 to the flags for uart1 in > device.hints in all my VMs. You can then use kgdb from the host and > 'target remote /dev/nmdm2A'. I've found the main good part of using bvmdebug is the ability to attach to it from a different machine using tcp. I think bhyve should offer the opportunity to make ALL serial ports or similar be attached to sockets.. > > --- /usr/share/examples/bhyve/vmrun.sh 2014-11-20 18:38:34.000000000 -0500 > +++ /home/john/bhyve/vmrun.sh 2015-01-06 09:54:47.000000000 -0500 > @@ -230,6 +230,9 @@ > nextslot=$(($nextslot + 1)) > i=$(($i + 1)) > done > + if kldstat -qm nmdm; then > + devargs="$devargs -l com2,/dev/nmdm${vmname}2B" > + fi > > ${FBSDRUN} -c ${cpus} -m ${memsize} ${apic_opt} -A -H -P \ > -g ${gdbport} \ > >