Turning on VT-x or AMD-V
Video 092 of 140 in Virtualization Foundations, in the unit “Firmware settings that matter on a virtualization host”. 3:52, with English and Hindi audio.
A virtual machine needs help from the processor. On a server, that help is a switch in firmware, and sometimes the switch is off. A host with the switch off cannot start a virtual machine at all. This article explains what the switch does, why it exists, how it goes missing after a firmware change, and how to confirm from Linux that it is on before you rely on the host.
What you will learn
- The virtualisation switch turns on the processor's help for virtual machines.
- Intel calls the feature VT-x, and AMD calls it AMD-V.
- Linux shows the feature with lscpu, and with the vmx or svm flag.
- A firmware reset or a new board can quietly switch the feature off.
- Check the switch after every firmware change, before you start any virtual machine.
Why the processor needed help for virtual machines
For a long time, running virtual machines on x86 chips was hard. Some instructions behaved differently under a hypervisor, and software had to work around them. In 2000, researchers listed seventeen such instructions. In 2005, Intel added VT-x, a hardware helper. A year later, AMD added AMD-V, which gives the same kind of help.
Both features let the processor run guest code, the programs inside a virtual machine, directly. The hypervisor steps in only when it must. The hypervisor is the program that splits a server into those machines.
What virtualisation support is, and its names
Virtualisation support is the processor feature that lets a hypervisor run virtual machines quickly and safely. Intel calls this feature VT-x, and AMD calls it AMD-V. On Linux, the flag name is vmx for Intel, and svm for AMD.
A real host at Harbor Point after a firmware reset
Harbor Point, a logistics firm, runs production hosts that carry the virtual machines behind its warehouses. After a firmware reset, one new host came back with the switch off. Its hypervisor could not start a single virtual machine.
The fix takes minutes: enter the firmware setup, turn the switch on, and save. The cause is easy to miss, so check the switch after every firmware change.
Check the switch from Linux
Linux can show the switch without a restart. The lscpu command prints a virtualisation line. On an Intel chip, that line says VT-x. On an AMD chip, it says AMD-V.
lscpu | grep VirtualizationThe grep command checks the processor flags directly. It prints vmx on Intel, and svm on AMD.
grep -o -w -E 'vmx|svm' /proc/cpuinfo | sort -uNote: If nothing prints, the feature is not offered right now, most often because the switch is off.
Where the feature matters, and where it does not
- Full virtual machines: any host that runs them needs the feature on. KVM, VMware ESXi and Hyper-V all depend on it.
- After any change: a firmware reset or a new board can quietly switch it off, so check after each change.
- Containers: they share the host's kernel, so they do not need this feature.
Confirm the virtualisation switch is on
You need a Linux host and a shell. These checks need no restart.
Read the virtualisation line of the processor.
lscpu | grep VirtualizationWhat you should see: On an Intel chip the line says VT-x. On an AMD chip, it says AMD-V.
Check the processor flags for vmx or svm.
grep -o -w -E 'vmx|svm' /proc/cpuinfo | sort -uWhat you should see: It prints vmx on Intel and svm on AMD. If nothing prints, the switch is most often off in firmware.
Terms
- Virtualisation support
- The processor feature that lets a hypervisor run virtual machines quickly and safely. Intel calls it VT-x, and AMD calls it AMD-V.
- Hypervisor
- The program that splits a server into virtual machines and hands each one a share of the hardware.
Check yourself
What does VT-x or AMD-V allow the processor to do?
It lets the processor run guest code directly, so the hypervisor steps in only when it must.
What does an empty result from the vmx or svm check mean?
The feature is not offered right now, most often because the switch is off in firmware.
Why do containers not need this feature?
They share the host's kernel, so they do not need this processor help for virtual machines.
Previous: Burn-in testing of new hardware. Next: The IOMMU setting: VT-d or AMD-Vi.