Skip to content

Notes on Virtualization

Version History
Date Description
Dec 31, 2020 minor update
Feb 4, 2020 Add VFIO stuff
Jan 26, 2020 Minor adjustment
Jan 25, 2020 Initial Document


In order to truly understand the whole virtualization thing, I decided to read QEMU/KVM/etc source code. The document was orginally written in a Google Document, the following presentation is just an embedded version.

I’d also recommend some reading on the histoy of virtualization. It goes from software-based virt, to paravirt, to hardware-assisted virt, and now even on separate hw cards (e.g., AWS Nitro cards).

The questions I’ve focused on are: 1) how QEMU emulates all the devices (essentially, CPU and device communicates via addresses, and this is where all the tricks happen), 2) how KVM uses CPU features to switch between VMs, catch faults, return to QEMU etc, 3) how KVM and QEMU work together, 4) how virto works and how device-passthrough works (via VFIO), 5) and finally, if I want to write a new virtual machine monitor like QEMU, what should I build. Several recent projects (e.g., rust-vmm, firecracker) have some hints on this.

Last update: December 31, 2020