2 QEMU / KVM CPU model configuration
5 @c man begin DESCRIPTION
8 * recommendations_cpu_models_x86:: Recommendations for KVM CPU model configuration on x86 hosts
9 * recommendations_cpu_models_MIPS:: Supported CPU model configurations on MIPS hosts
10 * cpu_model_syntax_apps:: Syntax for configuring CPU models
13 QEMU / KVM virtualization supports two ways to configure CPU models
17 @item Host passthrough
19 This passes the host CPU model features, model, stepping, exactly to the
20 guest. Note that KVM may filter out some host CPU model features if they
21 cannot be supported with virtualization. Live migration is unsafe when
22 this mode is used as libvirt / QEMU cannot guarantee a stable CPU is
23 exposed to the guest across hosts. This is the recommended CPU to use,
24 provided live migration is not required.
28 QEMU comes with a number of predefined named CPU models, that typically
29 refer to specific generations of hardware released by Intel and AMD.
30 These allow the guest VMs to have a degree of isolation from the host CPU,
31 allowing greater flexibility in live migrating between hosts with differing
35 In both cases, it is possible to optionally add or remove individual CPU
36 features, to alter what is presented to the guest by default.
38 Libvirt supports a third way to configure CPU models known as "Host model".
39 This uses the QEMU "Named model" feature, automatically picking a CPU model
40 that is similar the host CPU, and then adding extra features to approximate
41 the host model as closely as possible. This does not guarantee the CPU family,
42 stepping, etc will precisely match the host CPU, as they would with "Host
43 passthrough", but gives much of the benefit of passthrough, while making
46 @node recommendations_cpu_models_x86
47 @subsection Recommendations for KVM CPU model configuration on x86 hosts
49 The information that follows provides recommendations for configuring
50 CPU models on x86 hosts. The goals are to maximise performance, while
51 protecting guest OS against various CPU hardware flaws, and optionally
52 enabling live migration between hosts with heterogeneous CPU models.
55 * preferred_cpu_models_intel_x86:: Preferred CPU models for Intel x86 hosts
56 * important_cpu_features_intel_x86:: Important CPU features for Intel x86 hosts
57 * preferred_cpu_models_amd_x86:: Preferred CPU models for AMD x86 hosts
58 * important_cpu_features_amd_x86:: Important CPU features for AMD x86 hosts
59 * default_cpu_models_x86:: Default x86 CPU models
60 * other_non_recommended_cpu_models_x86:: Other non-recommended x86 CPUs
63 @node preferred_cpu_models_intel_x86
64 @subsubsection Preferred CPU models for Intel x86 hosts
66 The following CPU models are preferred for use on Intel hosts. Administrators /
67 applications are recommended to use the CPU model that matches the generation
68 of the host CPUs in use. In a deployment with a mixture of host CPU models
69 between machines, if live migration compatibility is required, use the newest
70 CPU model that is compatible across all desired hosts.
73 @item @code{Skylake-Server}
74 @item @code{Skylake-Server-IBRS}
76 Intel Xeon Processor (Skylake, 2016)
79 @item @code{Skylake-Client}
80 @item @code{Skylake-Client-IBRS}
82 Intel Core Processor (Skylake, 2015)
85 @item @code{Broadwell}
86 @item @code{Broadwell-IBRS}
87 @item @code{Broadwell-noTSX}
88 @item @code{Broadwell-noTSX-IBRS}
90 Intel Core Processor (Broadwell, 2014)
94 @item @code{Haswell-IBRS}
95 @item @code{Haswell-noTSX}
96 @item @code{Haswell-noTSX-IBRS}
98 Intel Core Processor (Haswell, 2013)
101 @item @code{IvyBridge}
102 @item @code{IvyBridge-IBRS}
104 Intel Xeon E3-12xx v2 (Ivy Bridge, 2012)
107 @item @code{SandyBridge}
108 @item @code{SandyBridge-IBRS}
110 Intel Xeon E312xx (Sandy Bridge, 2011)
113 @item @code{Westmere}
114 @item @code{Westmere-IBRS}
116 Westmere E56xx/L56xx/X56xx (Nehalem-C, 2010)
120 @item @code{Nehalem-IBRS}
122 Intel Core i7 9xx (Nehalem Class Core i7, 2008)
127 Intel Core 2 Duo P9xxx (Penryn Class Core 2, 2007)
132 Intel Celeron_4x0 (Conroe/Merom Class Core 2, 2006)
136 @node important_cpu_features_intel_x86
137 @subsubsection Important CPU features for Intel x86 hosts
139 The following are important CPU features that should be used on Intel x86
140 hosts, when available in the host CPU. Some of them require explicit
141 configuration to enable, as they are not included by default in some, or all,
142 of the named CPU models listed above. In general all of these features are
143 included if using "Host passthrough" or "Host model".
150 Recommended to mitigate the cost of the Meltdown (CVE-2017-5754) fix
152 Included by default in Haswell, Broadwell & Skylake Intel CPU models.
154 Should be explicitly turned on for Westmere, SandyBridge, and IvyBridge
155 Intel CPU models. Note that some desktop/mobile Westmere CPUs cannot
156 support this feature.
159 @item @code{spec-ctrl}
161 Required to enable the Spectre v2 (CVE-2017-5715) fix.
163 Included by default in Intel CPU models with -IBRS suffix.
165 Must be explicitly turned on for Intel CPU models without -IBRS suffix.
167 Requires the host CPU microcode to support this feature before it
168 can be used for guest CPUs.
173 Required to enable stronger Spectre v2 (CVE-2017-5715) fixes in some
176 Must be explicitly turned on for all Intel CPU models.
178 Requires the host CPU microcode to support this feature before it
179 can be used for guest CPUs.
184 Required to enable the CVE-2018-3639 fix
186 Not included by default in any Intel CPU model.
188 Must be explicitly turned on for all Intel CPU models.
190 Requires the host CPU microcode to support this feature before it
191 can be used for guest CPUs.
196 Recommended to allow guest OS to use 1GB size pages
198 Not included by default in any Intel CPU model.
200 Should be explicitly turned on for all Intel CPU models.
202 Note that not all CPU hardware will support this feature.
204 @item @code{md-clear}
206 Required to confirm the MDS (CVE-2018-12126, CVE-2018-12127, CVE-2018-12130,
207 CVE-2019-11091) fixes.
209 Not included by default in any Intel CPU model.
211 Must be explicitly turned on for all Intel CPU models.
213 Requires the host CPU microcode to support this feature before it
214 can be used for guest CPUs.
218 @node preferred_cpu_models_amd_x86
219 @subsubsection Preferred CPU models for AMD x86 hosts
221 The following CPU models are preferred for use on Intel hosts. Administrators /
222 applications are recommended to use the CPU model that matches the generation
223 of the host CPUs in use. In a deployment with a mixture of host CPU models
224 between machines, if live migration compatibility is required, use the newest
225 CPU model that is compatible across all desired hosts.
230 @item @code{EPYC-IBPB}
232 AMD EPYC Processor (2017)
235 @item @code{Opteron_G5}
237 AMD Opteron 63xx class CPU (2012)
240 @item @code{Opteron_G4}
242 AMD Opteron 62xx class CPU (2011)
245 @item @code{Opteron_G3}
247 AMD Opteron 23xx (Gen 3 Class Opteron, 2009)
250 @item @code{Opteron_G2}
252 AMD Opteron 22xx (Gen 2 Class Opteron, 2006)
255 @item @code{Opteron_G1}
257 AMD Opteron 240 (Gen 1 Class Opteron, 2004)
260 @node important_cpu_features_amd_x86
261 @subsubsection Important CPU features for AMD x86 hosts
263 The following are important CPU features that should be used on AMD x86
264 hosts, when available in the host CPU. Some of them require explicit
265 configuration to enable, as they are not included by default in some, or all,
266 of the named CPU models listed above. In general all of these features are
267 included if using "Host passthrough" or "Host model".
274 Required to enable the Spectre v2 (CVE-2017-5715) fix.
276 Included by default in AMD CPU models with -IBPB suffix.
278 Must be explicitly turned on for AMD CPU models without -IBPB suffix.
280 Requires the host CPU microcode to support this feature before it
281 can be used for guest CPUs.
286 Required to enable stronger Spectre v2 (CVE-2017-5715) fixes in some
289 Must be explicitly turned on for all AMD CPU models.
291 Requires the host CPU microcode to support this feature before it
292 can be used for guest CPUs.
295 @item @code{virt-ssbd}
297 Required to enable the CVE-2018-3639 fix
299 Not included by default in any AMD CPU model.
301 Must be explicitly turned on for all AMD CPU models.
303 This should be provided to guests, even if amd-ssbd is also
304 provided, for maximum guest compatibility.
306 Note for some QEMU / libvirt versions, this must be force enabled
307 when when using "Host model", because this is a virtual feature
308 that doesn't exist in the physical host CPUs.
311 @item @code{amd-ssbd}
313 Required to enable the CVE-2018-3639 fix
315 Not included by default in any AMD CPU model.
317 Must be explicitly turned on for all AMD CPU models.
319 This provides higher performance than virt-ssbd so should be
320 exposed to guests whenever available in the host. virt-ssbd
321 should none the less also be exposed for maximum guest
322 compatibility as some kernels only know about virt-ssbd.
325 @item @code{amd-no-ssb}
327 Recommended to indicate the host is not vulnerable CVE-2018-3639
329 Not included by default in any AMD CPU model.
331 Future hardware generations of CPU will not be vulnerable to
332 CVE-2018-3639, and thus the guest should be told not to enable
333 its mitigations, by exposing amd-no-ssb. This is mutually
334 exclusive with virt-ssbd and amd-ssbd.
339 Recommended to allow guest OS to use 1GB size pages
341 Not included by default in any AMD CPU model.
343 Should be explicitly turned on for all AMD CPU models.
345 Note that not all CPU hardware will support this feature.
349 @node default_cpu_models_x86
350 @subsubsection Default x86 CPU models
352 The default QEMU CPU models are designed such that they can run on all hosts.
353 If an application does not wish to do perform any host compatibility checks
354 before launching guests, the default is guaranteed to work.
356 The default CPU models will, however, leave the guest OS vulnerable to various
357 CPU hardware flaws, so their use is strongly discouraged. Applications should
358 follow the earlier guidance to setup a better CPU configuration, with host
359 passthrough recommended if live migration is not needed.
365 QEMU Virtual CPU version 2.5+ (32 & 64 bit variants)
367 qemu64 is used for x86_64 guests and qemu32 is used for i686 guests, when no
368 -cpu argument is given to QEMU, or no <cpu> is provided in libvirt XML.
372 @node other_non_recommended_cpu_models_x86
373 @subsubsection Other non-recommended x86 CPUs
375 The following CPUs models are compatible with most AMD and Intel x86 hosts, but
376 their usage is discouraged, as they expose a very limited featureset, which
377 prevents guests having optimal performance.
384 Common KVM processor (32 & 64 bit variants)
386 Legacy models just for historical compatibility with ancient QEMU versions.
393 @item @code{core2duo}
396 @item @code{pentium2}
397 @item @code{pentium3}
399 Various very old x86 CPU models, mostly predating the introduction of
400 hardware assisted virtualization, that should thus not be required for
401 running virtual machines.
404 @node recommendations_cpu_models_MIPS
405 @subsection Supported CPU model configurations on MIPS hosts
407 QEMU supports variety of MIPS CPU models:
410 * cpu_models_MIPS32:: Supported CPU models for MIPS32 hosts
411 * cpu_models_MIPS64:: Supported CPU models for MIPS64 hosts
412 * cpu_models_nanoMIPS:: Supported CPU models for nanoMIPS hosts
413 * preferred_cpu_models_MIPS:: Preferred CPU models for MIPS hosts
416 @node cpu_models_MIPS32
417 @subsubsection Supported CPU models for MIPS32 hosts
419 The following CPU models are supported for use on MIPS32 hosts. Administrators /
420 applications are recommended to use the CPU model that matches the generation
421 of the host CPUs in use. In a deployment with a mixture of host CPU models
422 between machines, if live migration compatibility is required, use the newest
423 CPU model that is compatible across all desired hosts.
426 @item @code{mips32r6-generic}
428 MIPS32 Processor (Release 6, 2015)
433 MIPS32 Processor (P5600, 2014)
439 MIPS32 Processor (M14K, 2009)
444 MIPS32 Processor (74K, 2007)
449 MIPS32 Processor (34K, 2006)
456 MIPS32 Processor (24K, 2003)
466 MIPS32 Processor (4K, 1999)
469 @node cpu_models_MIPS64
470 @subsubsection Supported CPU models for MIPS64 hosts
472 The following CPU models are supported for use on MIPS64 hosts. Administrators /
473 applications are recommended to use the CPU model that matches the generation
474 of the host CPUs in use. In a deployment with a mixture of host CPU models
475 between machines, if live migration compatibility is required, use the newest
476 CPU model that is compatible across all desired hosts.
481 MIPS64 Processor (Release 6, 2014)
484 @item @code{Loongson-2F}
486 MIPS64 Processor (Loongson 2, 2008)
489 @item @code{Loongson-2E}
491 MIPS64 Processor (Loongson 2, 2006)
494 @item @code{mips64dspr2}
496 MIPS64 Processor (Release 2, 2006)
499 @item @code{MIPS64R2-generic}
503 MIPS64 Processor (Release 2, 2002)
508 MIPS64 Processor (20K, 2000)
514 MIPS64 Processor (5K, 1999)
519 MIPS64 Processor (VR, 1998)
524 MIPS64 Processor (MIPS III, 1991)
527 @node cpu_models_nanoMIPS
528 @subsubsection Supported CPU models for nanoMIPS hosts
530 The following CPU models are supported for use on nanoMIPS hosts. Administrators /
531 applications are recommended to use the CPU model that matches the generation
532 of the host CPUs in use. In a deployment with a mixture of host CPU models
533 between machines, if live migration compatibility is required, use the newest
534 CPU model that is compatible across all desired hosts.
539 MIPS I7200 (nanoMIPS, 2018)
543 @node preferred_cpu_models_MIPS
544 @subsubsection Preferred CPU models for MIPS hosts
546 The following CPU models are preferred for use on different MIPS hosts:
549 @item @code{MIPS III}
552 @item @code{MIPS32R2}
555 @item @code{MIPS64R6}
558 @item @code{nanoMIPS}
562 @node cpu_model_syntax_apps
563 @subsection Syntax for configuring CPU models
565 The example below illustrate the approach to configuring the various
566 CPU models / features in QEMU and libvirt
569 * cpu_model_syntax_qemu:: QEMU command line
570 * cpu_model_syntax_libvirt:: Libvirt guest XML
573 @node cpu_model_syntax_qemu
574 @subsubsection QEMU command line
578 @item Host passthrough
581 $ qemu-system-x86_64 -cpu host
584 With feature customization:
587 $ qemu-system-x86_64 -cpu host,-vmx,...
590 @item Named CPU models
593 $ qemu-system-x86_64 -cpu Westmere
596 With feature customization:
599 $ qemu-system-x86_64 -cpu Westmere,+pcid,...
604 @node cpu_model_syntax_libvirt
605 @subsubsection Libvirt guest XML
609 @item Host passthrough
612 <cpu mode='host-passthrough'/>
615 With feature customization:
618 <cpu mode='host-passthrough'>
619 <feature name="vmx" policy="disable"/>
627 <cpu mode='host-model'/>
630 With feature customization:
633 <cpu mode='host-model'>
634 <feature name="vmx" policy="disable"/>
643 <model name="Westmere"/>
647 With feature customization:
651 <model name="Westmere"/>
652 <feature name="pcid" policy="require"/>
663 @setfilename qemu-cpu-models
664 @settitle QEMU / KVM CPU model configuration
667 The HTML documentation of QEMU for more precise information and Linux
668 user mode emulator invocation.