Guide Libvirt XML options and what they do

Not open for further replies.


Staff member
May 26, 2020
This will be a Work In Progress for some time but I wanted to create an outline of the different options you see in libvirt XML files and what the different sections/options mean.

You can open your own XML file in Virt-Manager or via text editor and follow along. starting from the top.

This MUST be enabled on the Host or it'll do you no good. When a process uses some memory, the CPU is marking the RAM as used by that process. For efficiency, the CPU allocate RAM by chunks of 4K bytes (it's the default value on many platforms). Those chunks are named pages. Those pages can be swapped to disk, etc.

Most current CPU architectures support bigger pages (so the CPU/OS have less entries to look-up), those are named Huge pages (on Linux), Super Pages (on BSD) or Large Pages (on Windows), but it all the same thing

<vcpu placement="static" current="6"></vcpu>
    <vcpupin vcpu="0" cpuset="0"/>
    <vcpupin vcpu="1" cpuset="1"/>
    <vcpupin vcpu="2" cpuset="2"/>
    <vcpupin vcpu="3" cpuset="3"/>
    <vcpupin vcpu="4" cpuset="4"/>
    <vcpupin vcpu="5" cpuset="5"/>
    <vcpupin vcpu="6" cpuset="6"/>
    <vcpupin vcpu="7" cpuset="7"/>
    <emulatorpin cpuset="0,4"/>
vCPU Placement - Placement can be set as either static or auto. If you set <vcpu placement='auto'>, the system will query numad and use the settings specified in the <numatune> tag, and ignore any other settings in <vcpu> . If you set <vcpu placement='static'>, the system will use the settings specified in the <vcpu placement> tag instead of the settings in <numatune>.

Note: The pinning policy of vCPUs can be specified separately by using the cputune attribute. If the emulatorpin attribute is specified in <cputune>, the cpuset value specified by <vcpu> will be ignored. Similarly, virtual CPUs that have set a value for vcpupin cause cpuset settings to be ignored.

   <relaxed state='on'/>
   <vapic state='on'/>
   <spinlocks state='on' retries='8191'/>

<clock ...>
  <timer name='hypervclock' present='yes'/>
Some details about the individual features:
  • relaxed/hv_relaxed. This option is responsible for disabling the builtin Windows sanity check. We turn this off because otherwise we can get BSOD under heavy workloads in the VM.
  • vapic/hv_vapic. - Something to do with WIndows Drivers. Need research
  • spinlocks/hv_spinlocks. Allows vcpus to wake up other vcpus that are in a halted state.
  • hypervclock/hv_time. Prevents time sync issues between the host and guest OS. This is Similar to kvmclock, a paravirt time source which is used when Linux is running on KVM.
It should be safe to enable these bits for all Windows VM, though only Vista/Server 2008 and later will actually make use of the features.\

Will be expanded soon....
Last edited:
Not open for further replies.