x86 virtualization is the use ofhardware-assisted virtualization capabilities on anx86/x86-64CPU.
In the late 1990s x86 virtualization was achieved by complexsoftware techniques, necessary to compensate for the processor's lack of hardware-assisted virtualization capabilities while attaining reasonableperformance. In 2005 and 2006, bothIntel (VT-x) andAMD (AMD-V) introduced limited hardware virtualization support that allowed simpler virtualization software but offered very few speed benefits.[1] Greater hardware support, which allowed substantial speed improvements, came with later processor models.
The following discussion focuses only on virtualization of the x86 architectureprotected mode.
In protected mode the operating system kernel runs at a higher privilege such asring 0, and applications at a lower privilege such as ring 3.[citation needed] In software-based virtualization, a host OS has direct access to hardware while the guest OSs have limited access to hardware, just like any other application of the host OS. One approach used in x86 software-based virtualization to overcome this limitation is calledring deprivileging, which involves running the guest OS at a ring higher (lesser privileged) than 0.[2]
Three techniques made virtualization of protected mode possible:
These techniques incur some performance overhead due to lack of MMU virtualization support, as compared to a VM running on a natively virtualizable architecture such as theIBM System/370.[4]: 10 [9]: 17 and 21
On traditional mainframes, the classictype 1 hypervisor was self-standing and did not depend on any operating system or run any user applications itself. In contrast, the first x86 virtualization products were aimed at workstation computers, and ran a guest OS inside a host OS by embedding the hypervisor in a kernel module that ran under the host OS (type 2 hypervisor).[8]
There has been some controversy whether the x86 architecture with no hardware assistance is virtualizable as described byPopek and Goldberg.VMware researchers pointed out in a 2006ASPLOS paper that the above techniques made the x86 platform virtualizable in the sense of meeting the three criteria of Popek and Goldberg, albeit not by the classic trap-and-emulate technique.[4]: 2–3
A different route was taken by other systems likeDenali,L4, andXen, known asparavirtualization, which involvesporting operating systems to run on the resulting virtual machine, which does not implement the parts of the actual x86 instruction set that are hard to virtualize. The paravirtualized I/O has significant performance benefits as demonstrated in the originalSOSP'03 Xen paper.[10]
The initial version ofx86-64 (AMD64) did not allow for a software-only full virtualization due to the lack of segmentation support inlong mode, which made the protection of the hypervisor's memory impossible, in particular, the protection of the trap handler that runs in the guest kernel address space.[11][12]: 11 and 20 Revision D and later 64-bit AMD processors (as a rule of thumb, those manufactured in 90 nm or less) added basic support for segmentation in long mode, making it possible to run 64-bit guests in 64-bit hosts via binary translation. Intel did not add segmentation support to its x86-64 implementation (Intel 64), making 64-bit software-only virtualization impossible on Intel CPUs, but Intel VT-x support makes 64-bit hardware assisted virtualization possible on the Intel platform.[13][14]: 4
On some platforms, it is possible to run a 64-bit guest on a 32-bit host OS if the underlying processor is 64-bit and supports the necessary virtualization extensions.
In 2005 and 2006,Intel andAMD (working independently) created newprocessor extensions to the x86 architecture. The first generation of x86 hardware virtualization addressed the issue of privileged instructions. The issue of low performance of virtualized system memory was addressed withMMU virtualization that was added to the chipset later.
Because theIntel 80286 could not run concurrent DOS applications well by itself in protected mode, Intel introduced thevirtual 8086 mode in their80386 chip, which offered virtualized 8086 processors on the 386 and later chips. Hardware support for virtualizing the protected mode itself, however, became available 20 years later.[15]
AMD developed its first generation virtualization extensions under the code name "Pacifica", and initially published them as AMD Secure Virtual Machine (SVM),[16] but later marketed them under the trademarkAMD Virtualization, abbreviatedAMD-V.
On May 23, 2006, AMD released the Athlon 64 ("Orleans"), the Athlon 64 X2 ("Windsor") and the Athlon 64 FX ("Windsor") as the first AMD processors to support this technology.
AMD-V capability also features on theAthlon 64 andAthlon 64 X2 family of processors with revisions "F" or "G" onsocket AM2,Turion 64 X2, andOpteron 2nd generation[17] and third-generation,[18]Phenom andPhenom II processors. TheAPU Fusion processors support AMD-V. AMD-V is not supported by any Socket 939 processors. The onlySempron processors which support it are APUs andHuron,Regor,Sargas desktop CPUs.
AMD Opteron CPUs beginning with the Family 0x10 Barcelona line, and Phenom II CPUs, support a second generation hardware virtualization technology calledRapid Virtualization Indexing (formerly known as Nested Page Tables during its development), later adopted by Intel asExtended Page Tables (EPT).
As of 2019, allZen-based AMD processors support AMD-V.
TheCPU flag for AMD-V is "svm". This may be checked inBSD derivatives viadmesg orsysctl and inLinux via/proc/cpuinfo
.[19] Instructions in AMD-V include VMRUN, VMLOAD, VMSAVE, CLGI, VMMCALL, INVLPGA, SKINIT, and STGI.
With somemotherboards, users must enable AMD SVM feature in theBIOS setup before applications can make use of it.[20]
Previously codenamed "Vanderpool", VT-x represents Intel's technology for virtualization on the x86 platform. On November 14, 2005, Intel released two models ofPentium 4 (Model 662 and 672) as the first Intel processors to support VT-x. The CPU flag for VT-x capability is "vmx"; in Linux, this can be checked via/proc/cpuinfo
, or inmacOS viasysctl machdep.cpu.features
.[19][21][22]
"VMX" stands for Virtual Machine Extensions, which adds 13 new instructions: VMPTRLD, VMPTRST, VMCLEAR, VMREAD, VMWRITE, VMCALL, VMLAUNCH, VMRESUME, VMXOFF, VMXON, INVEPT, INVVPID, and VMFUNC.[23] These instructions permit entering and exiting a virtual execution mode where the guest OS perceives itself as running with full privilege (ring 0), but the host OS remains protected.
As of 2015[update], almost all newer server, desktop and mobile Intel processors support VT-x, with some of theIntel Atom processors as the primary exception.[24] With somemotherboards, users must enable Intel's VT-x feature in theBIOS setup before applications can make use of it.[25]
Intel started to includeExtended Page Tables (EPT),[26] a technology for page-table virtualization,[27] since theNehalem architecture,[28][29] released in 2008. In 2010,Westmere added support for launching the logical processor directly inreal mode – a feature called "unrestricted guest", which requires EPT to work.[30][31]
Since theHaswell microarchitecture (announced in 2013), Intel started to includeVMCS shadowing as a technology that acceleratesnested virtualization of VMMs.[32]Thevirtual machine control structure (VMCS) is adata structure in memory that exists exactly once per VM, while it is managed by the VMM. With every change of the execution context between different VMs, the VMCS is restored for the current VM, defining the state of the VM's virtual processor.[33] As soon as more than one VMM or nested VMMs are used, a problem appears in a way similar to what required shadow page table management to be invented, as describedabove. In such cases, VMCS needs to be shadowed multiple times (in case of nesting) and partially implemented in software in case there is no hardware support by the processor. To make shadow VMCS handling more efficient, Intel implemented hardware support for VMCS shadowing.[34]
VIA Nano 3000 Series Processors and higher support VIA VT virtualization technology compatible with Intel VT-x.[35] EPT is present inZhaoxin ZX-C, a descendant ofVIA QuadCore-E &Eden X4 similar to NanoC4350AL.[36]
In 2012, AMD announced theirAdvanced Virtual Interrupt Controller (AVIC) targeting interrupt overhead reduction in virtualization environments.[37] This technology, as announced, does not supportx2APIC.[38]In 2016, AVIC is available on the AMD family 15h models 6Xh(Carrizo) processors and newer.[39]
Also in 2012, Intel announced a similar technology for interrupt andAPIC virtualization, which did not have a brand name at its announcement time.[40]Later, it was branded asAPIC virtualization (APICv)[41]and it became commercially available in theIvy Bridge EP series of Intel CPUs, which is sold as Xeon E5-26xx v2 (launched in late 2013) and as Xeon E5-46xx v2 (launched in early 2014).[42]
Graphics virtualization is not part of the x86 architecture. IntelGraphics Virtualization Technology (GVT) provides graphics virtualization as part of more recent Gen graphics architectures. AlthoughAMD APUs implement thex86-64 instruction set, they implement AMD's own graphics architectures (TeraScale,GCN andRDNA) which do not support graphics virtualization.[citation needed]Larrabee was the only graphicsmicroarchitecture based on x86, but it likely did not include support for graphics virtualization.
Memory and I/O virtualization is performed by thechipset.[43] Typically these features must be enabled by the BIOS, which must be able to support them and also be set to use them.
An input/output memory management unit (IOMMU) allows guestvirtual machines to directly useperipheral devices, such as Ethernet, accelerated graphics cards, and hard-drive controllers, throughDMA andinterrupt remapping. This is sometimes calledPCI passthrough.[44]
An IOMMU also allows operating systems to eliminate bounce buffers needed to allow themselves to communicate with peripheral devices whose memory address spaces are smaller than the operating system's memory address space, by using memory address translation. At the same time, an IOMMU also allows operating systems and hypervisors to prevent buggy or malicious hardware fromcompromising memory security.
Both AMD and Intel have released their IOMMU specifications:
In addition to the CPU support, bothmotherboardchipset and system firmware (BIOS orUEFI) need to fully support the IOMMU I/O virtualization functionality for it to be usable. Only thePCI orPCI Express devices supportingfunction level reset (FLR) can be virtualized this way, as it is required for reassigning variousdevice functions between virtual machines.[48][49] If a device to be assigned does not supportMessage Signaled Interrupts (MSI), it must not shareinterrupt lines with other devices for the assignment to be possible.[50]Allconventional PCI devices routed behind a PCI/PCI-X-to-PCI Express bridge can be assigned to a guest virtual machine only all at once; PCI Express devices have no such restriction.
PCI-SIG Single Root I/O Virtualization (SR-IOV) provides a set of general (non-x86 specific) I/O virtualization methods based onPCI Express (PCIe) native hardware, as standardized by PCI-SIG:[52]
In SR-IOV, the most common of these, a host VMM configures supported devices to create and allocate virtual "shadows" of their configuration spaces so that virtual machine guests can directly configure and access such "shadow" device resources.[54] With SR-IOV enabled, virtualized network interfaces are directly accessible to the guests,[55]avoiding involvement of the VMM and resulting in high overall performance;[53] for example, SR-IOV achieves over 95% of thebare metal network bandwidth inNASA's virtualized datacenter[56] and in theAmazon Public Cloud.[57][58]