Domain Topology

Life as a Xen hypervisorintermediate · standard · comprehensive | model: claude-opus-4-8 | 2026-06-19
Quick ref
xl list show running domains
xl create cfg start a domU
xl console N attach to domain console
xl info host/hypervisor summary
xenstore-ls dump xenstore tree
xl migrate D host live migrate domain
xl dmesg hypervisor ring buffer

Domain Topology

Xen is a Type-1 microkernel hypervisor: a thin privileged layer that owns CPU, memory and scheduling, while all rich device logic lives in guest domains.

Xen hypervisor
Ring -1/EL2 layer; schedules vCPUs, partitions RAM, mediates grants and event channels — no device drivers.
dom0
First, privileged guest started at boot; owns hardware, runs toolstack (xl/libxl) and backend drivers.
domU
Unprivileged guest; sees virtual devices only, reaches hardware via split drivers in a backend domain.
driver domain
Deprivileged domain holding a real device (NIC/disk) so a dom0 driver crash can't sink the host.
stub domain
Minimal per-guest domain running QEMU device emulation, isolating the HVM model out of dom0.
xenstored / xenconsoled
Dom0 daemons providing the config database and serial console multiplexing.
Note Disaggregation (driver + stub domains) shrinks dom0's trusted computing base; a compromised backend then only owns its slice of hardware.

Execution Modes: PV / HVM / PVH

ModeCPU virtualizationI/O pathTrade-off
PVParavirtual; guest uses hypercalls, no VT-x neededPV split drivers onlyNeeds Xen-aware kernel; weak isolation of page tables
HVMHardware VT-x/AMD-V + EPT/NPT; QEMU emulates platformEmulated devices, PV drivers via PVHVMRuns unmodified OS; emulation overhead
PVHHardware virt for CPU/MMU, no emulated platformPV drivers + virtual local APICLightweight modern default; needs PVH-capable kernel
Tip Prefer PVH for new Linux/BSD guests: it drops QEMU's attack surface while keeping hardware-accelerated memory translation. Classic PV is largely legacy post-Meltdown.

CPU Scheduling

Schedulers

credit2 is the default weighted fair-share scheduler; null statically pins vCPUs for latency-critical/NFV workloads; rtds offers a deadline-based real-time policy.

Controls

Tune per-domain weight and cap; bind vCPUs to pCPUs with affinity; isolate domains into cpupools each with its own scheduler.

xl sched-credit2 -d D -w 512
Set scheduling weight for a domain.
xl vcpu-pin D vcpu pcpu
Hard-pin a vCPU to a physical CPU.
xl cpupool-create
Carve CPUs into an isolated pool with its own scheduler.
xl vcpu-list
Show vCPU→pCPU placement and affinity masks.

Memory: Translation & Ballooning

P2M / M2P tables
Map guest pseudo-physical frames to machine frames and back; HVM/PVH use hardware EPT/NPT for this.
balloon driver
In-guest driver returns/claims pages so the host can overcommit between maxmem and current target.
xl mem-set D 2048
Drive the balloon to resize a guest's live allocation.
tmem / claims
Transcendent memory and claim API reduce racey allocation failures under overcommit.
xl mem-max D 4096
Set the ceiling the balloon may inflate up to.
NUMA affinity
Xen places domain memory on the node matching its vCPU affinity to avoid cross-node penalties.
Warning Ballooning below the guest's working set triggers swapping inside the guest, not graceful shrink; never set the target under what the workload actually touches.

Split I/O: Grants, Event Channels, XenStore

Virtual devices are a frontend/backend pair connected through three primitives that together replace emulated hardware.

Grant references

A guest authorizes a specific backend to map or copy specific pages, enabling zero-copy I/O without exposing its whole address space.

Event channels

Lightweight virtual interrupts/IPIs that signal "ring has data" between front and back ends and deliver timer/IPI notifications.

vif / netfront ↔ netback
Networking split driver; ring buffers in granted pages carry packets.
vbd / blkfront ↔ blkback
Block storage split driver using indirect grant descriptors.
xenstore-ls /local/domain/N
Inspect a domain's device tree and negotiated state.
xenstore-read path
Read a key; backends/frontends rendezvous via the XenBus state machine here.
Note XenStore is a small transactional key/value tree for configuration and connection setup — not a data path. Bulk I/O always flows through grant-mapped rings.

PCI Passthrough & IOMMU Isolation