Chapter 06 — 2005 — today

Silicon joins in

Intel and AMD added a second world to the CPU. Hardware virtualization removed the translator from the hot path and made KVM, Hyper-V and nested virtualization possible.

By 2004 the software workarounds had run their course. Binary translation was fast but fragile; paravirtualization was fast but required modified guests; emulation was portable but slow. Intel and AMD independently reached the same conclusion: move the guest/host boundary into the processor, define exactly which events cross it, and let the guest run natively in between. Intel shipped VT-x in late 2005; AMD followed with AMD-V in 2006.

A second world inside the CPU

VT-x adds an orthogonal split to the x86 privilege rings. The CPU now has two operations: VMX root, where the hypervisor runs, and VMX non-root, where guests run. Inside non-root operation the guest kernel can occupy ring 0 and execute privileged instructions directly. The rings still exist; they are simply nested inside a world that the hypervisor controls.

The hypervisor configures which events cause a VM exit — a controlled transfer back to root mode. Everything else executes at native speed. On exit, the CPU saves guest state, loads host state, and jumps to the hypervisor's exit handler. A VM entry reverses the process. This is the hardware version of trap-and-emulate, with the critical difference that the guest kernel is no longer deprivileged.

Intel VT-x root and non-root operation VMX root mode contains the hypervisor; VMX non-root mode contains guest ring 0 and ring 3, with VM exits and entries between them. VMX ROOT MODE HYPERVISOR — RING 0 VMCS · EXIT HANDLERS · SCHEDULER · DEVICE MODEL HOST KERNEL / VMM VMX NON-ROOT MODE GUEST KERNEL — RING 0 PRIVILEGED INSTRUCTIONS RUN NATIVE GUEST APPS — RING 3 ORDINARY USER CODE VM ENTRY VM EXIT INTERCEPTED EVENT → EXIT
FIG 6.1 — Root mode runs the hypervisor; non-root mode runs the guest, including its ring 0 kernel. Only configured events cross the boundary.

The VMCS: a contract per virtual CPU

VT-x does not decide policy in hardware. Each virtual CPU has a VMCS (Virtual Machine Control Structure), a memory region that holds three kinds of state: the guest's saved registers, the host's saved registers, and control fields that define the contract. The control fields specify:

  • which instructions cause exits (the execution controls);
  • which exceptions and interrupts are intercepted;
  • which MSRs and I/O ports are trapped;
  • where the EPT pointer lives, if extended page tables are enabled;
  • what information the CPU records about the most recent exit.

The hypervisor reads and writes the VMCS with privileged instructions such as VMPTRLD, VMREAD and VMWRITE, then performs a VMLAUNCH or VMRESUME to enter the guest. The VMCS is the hardware analogue of the software VMM's per-guest state — but now the CPU enforces the boundary instead of the translator.

AMD's SVM (Secure Virtual Machine) extension is conceptually similar but organized differently: a VMCB (Virtual Machine Control Block) holds guest and host state, and VMRUN executes a guest until an intercept. The names differ; the idea is the same.

EPT and NPT: the second page table

CPU virtualization solved only half the problem. The guest still maintains page tables that map guest-virtual to guest-physical addresses, and the hypervisor must translate guest-physical addresses to real host-physical addresses. Before hardware support, that required shadow page tables: the hypervisor built a combined table and trapped whenever the guest changed its own. Every process switch and every page-table update could become a VM exit.

EPT (Intel Extended Page Tables, introduced with Nehalem in 2008) and NPT (AMD Nested Page Tables, with Barcelona in 2007) add a second level of translation in hardware. The guest's page tables map virtual to guest-physical; the EPT maps guest-physical to host-physical. The CPU walks both levels. No shadow tables, no trap on every guest page-table write.

The cost moves rather than disappears: an EPT violation (a page not present in the second-level table) causes a VM exit so the hypervisor can map memory. TLB misses are more expensive because the hardware may walk two tables. Tagging TLB entries with a VPID (Intel) or ASID (AMD) avoids flushing the entire TLB on every VM entry and exit.

IOMMU, passthrough and SR-IOV

DMA is the part of I/O that bypasses the CPU. Without an IOMMU, a device assigned to one guest can write to any physical address, including another guest's memory. Intel VT-d and AMD-Vi add DMA remapping: the IOMMU translates device-visible addresses through a per-device page table, so a passthrough NIC or GPU can only touch the memory the hypervisor has granted it.

Passthrough gives near-native I/O performance but consumes a whole physical device per guest. SR-IOV (Single Root I/O Virtualization) splits a device into virtual functions that can be assigned independently, improving density. Interrupt remapping keeps MSI/MSI-X interrupts isolated as well.

ExtensionVendorWhat it accelerates
VT-x / AMD-VIntel / AMDCPU virtualization: root/non-root execution, VM exits.
EPT / NPTIntel / AMDMemory virtualization: guest-physical to host-physical translation.
VPID / ASIDIntel / AMDTLB tagging so entries survive VM entry/exit.
VT-d / AMD-ViIntel / AMDDMA remapping and interrupt isolation for passthrough devices.
APICv / AVICIntel / AMDVirtual interrupt delivery without a VM exit per interrupt.
SR-IOVPCI-SIGHardware partitioning of a device into virtual functions.

Checking support on a Linux host

Before running KVM, confirm that the CPU exposes virtualization and that the kernel modules are loaded. On Intel the flag is vmx; on AMD it is svm.

bash — host checks
$ grep -m1 -oE 'vmx|svm' /proc/cpuinfo
vmx

$ lscpu | grep -i virtualization
Virtualization:                  VT-x

$ lsmod | grep '^kvm'
kvm_intel             401408  0
kvm                  1433600  1 kvm_intel

$ ls -l /dev/kvm
crw-rw----+ 1 root kvm 10, 232 Dec  2 10:14 /dev/kvm

$ dmesg | grep -i -E 'kvm|vmx' | tail -3
[    4.112] kvm: VMX enabled, EPT and unrestricted guest supported
If the flag is missing

Virtualization may be disabled in firmware. Check the BIOS/UEFI settings for "Intel Virtualization Technology", "SVM Mode" or "AMD-V". On some laptops it is hidden behind a security or battery-life setting. In a VM, nested virtualization must be enabled on the host.

Nested virtualization

Once the CPU understands guests, it can run a hypervisor inside a guest. This is nested virtualization: L0 is the real hypervisor, L1 is a hypervisor running in a VM, and L2 is a guest inside that. Intel implements it with VMCS shadowing and a set of nested controls; AMD with nested SVM. Performance is lower because every L2 exit may need to be reflected to L1, but it enables development, CI and cloud environments where the tenant wants to run KVM or Hyper-V.

Nested support is now expected by developers: "Can I run Docker Desktop / minikube / WSL2 in this cloud VM?" is really a question about nested virtualization. Most major clouds expose it on selected instance families, sometimes behind a feature flag.

Hardware is not a free lunch

Hardware virtualization made the common case fast, but it did not eliminate the hypervisor. Every VM exit still costs hundreds to thousands of cycles, and I/O-heavy workloads can generate a lot of them. Device emulation remains a large attack surface, which is why modern stacks combine hardware support with paravirtualized drivers (virtio), in-kernel data paths (vhost), and minimal device models (Chapter 9).

Key takeaway

VT-x and AMD-V replaced software interception with a hardware contract. EPT and NPT did the same for memory; IOMMU did it for DMA. The result was not "no virtualization overhead" but "overhead you can measure and optimize" — which is what made KVM and modern cloud possible.

Sources & further reading