Hardware-Assisted Virtualization and VMCS

Definition

Hardware-assisted virtualization supplies processor mechanisms for efficient guest execution and controlled transfer to a hypervisor. The lecture compares Intel VT-x and AMD SVM; its detailed diagrams use Intel VMX terminology.

Modes and rings are separate

Execution context in the slide modelVMX modeRing
Host kernel / VMMRoot0
QEMU host processRoot3
Guest kernelNon-root0
Guest applicationNon-root3

Study intuition: rings separate applications from their kernel; root/non-root separates guest execution from host virtualization control. Root mode does not make a ring-3 host process a privileged kernel.

VM entry and exit

VMM --VM entry--> guest
VMM <--VM exit--- guest

Some exit causes are mandatory; others depend on configured controls. Ordinary guest calculations and guest syscalls can execute without returning to the VMM. Exits have a cost, so reducing unnecessary exits matters.

VMCS / VMCB

The Intel Virtual Machine Control Structure records guest state, host processor state, and controls such as exit conditions. VMREAD and VMWRITE access it. AMD uses a VMCB with its own interface; it is not an interchangeable Intel structure.

Historical performance example

PDF page 33 / slide 36 reproduces a hardware round-trip table from a 2012 paper. Examples: Prescott, 3963 cycles; Nehalem, 1009; Sandy Bridge, 784. These illustrate generation-dependent overhead and do not predict current hardware or a particular workload.

Common mistakes

  • Calling VMX non-root “ring 3.” A guest kernel can be non-root ring 0.
  • Treating a guest syscall as an automatic exit.
  • Assuming all exits return to QEMU. KVM can handle some in the kernel.
  • Equating CPU virtualization support with EPT/NPT availability; the lecture notes early hardware support lacked nested paging.

Related: CPU Virtualization and Trap and Emulate, QEMU and KVM, Memory Virtualization - Shadow Page Tables and EPT, Nested Virtualization.

Source

Lecture 03 PDF pages 30-36, 50, and 81-83 (printed slides 32-39 with gaps, 53, 86-88). Context: Lecture 03 - Computing Virtualization Technologies and Tools. The intuition and mistake checks add study guidance.