CPU feature flags: what the chip can do
Video 025 of 140 in Virtualization Foundations, in the unit “CPUs: sockets, cores, threads and caches”. 3:36, with English and Hindi audio.
Every processor carries a list of extra abilities, such as hardware support for virtual machines. Each item in that list is called a flag. Linux reads the flags and shows them to you, so you can check what a machine can do before you rely on it. This article explains what flags are, which ones matter for virtualization, how to find them on a Linux host, and why a missing flag or a mismatch between hosts causes trouble.
What you will learn
- A flag is a short name for one feature that a processor reports.
- The vmx flag means Intel hardware virtualization. The svm flag means AMD-V.
- A feature can exist in the chip but be switched off in the firmware, so its flag does not show.
- Compare the flags of old and new hosts before you move a running virtual machine.
What a CPU flag is and why processors have them
Every x86-64 chip runs the same basic set of instructions. Newer chips add extras on top, such as encryption help, wide maths and virtualization support. Each extra has a short name, called a flag. The chip reports its flags, and Linux shows them to you.
For example, aes is the flag for encryption help, and avx2 is the flag for wide maths. Two flags matter most for virtualization, because they tell a hypervisor that the chip supports virtual machines in hardware.
The virtualization flags: vmx, svm and hypervisor
- vmx: Intel's hardware support for virtualization, called VMX.
- svm: AMD's version, called AMD-V.
- hypervisor: shown inside a guest, to say that the guest runs on virtual hardware.
A hypervisor is the software that runs and shares out virtual machines on one server. Inside a virtual machine, the hypervisor flag appears. It tells the guest operating system that it runs on virtual hardware.
How to find the flags on a Linux host
The first command searches the flags in the processor information file. On an Intel chip it prints vmx once, however many threads there are. The second command gives the same answer in plain words, with the Virtualization line.
grep -o -w -E 'vmx|svm' /proc/cpuinfo | sort -ulscpu | grep VirtualizationNote: AMD chips show svm, and the Virtualization line shows AMD-V instead of VT-x.
Why a missing flag or a mismatch stops a move
- A feature may be built into the chip but switched off in the firmware settings. Then Linux does not see its flag.
- Without the flag, the hypervisor cannot use hardware support to run its virtual machines.
- Hosts with different flags may refuse to move a running virtual machine between them.
A real case shows the risk. Harbor Point Logistics wants to move a database virtual machine to new hosts. Every new host must show the features that the virtual machine depends on, or the move can fail. So the team compares the flags of the old and new hosts before the first machine moves.
Note: A missing flag is the first thing to check when a hypervisor will not start on a new host. You notice it in errors that name an unsupported feature, or in a virtual machine that will not start at all.
Find the virtualization flags on your host
You need a Linux terminal on the host you want to check. You will run two commands, and each one reports the same support in a different form.
Search the processor information file for the virtualization flag. This prints the flag name once, however many threads the chip has.
grep -o -w -E 'vmx|svm' /proc/cpuinfo | sort -uWhat you should see: On an Intel chip the output is vmx. On an AMD chip it is svm.
Ask lscpu for the same support in plain words, to confirm the first result.
lscpu | grep VirtualizationWhat you should see: The line reads Virtualization: VT-x on Intel, or Virtualization: AMD-V on AMD.
Terms
- Flag
- A short name that a processor reports for one of its features, such as aes or vmx.
- vmx
- The flag that shows an Intel processor offers hardware support for virtualization, called VMX.
- svm
- The flag that shows an AMD processor offers hardware support for virtualization, called AMD-V.
- Hypervisor
- The software that runs and shares out virtual machines on one server.
Check yourself
What does the vmx flag tell you?
The Intel processor offers hardware support for virtualization, called VMX. On AMD the same support is shown as svm.
Why might a feature be missing from the flags even though the chip has it?
The feature may be switched off in the firmware settings, so Linux does not see its flag.
Why compare flags before moving a virtual machine?
Hosts with different flags may refuse to move a running virtual machine, and the move can fail.
Previous: x86-64 and Arm: two instruction families. Next: Reading lscpu, line by line.