Choosing a CPU Model for Virtual Machines: host-passthrough, host-model, Named Models and Live Migration Compatibility
The CPU is what most often breaks live migration. The three CPU modes on KVM based platforms, computing a common model for a mixed fleet, mitigation flags, microcode updates and processes dying with SIGILL.
When you live migrate a virtual machine from one host to another, the guest operating system should not notice. The part that most often breaks this promise is not memory or disk, it is the CPU. A guest inspects the processor's features at boot, picks its code paths accordingly, and never revisits that decision. If the target host lacks one of those features, the migration is either refused or, worse, it succeeds and a process inside the guest dies with an illegal instruction. This post covers CPU model selection on KVM based platforms (libvirt, Proxmox, OpenStack, KubeVirt) and how it affects live migration, performance and security mitigations.
Three approaches
libvirt defines the CPU mode in three ways, and the options of the other platforms are built on top of these.
host-passthrough exposes the physical processor to the guest as is: model name, feature flags, cache information. Performance is as good as it gets, since the guest can use AVX-512, AES-NI and every newer vector extension. The cost is that the guest is now tied to that host model. Live migrating to a host without the same model and microcode level is not safe.
host-model makes libvirt pick the named model closest to the host CPU and add the extra flags the host supports. The result is frozen when the guest starts: the definition turns into a concrete model plus a flag list, and migration checks whether the target can satisfy that list. Performance is close to passthrough and migration rules are predictable, but the guest inherits the capabilities of whichever host it booted on.
A named (custom) model is one you choose from what QEMU knows, such as Skylake-Server, EPYC or Cascadelake-Server. The guest sees only that model's features, and every host in the cluster that can provide the model is a valid migration target. You give up some performance and in return manage the fleet independently of hardware generations.
Proxmox makes this decision with a generic default such as x86-64-v2-AES. OpenStack Nova controls it with cpu_mode and cpu_models in the [libvirt] section. KubeVirt uses the spec.domain.cpu.model field of the VM definition.
Which one, and when
Here is the opinionated answer: in a mixed fleet that live migrates, use a named model chosen for the oldest host in the cluster. It is boring and it is right.
host-passthrough is correct for workloads that live on a single host or never move, for compute jobs that are sensitive to CPU features (numerical simulation, video encoding, inference that relies on vector instructions), and for lab machines that need nested virtualization. It also works when the whole fleet really is identical hardware, but that claim tends to break at the first hardware refresh, and nobody remembers to revisit it.
host-model is a good middle ground for a homogeneous fleet. Its real problem shows up when you add a newer generation: guests started on the new hosts inherit the new flags and can no longer move to the old ones. From the day you add the new servers, machines started there quietly become "new hardware only". You will not get stuck when draining the old hosts. You will get stuck when draining the new ones.
A named model is the only sustainable option for a fleet that is mixed or will become mixed.
Finding the common model
Compute it instead of guessing. On each host, see which models QEMU can actually run there:
virsh domcapabilities | less
The <mode name='custom'> section lists the models with usable='yes' on this host. To find the common denominator of several hosts, collect each host's CPU definition into one file and run:
virsh hypervisor-cpu-baseline hosts-cpu.xml
This produces the widest model and flag list that every listed processor can satisfy. To ask whether a given guest CPU will run on a given host, use virsh hypervisor-cpu-compare. Both belong in the checklist before a new hardware generation joins the cluster.
In a libvirt definition, the result looks like this:
<cpu mode='custom' match='exact' check='full'>
<model fallback='forbid'>Cascadelake-Server</model>
<feature policy='require' name='md-clear'/>
</cpu>
fallback='forbid' matters: if the model is not available on the host, libvirt refuses to start the guest rather than silently falling back to a different model. A silent fallback means the guest sees one CPU on one host and another CPU elsewhere.
In KubeVirt the equivalent is short:
spec:
domain:
cpu:
model: Cascadelake-Server
KubeVirt labels nodes with the CPU models they support, and the scheduler only places the VM on nodes that can provide the model. That narrows the migration targets automatically as well.
Pitfalls
Security mitigations arrive as flags. Mitigating Spectre class issues from inside the guest depends on the guest seeing flags such as spec-ctrl, ssbd and md-clear. Older named models do not include them. Check /sys/devices/system/cpu/vulnerabilities/ inside the guest; if it says "Vulnerable", what is missing is usually not a patch but a flag the guest was never shown. QEMU's versioned models (for example Skylake-Server-v4) add these flags, so prefer a versioned model where you can.
Microcode updates remove flags. Some microcode updates disable problematic features; the well known case is TSX (hle, rtm) being turned off. Guests booted with host-model still carry those flags and can no longer migrate to a host with updated microcode. Treat a microcode update like a hardware change and plan the maintenance order around it.
The migration succeeded, the application is dead. With host-passthrough, a guest forced onto a host of a different generation often keeps its kernel running. What dies are user space processes that chose an AVX-512 path at startup. Databases, compression and crypto libraries make that choice once. The symptom is a process crashing with SIGILL, and nobody connects it to last night's migration.
Too old a model will not boot the OS. A very generic model picked for safety may no longer be enough. Some recent distributions require the x86-64-v3 level (which includes AVX2) and will not boot on a v2 level model. When you compute the common denominator, set the floor by the guest operating systems you plan to run, not just by the hardware.
Flags that block migration. Exposing features such as the invariant TSC (invtsc) typically prevents live migration. Enabling vmx or svm for nested virtualization brings similar restrictions. Turn these on only for machines that need them and put those machines in a non-migrating class.
Licensing and activation. Some commercial software and operating systems want to revalidate their license when the visible CPU model changes. If you plan a model change, do it in an announced batch, not one machine at a time without notice.
How to roll it out
Changing the CPU model of a running guest requires a restart, because the model is fixed at boot and cannot be changed live. The order is: compute the common denominator across all hosts, verify on a test machine that your target guest operating systems boot on that model, then update the definitions and restart machines in planned maintenance windows. Until they restart they keep running with the old definition, so track which machine runs on which model during the transition.
When not to bother
If you do not live migrate, and instead shut machines down for maintenance and boot them elsewhere, use host-passthrough for the best performance and move on. On a cold move the guest reboots and discovers the new processor from scratch. CPU model selection matters in clusters where live migration and automatic host draining are part of daily operations, and there you should make the decision once, based on the oldest host, and with measurements.