Comment 3 for bug 1439280

Revision history for this message
Kashyap Chamarthy (kashyapc) wrote :

Yes, to test CPU pinning/NUMA with libvirt you ought to use Nested KVM.
Please report results after testing with that.

That said, some notes below.

Quoting Dan Berrange from a different review with a complete response on
*why*:

   It is fundamentally impossible to test CPU pinning with TCG (aka plain
   QEMU) because TCG only has a single thread for all virtual CPUs. As such
   there is no mechanism to pin vCPU threads with TCG. Nested KVM is thus
   the only possible option for testing any of the NUMA / CPU pinning
   stuff. Instructions for nested KVM setup on a KVM host are documented
   here

    http://docs.openstack.org/developer/nova/devref/testing/libvirt-numa.html#provisioning-a-virtual-machine-for-testing

From my testing, a Nova guest booted with a NUMA flavor, will have the
below contextual XML snippets w.r.t vCPU placement:

    . . .
      <vcpu placement='static'>4</vcpu>
      <cputune>
        <vcpupin vcpu='0' cpuset='0-3'/>
        <vcpupin vcpu='1' cpuset='0-3'/>
        <vcpupin vcpu='2' cpuset='0-3'/>
        <vcpupin vcpu='3' cpuset='0-3'/>
        <emulatorpin cpuset='0-3'/>
      </cputune>
      <numatune>
        <memory mode='strict' nodeset='0'/>
        <memnode cellid='0' mode='strict' nodeset='0'/>
      </numatune>
    . . .
      <cpu>
        <topology sockets='4' cores='1' threads='1'/>
        <numa>
          <cell id='0' cpus='0-3' memory='1048576' unit='KiB'/>
        </numa>
      </cpu>
    . . .

Here's the working example XMLs from my testing.

Libvirt XML for the guest hypervisor (also called L1), running DevStack
and will host Nova instances which are nested guests:

    https://kashyapc.fedorapeople.org/virt/openstack/nova-libvirt-numa-testing/devstack-vm-libvirt.xml

And, Nova guest XML, booted with a NUMA flavor:

    https://kashyapc.fedorapeople.org/virt/openstack/nova-libvirt-numa-testing/nova-guest-libvirt.xml