libvirt configuration

Start a vhost-user netdevice with libvirt with the following configuration:

<interface type='vhostuser'>
  <mac address='52:54:00:ee:96:6d'/>
  <source type='unix' path='/tmp/vhost_sock0' mode='server'/>
  <model type='virtio'/>
  <driver queues='8'/>
</interface>
path

Path to the vhost-user socket.

queues=x

Number of queue pairs seen by the driver on the guest. This requires a patch in libvirt, provided in librte_pmd_vhost/patches/libvirt-v1.12.12.

Important

Start the VM with memory allocated from hugepages in shared mode with the following configuration (the vhost-user PMD must be able to map the VM’s memory to write in the virtio ring):

<cpu>
  <numa>
    <cell id="0" cpus="0" memory="2097152" memAccess="shared"/>
  </numa>
</cpu>
<memoryBacking>
  <hugepages>
    <page size="2048" unit="KiB" nodeset="0"/>
  </hugepages>
</memoryBacking>