The Cast: Hypervisor and Domains

Life as a Xen hypervisorintermediate · standard · comprehensive | model: claude-opus-4-8 | 2026-06-17
Quick ref
xl list show running domains
xl create vm.cfg boot a domU
xl console dom attach to guest console
xl info host + hypervisor facts
xl dmesg hypervisor ring buffer
xl top live per-domain resource use
xl migrate dom host live migrate

The Cast: Hypervisor and Domains

Xen hypervisor
Thin Type-1 layer owning CPU scheduling, memory translation, and event delivery; runs no drivers itself.
dom0
First, privileged domain booted by Xen; hosts the toolstack, real device drivers, and backend halves.
domU
Unprivileged guest with no direct hardware access; reaches devices via split drivers.
driver domain
Deprivileged domain owning a NIC/HBA via passthrough, exporting backends — shrinks dom0's attack surface.
stub domain
Per-HVM-guest sandbox running its QEMU device model, isolating emulation from dom0.
toolstack (xl/libxl)
User-space control plane in dom0 that issues hypercalls to build, pause, and destroy domains.
Note "Disaggregation" splits dom0's roles across driver and stub domains so one compromised driver doesn't own the host.

Execution Modes: PV / HVM / PVH

ModeHardware virtBoot/privilegeI/O path
PVNone — pure hypercallsXen-aware kernel, ring deprivilegingPV split drivers only
HVMVT-x / AMD-V + EPT/NPTUnmodified OS, emulated BIOSQEMU emulation, optional PV drivers
PVHVT-x / AMD-V + EPT/NPTPV boot, no QEMU/firmware emulationPV split drivers, hardware MMU
Tip PVH is the modern default: it keeps PV's lean device model while using hardware virtualization for memory and privilege, avoiding PV's costly pagetable hypercalls and HVM's QEMU overhead.

CPU Scheduling

credit2
Default general-purpose scheduler; weight + cap based, latency-aware load balancing across pCPUs.
rtds
Real-time deferrable-server scheduler with per-vCPU period/budget for latency guarantees.
null
Static 1:1 vCPU-to-pCPU pinning with no overhead; ideal for dedicated/NFV workloads.
xl vcpu-pin dom v pcpu
Pin a vCPU to physical CPUs for cache locality or NUMA placement.
xl sched-credit2 -d dom -w 512
Set a domain's scheduling weight.
xl cpupool-*
Partition pCPUs into pools, each with its own scheduler instance.

Memory: Translation & Ballooning

Address translation

HVM/PVH use hardware EPT/NPT to map guest-physical to machine frames; classic PV guests use direct/shadow pagetables. The P2M and reverse M2P tables track guest↔machine frame relationships.

Reclaiming memory

The in-guest balloon driver inflates to return pages to Xen and deflates to take them back, enabling overcommit within maxmem. It is one tool among many — not the primary memory mechanism.

xl mem-set dom 2048
Balloon the domain's current target to 2 GiB.
xl mem-max dom 4096
Set the hard ceiling the balloon can grow toward.
dom0_mem=4G,max:4G
Boot arg pinning dom0 memory to avoid contention.
Warning Ballooning a guest below its working set triggers in-guest OOM kills, not graceful slowdown — set sane maxmem floors.

I/O Plumbing: Split Drivers, Grants, Channels, Xenstore

netfront / blkfront
Lightweight frontend drivers in domU that talk to backends over a shared ring.