nested hardware-assisted virtualization

后学
2023-12-01

一.nested kvm

Configure nested KVM. It's possible to install KVM and create virtual machines as nested KVM on KVM host.

1.CentOS7

(1)Enable the setting for Nested KVM.

[root@dlp ~]# 
vi /etc/modprobe.d/kvm-nested.conf
# create new

options kvm_intel nested=1
[root@dlp ~]# 
modprobe -r kvm_intel 
# unload

[root@dlp ~]# 
modprobe kvm_intel 
# reload again

[root@dlp ~]# 
cat /sys/module/kvm_intel/parameters/nested 

Y
# just enabled

(2)Edit the configuration of a virtual machine you'd like to set nested like follows.It's OK to configure nested KVM and you can create virtual machines on the virtual machine nested.
[root@dlp ~]# 
virsh edit centos7
# edit a virtual machine "centos7"
# change like folows for "cpu mode" section

<cpu mode='
host-passthrough
'>

2.Ubuntu14.04LTS

(1)Make sure the current settings for Nested KVM and change it if needed.
# show the current setting ( if the result is "Y", it's OK )

root@dlp:~# 
cat /sys/module/kvm_intel/parameters/nested 

Y
# if the result is "N", change like follows and reboot the system )

[root@dlp ~]# 
echo 'options kvm_intel nested=1' >> /etc/modprobe.d/qemu-system-x86.conf
(2)Make sure the CPU model on your computer.
[root@dlp ~]# 
virsh capabilities | egrep "/model|/vendor" 

<model>Westmere</model>
# CPU model

<vendor>Intel</vendor>
# CPU vendor

<model>apparmor</model>
<model>dac</model>
(3) Edit the configuration of a virtual machine you'd like to nest like follows. It's OK to configure nested KVM and you can create virtual machines on the virtual machine nested.
[root@dlp ~]# 
virsh edit www
# edit a virtual machine "www"
# add following lines

<cpu mode='custom' match='exact'>
  
# CPU model

  <model fallback='allow'>Westmere</model>
  
# CPU vendor

  <vendor>Intel</vendor>
  <feature policy='require' name='vmx'/>
</cpu>

二.Vmware Virtualized HV

Most hypervisors require hardware-assisted virtualization (HV). VMware products require hardware-assisted virtualization for 64-bit guests on Intel hardware. When running as a guest hypervisor, VMware products also require hardware-assisted virtualization for 64-bit guests on AMD hardware.  The hardware-assisted virtualization features of the physical CPU are not typically available in a VM, because most hypervisors (from VMware or others) do not virtualize HV. However, Workstation 8, Player 4, Fusion 4, and ESXi 5.0 (or later) offer virtualized HV, so that you can run guest hypervisors which require hardware-assisted virtualization.

 

With virtualized HV enabled for the outer guest, you should be able to run any guest hypervisor that requires hardware-assisted virtualization. In particular, this means that you will be able to run 64-bit nested guests under VMware guest hypervisors. 

ESXi 6.0

Virtualized HV is fully supported for virtual hardware version 9 or later VMs on hosts that support  Intel VT-x and EPT or AMD-V and RVI. To enable virtualized HV, use the web client and navigate to the processor settings screen. Check the  box next to  "Expose hardware-assisted virtualization to the guest operating system."  This setting is not available under the traditional C# client.

Workstation 11 / Player 7 / Fusion 7

Virtualized HV is fully supported for virtual hardware version 9 or later VMs on hosts that support Intel VT-x and EPT or AMD-V and RVI. To enable virtualized HV, select VM->Settings and navigate to the processor settings screen. Check the box next to  "Virtualize Intel VT-x/EPT or AMD-V/RVI."

Workstation 10 / Player 6 / Fusion 6

Virtualized HV is fully supported for virtual hardware version 9 or 10 VMs on hosts that support Intel VT-x and EPT or AMD-V and RVI. To enable virtualized HV, select VM->Settings and navigate to the processor settings screen. Check the box next to  "Virtualize Intel VT-x/EPT or AMD-V/RVI."

ESXi 5.5

Virtualized HV is fully supported for virtual hardware version 9 or 10 VMs on hosts that support  Intel VT-x and EPT or AMD-V and RVI. To enable virtualized HV, use the web client and navigate to the processor settings screen. Check the  box next to  "Expose hardware-assisted virtualization to the guest operating system."  This setting is not available under the traditional C# client.

Workstation 9 / Player 5 / Fusion 5

Virtualized HV is fully supported for virtual hardware version 9 VMs on hosts that support Intel VT-x and EPT or AMD-V and RVI. To enable virtualized HV, select VM->Settings and navigate to the processor settings screen. Check the box next to  "Virtualize Intel VT-x/EPT or AMD-V/RVI."

ESXi 5.1

Virtualized HV is fully supported for virtual hardware version 9 VMs on hosts that support  Intel VT-x and EPT or AMD-V and RVI. To enable virtualized HV, use the web client and navigate to the processor settings screen. Check the  box next to  "Expose hardware-assisted virtualization to the guest operating system."  This setting is not available under the traditional C# client.

Workstation 8 / Player 4

Virtualized HV is available for virtual hardware version 8 VMs on hosts that support Intel VT-x and EPT or AMD-V and RVI. To enable virtualized HV, select VM->Settings and navigate to the processor settings screen. Check the box next to "Virtualize Intel VT-x/EPT or AMD-V/RVI."  You will see a warning that virtualized HV will make this VM incompatible with other VMware products. In particular, if this VM is moved to an ESXi 5.0 host, virtualized HV will not be available without additional tweaking.

Fusion 4

Virtualized HV is available for virtual hardware version 8 VMs on hosts that support Intel VT-x and EPT or AMD-V and RVI, but it cannot be selected through the user interface. To enable virtualized HV, edit the outer guest's configuration file by hand and add the following line:

vhv.enable = TRUE

ESXi 5.0

On ESXi 5.0, virtualized HV is prohibited by default. This feature is used internally within VMware for testing purposes, but it is not recommended for production systems. It is available on hosts that support Intel VT-x or AMD-V, but it is not recommended for systems without second level address translation (EPT or RVI), because of its poor performance without SLAT. Unfortunately, this feature does not work on AMD "Bulldozer" CPUs running ESXi 5.0.

 

To allow the use of this feature, the ESXi administrator must add the following configuration option to the /etc/vmware/config file on the physical host:

vhv.allow = TRUE

Once allowed by the ESXi administrator, virtualized HV will be enabled by default for all hardware version 8 VMs with guest OS type "ESX Server 4" and "ESX Server 5." To enable virtualized HV for other guests, add the following lines to the outer guest's configuration file:

cpuid.1.ecx="----:----:----:----:----:----:--h-:----"
cpuid.80000001.ecx.amd="----:----:----:----:----:----:----:-h--"
cpuid.8000000a.eax.amd="hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh"
cpuid.8000000a.ebx.amd="hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh"
cpuid.8000000a.edx.amd="hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh"

references:http://www.server-world.info/en/note?os=CentOS_7&p=kvm&f=7
  http://www.server-world.info/en/note?os=Ubuntu_14.04&p=kvm&f=8
  https://communities.vmware.com/docs/DOC-8970

 类似资料:

相关阅读

相关文章

相关问答