**KVM** (Kernel-based Virtual Machine) is the hypervisor built directly into the Linux kernel. When enabled, it turns any Linux host into a Type-1 hypervisor capable of running hardware-accelerated virtual machines. It is the foundation of nearly every open source cloud deployment and the engine behind [[OpenStack]], and most production virtualisation stacks.
---
### First Principle: The hypervisor should be part of the OS, not a separate proprietary layer.
KVM leverages Intel VT-x and AMD-V hardware virtualisation extensions to run guest VMs with near-native performance. Because it lives in the kernel, it benefits from Linux's scheduler, memory management, security hardening, and device driver ecosystem — essentially for free.
---
### Key Considerations
- **KVM + QEMU**: KVM provides CPU and memory virtualisation. QEMU provides device emulation (virtual NICs, disks, etc.). Together they form the complete virtualisation stack.
- **[[libvirt]] Layer**: Most tools don't interact with KVM/QEMU directly — they go through [[libvirt]], which provides a stable management API.
- **Performance**: With hardware virtualisation extensions enabled, KVM VMs typically run within 2–5% of bare metal performance for compute workloads.
- **GPU Passthrough**: KVM supports VFIO-based GPU passthrough, giving VMs direct access to GPUs — important for ML/AI cloud workloads.
- **OpenStack Nova**: Nova's compute driver calls KVM/QEMU via [[libvirt]] to spawn and manage VM instances. KVM is the default compute backend.
---
### How It Fits
```
[[Bare Metal]] (physical server)
→ KVM (kernel hypervisor, hardware acceleration)
→ QEMU (device emulation)
→ [[libvirt]] (management API)
→ [[OpenStack]] Nova / [[KubeVirt]] (cloud orchestration)
```
[[Bare Metal]] | [[libvirt]] | [[OpenStack]] | [[VMs]] | [[KubeVirt]] | [[Open Source Hyperscaler MoC]]