Update bhyve chapter with note on CPU UG feature and zfs vol examples

PR:		201578
Submitted by:	Shawn Debnath <shawn@debnath.net>
Approved by:	wblock (mentor)
Differential Revision:	https://reviews.freebsd.org/D3105
This commit is contained in:
Allan Jude 2015-07-21 17:55:37 +00:00
parent 70cdc29ef1
commit 65f9164dd7
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=47035

View file

@ -1320,19 +1320,25 @@ perm pass* 0660</programlisting>
requires a computer with a newer processor that supports &intel;
Extended Page Tables (<acronym>EPT</acronym>) or &amd; Rapid
Virtualization Indexing (<acronym>RVI</acronym>), also known as
Nested Page Tables (<acronym>NPT</acronym>). Most newer
processors, specifically the &intel;&nbsp;&core; i3/i5/i7 and
&intel;&nbsp;&xeon; E3/E5/E7, support this feature. For a
complete list of &intel; processors that support
<acronym>EPT</acronym>, refer to <link
xlink:href="http://ark.intel.com/search/advanced?s=t&amp;ExtendedPageTables=true">http://ark.intel.com/search/advanced?s=t&amp;ExtendedPageTables=true</link>.
<acronym>RVI</acronym> is found on the 3rd generation and later
of the &amd.opteron; (Barcelona) processors. The easiest way to
check for support of <acronym>EPT</acronym> or
<acronym>RVI</acronym> is to look for the
<literal>POPCNT</literal> processor feature flag on the
<literal>Features2</literal> line in <command>dmesg</command> or
<filename>/var/run/dmesg.boot</filename>.</para>
Nested Page Tables (<acronym>NPT</acronym>). In addition, to
host &linux; guests, or &os; guests with more than one
<acronym>vCPU</acronym>, <acronym>VMX</acronym> unrestricted
mode support (<acronym>UG</acronym>) is also required. Most
newer processors, specifically the &intel;&nbsp; &core;
i3/i5/i7 and &intel;&nbsp; &xeon; E3/E5/E7, support these
features. <acronym>UG</acronym> support was introduced with
Intel's Westmere micro-architecture. For a complete list of
&intel; processors that support <acronym>EPT</acronym>, refer
to <link xlink:href="http://ark.intel.com/search/advanced?s=t&amp;ExtendedPageTables=true"/>.
<acronym>RVI</acronym> is found on the third generation and
later of the &amd.opteron; (Barcelona) processors. The easiest
way to tell if a processor will support
<application>bhyve</application> is to run
<command>dmesg</command> or look in
<filename>/var/run/dmesg.boot</filename> for
the <literal>POPCNT</literal> processor feature flag on the
<literal>Features2</literal> line and <literal>EPT</literal> and
<literal>UG</literal> on the <literal>VT-x</literal> line.</para>
<sect2 xml:id="virtualization-bhyve-prep">
<title>Preparing the Host</title>
@ -1391,7 +1397,7 @@ FreeBSD-10.0-RELEASE-amd64-bootonly.iso 100% of 209 MB 570 kBps 06m17s</
machine, used to track the running machines. This example
starts the virtual machine in installation mode:</para>
<screen>&prompt.root; <userinput>sh /usr/share/examples/bhyve/vmrun.sh -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> -t tap0 -d <replaceable>guest.img</replaceable> -i -I <replaceable>FreeBSD-10.0-RELEASE-amd64-bootonly.iso</replaceable> <replaceable>guestname</replaceable></userinput></screen>
<screen>&prompt.root; <userinput>sh /usr/share/examples/bhyve/vmrun.sh -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> -t <replaceable>tap0</replaceable> -d <replaceable>guest.img</replaceable> -i -I <replaceable>FreeBSD-10.0-RELEASE-amd64-bootonly.iso</replaceable> <replaceable>guestname</replaceable></userinput></screen>
<para>The virtual machine will boot and start the installer.
After installing a system in the virtual machine, when the
@ -1415,7 +1421,7 @@ FreeBSD-10.0-RELEASE-amd64-bootonly.iso 100% of 209 MB 570 kBps 06m17s</
the boot loader menu in order to escape the loop. Now the
guest can be started from the virtual disk:</para>
<screen>&prompt.root; <userinput>sh /usr/share/examples/bhyve/vmrun.sh -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> -t tap0 -d <replaceable>guest.img</replaceable> <replaceable>guestname</replaceable></userinput></screen>
<screen>&prompt.root; <userinput>sh /usr/share/examples/bhyve/vmrun.sh -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> -t <replaceable>tap0</replaceable> -d <replaceable>guest.img</replaceable> <replaceable>guestname</replaceable></userinput></screen>
</sect2>
<sect2 xml:id="virtualization-bhyve-linux">
@ -1466,8 +1472,8 @@ grub> <userinput>boot</userinput></screen>
<para>Now that the &linux; kernel is loaded, the guest can be
started:</para>
<screen>&prompt.root; <userinput>bhyve -AI -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,tap1 -s 3:0,virtio-blk,./linux.img \
-s 4:0,ahci-cd,./somelinux.iso -l com1,stdio -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> <replaceable>linuxguest</replaceable></userinput></screen>
<screen>&prompt.root; <userinput>bhyve -A -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,<replaceable>tap1</replaceable> -s 3:0,virtio-blk,<replaceable>./linux.img</replaceable> \
-s 4:0,ahci-cd,<replaceable>./somelinux.iso</replaceable> -l com1,stdio -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> <replaceable>linuxguest</replaceable></userinput></screen>
<para>The system will boot and start the installer. After
installing a system in the virtual machine, reboot the virtual
@ -1494,8 +1500,8 @@ grub> <userinput>boot</userinput></screen>
<para>Boot the virtual machine:</para>
<screen>&prompt.root; <userinput>bhyve -AI -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,tap1 \
-s 3:0,virtio-blk,./linux.img -l com1,stdio -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> <replaceable>linuxguest</replaceable></userinput></screen>
<screen>&prompt.root; <userinput>bhyve -A -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,<replaceable>tap1</replaceable> \
-s 3:0,virtio-blk,<replaceable>./linux.img</replaceable> -l com1,stdio -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> <replaceable>linuxguest</replaceable></userinput></screen>
<para>&linux; will now boot in the virtual machine and
eventually present you with the login prompt. Login and use
@ -1506,6 +1512,25 @@ grub> <userinput>boot</userinput></screen>
<screen>&prompt.root; <userinput>bhyvectl --destroy --vm=<replaceable>linuxguest</replaceable></userinput></screen>
</sect2>
<sect2 xml:id="virtualization-bhyve-zfs">
<title>Using <acronym>ZFS</acronym> with
<application>bhyve</application> Guests</title>
<para>If <acronym>ZFS</acronym> is available on the host
machine, using <acronym>ZFS</acronym> volumes
instead of disk image files can provide significant
performance benefits for the guest <acronym>VMs</acronym>. A
<acronym>ZFS</acronym> volume can be created by:</para>
<screen>&prompt.root; <userinput>zfs create -V<replaceable>16G</replaceable> -o volmode=dev <replaceable>zroot/linuxdisk0</replaceable></userinput></screen>
<para>When starting the <acronym>VM</acronym>, specify the
<acronym>ZFS</acronym> volume as the disk drive:</para>
<screen>&prompt.root; <userinput>bhyve -A -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,<replaceable>tap1</replaceable> -s3:0,virtio-blk,<replaceable>/dev/zvol/zroot/linuxdisk0</replaceable> \
-l com1,<replaceable>stdio</replaceable> -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> <replaceable>linuxguest</replaceable></userinput></screen>
</sect2>
<sect2 xml:id="virtualization-bhyve-nmdm">
<title>Virtual Machine Consoles</title>
@ -1527,9 +1552,9 @@ grub> <userinput>boot</userinput></screen>
information.</para>
<screen>&prompt.root; <userinput>kldload nmdm</userinput>
&prompt.root; <userinput>bhyve -AI -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,tap1 -s 3:0,virtio-blk,./linux.img \
-l com1,<replaceable>/dev/nmdm0A</replaceable> -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> <replaceable>linuxguest</replaceable></userinput>
&prompt.root; <userinput>cu -l /dev/nmdm0B -s 9600</userinput>
&prompt.root; <userinput>bhyve -A -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,<replaceable>tap1</replaceable> -s 3:0,virtio-blk,<replaceable>./linux.img</replaceable> \
-l com1,<replaceable>/dev/nmdm0A</replaceable> -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> <replaceable>linuxguest</replaceable></userinput>
&prompt.root; <userinput>cu -l <replaceable>/dev/nmdm0B</replaceable> -s 9600</userinput>
Connected
Ubuntu 13.10 handbook ttyS0