[GUIDE] VMs In VM (Intel Nested Virtualization)


Recommended Posts

In this guide I will be tell you how to run Hardware accerated virturalization in Unraid VM

Requirement

Intel CPU that support vm-x

NOTE : This won't work with Hyper-v on some case , I wouldn't try if I were you because if it fail It might corupt the vm !

First Go to Main Tab

5aa6340c84e71_maintab.PNG.c9459b28051d58ebc09d6d7ce8ddd5bd.PNG

Click on The "Flash" text

5aa6341bb592e_clickflash.thumb.PNG.13e2b2fa81e377f8588d6dbca0a36a93.PNG

and an option to your sys linux Like the following

BEFORE: 

Before.thumb.PNG.24982e4fcd027f1e7f02f64a6791712b.PNG

AFTER: 

After.thumb.PNG.611df041a2f90b87e99876be7fef038e.PNG

Reboot Then go to VM Tab and click on the vm you want to enable nested virturalization and click edit XML

add <feature policy='require' name='vmx'/> and change model to custom like the following

BEFORE:

5aa634e9ae025_vmbefore.PNG.820e41d58997ad640119e3ee1f17d119.PNG

AFTER:

5aa634f576d47_vmafter.PNG.4f198ae1c0cf5578be927fc2d56ad41e.PNG

click Apply

Then Start, Done

Edited by Siwat2545
  • Like 1
Link to comment
  • 3 months later...
  • 1 month later...
  • 3 months later...

And just to confirm. (Since I did not find anything about vm-x)

vm-x is Virtual Machine extensions?

Also known as x86 virtualization?

Or as unraid is reporting on System Profiler for the CPU, VME (Virtual mode extension)?

Ref: https://en.wikipedia.org/wiki/VMX

 

So if your cpu has VT-x (Intel) or AMD-V (AMD, doh) this would work?

 

\John

Edited by johnarvid
VME
Link to comment
  • 7 months later...

Hello guys,

 

how to activate VMX for Qemu in Unraid 6.7.2.?

 

Iam using Passtrough-Mode with the "kvm_intel nested=1" in Autostart to run MS Hyper-V 2016 on my Unraid Setup.

Inside the HyperV 2016 Server i can use nested VMs without hassle when HyperV option enabled and pc-i440fx .

But the performance is absolutely horrible and everthing is lagging  behind.

 

When i switch do QMEU64 / KVM  CPU mode the Performance of my MS Hyper Server increases drastically. But the Intel VD-X Features are not exposed to it anymore, hence i cannot run nested VMs.

 

How can i expose VMX to my HyperV Host running on QEMU CPU Mode.

 

I Found the following:

 

https://ahelpme.com/howto/qemu-full-virtualization-cpu-emulations-enable-disable-cpu-flags-instruction-sets/

https://stackoverflow.com/questions/39154850/how-do-i-emulate-the-vmx-feature-with-qemu

https://stackoverflow.com/questions/43942033/nested-virtualization-with-kvm-enable-kvm-in-qemu-in-nested-virtualization?rq=1

 

Somehow it should be possible to make the CPUS Features visible to the VM.

 

The XML commands above, mentioned by Siwat, do not work anymore.

Error: XML error: Non-empty feature list specified without CPU model

 

Cpu Mode "custom" does not exist anymore. But there is a mode called "Host-Model".

 

How can i use QEMU emulated CPU Cores for my MS HyperV Server and passtrough the VMX Features to its VMS for nested Virtualization.

 

best regards

 

lukas

 

 

Link to comment
  • 1 year later...
  • 1 month later...
  • 1 year later...

Hi folks. I know it's an old thread but just sharing in case anyone else from Google searching ends up here.

 

This seems to have done the trick for me (note that I'm not running Hyper-V or Windows in my VM so I cannot confirm on Hyper-V):

 

https://stafwag.github.io/blog/blog/2018/06/04/nested-virtualization-in-kvm/

 

Specifically, editing the VM XML and changing the cpu mode section with this:

<cpu mode='host-model' check='partial'>
   <model fallback='allow'/>
</cpu>

 

Of course, you also need to ensure the intel-kvm.nested=1 change is applied to your grub config, the first step OP mentioned. The link I shared shows how you can do this without rebooting as well. You can also of course just add the change to /boot/config/modprobe.d/<filename> as mentioned in the linked article (in Unraid, modprobe.d is in this location).

 

My VM (proxmoxtest in this case) detects vmx as a CPU feature now, and the XML was updated automatically with all of the features:

 

root@mediasrv:~# virsh dumpxml proxmoxtest|grep feature
  <features>
  </features>
    <feature policy='require' name='ss'/>
    <feature policy='require' name='vmx'/>
    <feature policy='require' name='pdcm'/>
    <feature policy='require' name='hypervisor'/>
    <feature policy='require' name='tsc_adjust'/>
    <feature policy='require' name='clflushopt'/>
    <feature policy='require' name='umip'/>
    <feature policy='require' name='md-clear'/>
    <feature policy='require' name='stibp'/>
    <feature policy='require' name='arch-capabilities'/>
    <feature policy='require' name='ssbd'/>
    <feature policy='require' name='xsaves'/>
    <feature policy='require' name='pdpe1gb'/>
    <feature policy='require' name='ibpb'/>
    <feature policy='require' name='ibrs'/>
    <feature policy='require' name='amd-stibp'/>
    <feature policy='require' name='amd-ssbd'/>
    <feature policy='require' name='rdctl-no'/>
    <feature policy='require' name='ibrs-all'/>
    <feature policy='require' name='skip-l1dfl-vmentry'/>
    <feature policy='require' name='mds-no'/>
    <feature policy='require' name='pschange-mc-no'/>
    <feature policy='require' name='tsx-ctrl'/>
    <feature policy='disable' name='hle'/>
    <feature policy='disable' name='rtm'/>
    <feature policy='disable' name='mpx'/>

 

Edited by jaylo123
Link to comment
  • 1 year later...

Hello, I changed the XML to the below and when the VM starts, I see the XML updates to..
 

<cpu mode='host-model' check='partial'>
   <model fallback='allow'/>
</cpu>

 

<cpu mode='custom' match='exact' check='full'>
    <model fallback='forbid'>EPYC-Milan</model>
    <vendor>AMD</vendor>
    <feature policy='require' name='x2apic'/>
    <feature policy='require' name='tsc-deadline'/>
    <feature policy='require' name='hypervisor'/>
    <feature policy='require' name='tsc_adjust'/>
    <feature policy='require' name='avx512f'/>
    <feature policy='require' name='avx512dq'/>
    <feature policy='require' name='avx512ifma'/>
    <feature policy='require' name='avx512cd'/>
    <feature policy='require' name='avx512bw'/>
    <feature policy='require' name='avx512vl'/>
    <feature policy='require' name='avx512vbmi'/>
    <feature policy='require' name='avx512vbmi2'/>
    <feature policy='require' name='gfni'/>
    <feature policy='require' name='vaes'/>
    <feature policy='require' name='vpclmulqdq'/>
    <feature policy='require' name='avx512vnni'/>
    <feature policy='require' name='avx512bitalg'/>
    <feature policy='require' name='avx512-vpopcntdq'/>
    <feature policy='require' name='spec-ctrl'/>
    <feature policy='require' name='stibp'/>
    <feature policy='require' name='arch-capabilities'/>
    <feature policy='require' name='ssbd'/>
    <feature policy='require' name='avx512-bf16'/>
    <feature policy='require' name='cmp_legacy'/>
    <feature policy='require' name='virt-ssbd'/>
    <feature policy='disable' name='lbrv'/>
    <feature policy='disable' name='tsc-scale'/>
    <feature policy='disable' name='vmcb-clean'/>
    <feature policy='disable' name='pause-filter'/>
    <feature policy='disable' name='pfthreshold'/>
    <feature policy='require' name='rdctl-no'/>
    <feature policy='require' name='skip-l1dfl-vmentry'/>
    <feature policy='require' name='mds-no'/>
    <feature policy='require' name='pschange-mc-no'/>
    <feature policy='disable' name='pcid'/>
    <feature policy='disable' name='svm'/>
    <feature policy='require' name='topoext'/>
    <feature policy='disable' name='npt'/>
    <feature policy='disable' name='nrip-save'/>
    <feature policy='disable' name='svme-addr-chk'/>
  </cpu>

 

But when i try to power on a VM within the nested VM (ESXI) i get this message: Failed - This host does not support AMD-V

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.