Cloud Parts

KVM (Kernel-based Virtual Machine)

The hypervisor built into the Linux kernel: it runs guest code directly on the CPU through /dev/kvm, and leaves device emulation to a user-space program such as QEMU or Firecracker.

What it is
Hypervisors
Type
Open source
Made by
Linux kernel community
License
GPL 2.0
Facts checked
11 October 2026

What it is

KVM turns a Linux kernel into a hypervisor. On x86 it is a core module, kvm, plus a vendor module that drives the CPU’s virtualization extensions: kvm-intel for Intel VT (VMX) or kvm-amd for AMD-V (SVM). On arm64 it is built into the kernel rather than loaded as a module. KVM exposes one character device, /dev/kvm, and a set of ioctl calls on it. KVM_CREATE_VM returns a file descriptor for a new VM, KVM_CREATE_VCPU on that returns one per virtual CPU, and a thread that calls KVM_RUN on a vCPU makes the processor run guest code natively, in a guest mode alongside the usual kernel and user modes. When the guest does something the kernel can’t finish on its own, such as port I/O or touching a memory-mapped device, KVM_RUN returns with an exit reason like KVM_EXIT_IO or KVM_EXIT_MMIO, the program handles it and calls KVM_RUN again. Each VM is an ordinary process and each vCPU a thread, so the Linux scheduler, top, taskset and kill all work on them.

KVM itself emulates no disks, network cards or firmware. A user-space virtual machine monitor (VMM) provides those: QEMU is the classic one, and Firecracker, Cloud Hypervisor and crosvm are smaller ones written in Rust. Guests run fastest with paravirtual virtio devices, and VFIO lets the VMM hand a physical device, such as a GPU or a NIC, straight to a guest behind the IOMMU. The kernel also supplies what VM platforms build on: a dirty-page log for live migration, Kernel Samepage Merging (KSM, originally written for KVM) to share identical memory pages between VMs, and nested virtualization, on by default for Intel and AMD since Linux 4.20.

Avi Kivity started KVM at the startup Qumranet, and it was merged into Linux 2.6.20 in February 2007. Red Hat bought Qumranet in September 2008. KVM now sits under some of the largest VM fleets: AWS’s Nitro Hypervisor is built on core KVM technology, Google Compute Engine runs on KVM with Google’s own VMM instead of QEMU, and Proxmox VE, OpenStack’s libvirt driver and KubeVirt all run their VMs on QEMU with KVM.

Why teams pick it

  • Part of the mainline Linux kernel, so mainstream distributions ship it, and it reuses Linux’s scheduler, NUMA support and timers instead of writing its own
  • Near-native CPU speed: guest code runs directly on the processor, and only I/O and a few privileged operations exit to the host
  • A small, stable API (KVM_GET_API_VERSION has returned 12 since Linux 2.6.22; the two earlier releases are unsupported) that many VMMs build on, from QEMU to Firecracker
  • Proven at cloud scale: AWS’s Nitro Hypervisor and Google Compute Engine are built on it, and Google describes it as validated by scores of security researchers

Watch out for

  • Not a product on its own: you need a user-space VMM for devices and a management layer (libvirt, Proxmox VE, OpenStack, KubeVirt) for anything beyond one VM
  • Linux hosts only, and the CPU must have hardware virtualization; in a cloud VM that means nested virtualization or a bare-metal instance
  • Device passthrough with VFIO needs an IOMMU and ties the VM to that host, which complicates live migration
  • Every exit from guest mode is expensive, so I/O-heavy guests need paravirtual virtio devices or passthrough to get close to native speed; fully emulated devices are slow

Alternatives

What all hypervisors have in common →
Cloud HypervisorOpen sourceA Rust virtual machine monitor for modern cloud VMs on KVM or Microsoft’s hypervisor: virtio devices only, plus hotplug, VFIO passthrough, live migration, snapshots and Windows guests.libvirtOpen sourceA stable API, daemon and `virsh` command line for managing virtual machines, storage and networks, with drivers for QEMU/KVM, Xen, LXC, Cloud Hypervisor, VMware ESX, Hyper-V and more.Microsoft Hyper-VCommercialMicrosoft’s type-1 hypervisor, built into Windows Server and Windows 10 and 11 Pro and Enterprise: a thin hypervisor under a Windows root partition, which also underpins Azure’s hypervisor and Windows features like VBS, WSL 2 and Windows Sandbox.Oracle VirtualBoxOpen sourceOracle’s free, open-source desktop hypervisor: a type-2 hypervisor that runs VMs as an application on Windows, macOS, Linux and Solaris, scriptable with `VBoxManage` and the default provider for Vagrant.Proxmox Virtual EnvironmentOpen sourceA Debian-based server platform from Vienna that runs KVM virtual machines and LXC containers, with clustering, high availability, Ceph and ZFS storage, backups and a web interface in one free ISO.QEMUOpen sourceThe open-source machine emulator and virtualizer: it emulates whole computers in software, or runs them at native speed on a hypervisor such as KVM, and supplies the virtual devices either way.VMware ESXiCommercialVMware’s bare-metal hypervisor (called ESX again since VCF 9), whose own kernel runs VMs directly on servers while vCenter adds vMotion, HA, DRS and vSAN; since Broadcom bought VMware in 2023 it is sold only as per-core subscriptions.Xen Project hypervisorOpen sourceThe open-source type-1 hypervisor from Cambridge that ran the first Amazon EC2 instances: a small microkernel-style core that boots first, with drivers and management in a privileged VM called dom0.

How it fits with other technologies

The first three steps of every KVM-based VMM: open `/dev/kvm`, check the API version, create a VM and a vCPU · c

// Compiled with gcc 14.2 (Debian 13 container on Docker for an arm64 Mac, no /dev/kvm):
//   $ gcc -Wall -Wextra -o kvmcheck kvmcheck.c && ./kvmcheck
//   open /dev/kvm: No such file or directory
// On a Linux host with KVM loaded it prints the API version and the new file descriptors.
#include <fcntl.h>
#include <linux/kvm.h>
#include <stdio.h>
#include <sys/ioctl.h>

int main(void) {
    int kvm = open("/dev/kvm", O_RDWR | O_CLOEXEC);
    if (kvm < 0) { perror("open /dev/kvm"); return 1; }

    int version = ioctl(kvm, KVM_GET_API_VERSION, 0);
    printf("KVM API version: %d\n", version);
    if (version != 12) return 1;                      /* the docs: refuse to run otherwise */

    int vm = ioctl(kvm, KVM_CREATE_VM, 0);            /* a VM file descriptor */
    int vcpu = ioctl(vm, KVM_CREATE_VCPU, 0);         /* vCPU 0 */
    printf("vm fd %d, vcpu fd %d, max vcpus %d\n", vm, vcpu,
           ioctl(kvm, KVM_CHECK_EXTENSION, KVM_CAP_MAX_VCPUS));

    /* A real VMM continues: KVM_SET_USER_MEMORY_REGION to give the guest RAM,
       mmap() the vCPU's struct kvm_run, then loop on ioctl(vcpu, KVM_RUN, 0)
       and emulate a device on each KVM_EXIT_IO or KVM_EXIT_MMIO. */
    return 0;
}

The user-space half: VMMs that run on KVM#

KVM runs the vCPUs; one of these programs supplies the devices, firmware and API around them.

QEMU

general purpose

Emulates a full PC or Arm board with hundreds of device models, runs Windows and other guests, and is what libvirt, Proxmox VE, OpenStack and KubeVirt drive.

Firecracker

microVMs

AWS’s minimal Rust VMM for Lambda: a handful of virtio devices, no BIOS, configured through a REST API on a Unix socket.

Cloud Hypervisor

cloud VMs

A Rust VMM for modern cloud workloads that runs on KVM or Microsoft’s MSHV.

crosvm

ChromeOS

The Chromium OS VMM, written in Rust, which runs each virtual device in its own sandbox. It was built for KVM on Linux, and Firecracker started from its code.

Google’s own VMM

Compute Engine

Google says it doesn’t use QEMU for Compute Engine and wrote its own user-space VMM on top of KVM for security reasons.

See it in a real stack

No architecture uses KVM (Kernel-based Virtual Machine) yet. Drop it into the playground and wire it up yourself.Open playground →
Where it came from2006–2018

By 2006 Intel and AMD had both added hardware virtualization extensions to x86, which made a hypervisor much simpler to write: the CPU itself could run a guest in a separate mode and report why it stopped. Xen had brought virtualization to open source, first through paravirtualization (modified guests) and then full virtualization. Avi Kivity and colleagues at Qumranet, a startup selling virtualization technology, took another route: make Linux itself the hypervisor, with a driver that exposes the CPU extensions to user space through /dev/kvm.

KVM was merged into Linux 2.6.20, released on February 5, 2007. Its first version could not yet run guests with more than one vCPU, and Windows installs crashed with a blue screen. The 2007 Ottawa Linux Symposium paper by Kivity, Yaniv Kamay, Dor Laor, Uri Lublin and Anthony Liguori described the design: a third execution mode for Linux, I/O forwarded to user space, a dirty-page log for live migration. Red Hat bought Qumranet, with KVM, for about $107 million in September 2008.

Because it was just Linux, KVM improved with every kernel release and spread with every distribution. QEMU merged KVM support upstream in version 0.10 (2009), KSM followed in Linux 2.6.32, and KVM gained ports to s390, PowerPC and, in Linux 3.9, Arm. Google Compute Engine (by Google’s own 2017 account) and AWS’s Nitro Hypervisor are both built on it.

Why it’s built this way

A kernel module, not a separate hypervisor
Being part of Linux let KVM reuse the scheduler, NUMA support and timers instead of writing its own, and let users manage VMs with top, taskset and kill like any other process.
Leave device emulation to user space
All port and memory-mapped I/O is forwarded to a user-space program, so the kernel part stays small and the large, risky device models live in an unprivileged process that can be swapped for a different VMM.
Require hardware virtualization
Relying on Intel’s and AMD’s extensions instead of binary translation or a modified guest kept the code simple. KVM put the shared code in kvm.ko and each vendor’s differing instructions behind a table of function pointers in kvm-intel.ko and kvm-amd.ko.

Timeline

  1. 2006

    Written at Qumranet by Avi Kivity and Yaniv Kamay

  2. 2007

    Merged into Linux 2.6.20 (February 5); OLS paper describes the design

  3. 2008

    Red Hat buys Qumranet for about $107 million (September)

  4. 2009

    QEMU 0.10 adds KVM acceleration upstream (March); KSM lands in Linux 2.6.32

  5. 2017

    Google describes the hardened KVM under Compute Engine (January)

  6. 2018

    Linux 4.20 turns nested virtualization on by default for Intel and AMD

Sources17 · facts checked 11 October 2026

Improve this page on GitHub