<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Sep 12, 2015 at 9:55 AM, Garrett Powell <span dir="ltr"><<a href="mailto:garretttracypowell@gmail.com" target="_blank">garretttracypowell@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Per Alex's recommendation, I've switched from controlling QEMU directly to using libvirt. I've been trying for the past few days to get CPU pinning to work, but my performance hasn't improved. I should mention that my graphics performance is fine. After reading through the entire thread at <a href="http://virtualkvm.com" target="_blank">virtualkvm.com</a>, I've found a lot of people with similar issues but no solutions that have worked for me. I'm using a single quad-core processor with HT.<div><br><div>Here's part of my xml file:<div><div><domain type='kvm' xmlns:qemu='<a href="http://libvirt.org/schemas/domain/qemu/1.0" target="_blank">http://libvirt.org/schemas/domain/qemu/1.0</a>'></div></div><div>  . . .</div><div><div>  <vcpu placement='static'>4</vcpu></div><div>  <cputune></div><div>    <vcpupin vcpu='0' cpuset='2'/></div><div>    <vcpupin vcpu='1' cpuset='3'/></div><div>    <vcpupin vcpu='2' cpuset='6'/></div><div>    <vcpupin vcpu='3' cpuset='7'/></div><div>  </cputune></div></div><div>  . . .</div><div><div>  <cpu mode='host-passthrough'></div><div>    <topology sockets='1' cores='2' threads='2'/></div><div>  </cpu></div></div><div>  . . .</div><div></domain></div><div><br></div><div>Here are the core ids for my CPUs (0-7):</div><div>$ cat /proc/cpuinfo | grep "core id"</div><div><div>core id<span style="white-space:pre-wrap">          </span>: 0</div><div>core id<span style="white-space:pre-wrap">               </span>: 1</div><div>core id<span style="white-space:pre-wrap">               </span>: 2</div><div>core id<span style="white-space:pre-wrap">               </span>: 3</div><div>core id<span style="white-space:pre-wrap">               </span>: 0</div><div>core id<span style="white-space:pre-wrap">               </span>: 1</div><div>core id<span style="white-space:pre-wrap">               </span>: 2</div><div>core id<span style="white-space:pre-wrap">               </span>: 3</div></div><div><br></div><div>Here are my kernel parameters:</div><div>GRUB_CMDLINE_LINUX_DEFAULT="isolcpus=2,3,6,7 intel_iommu=on rd.driver.pre=vfio-pci"<br></div><div><br></div><div>Some things from the forum thread I tried:</div><div><ul><li>Using <emulatorpin cpuset='2-3,6-7'/> in the xml file under <cputune> and removing "isolcpus" from my kernel parameters to set cpu affinity<br></li><li>Using "iommu=pt"<br></li><li>Using "nohz=off"</li></ul></div></div></div></div></blockquote><div><br></div><div>Pinning the emulator to the same CPUs you're using for the vCPUs seems like a bad idea.  As I pointed out in my latency post last week, I got the best latency by pinning the emulator to the opposite thread of the CPU from the vCPU.  The "iommu=pt" option only affects the DMA performance of host devices.  The "nohz_full=" option seems to be missing from your list of things to try.  It also doesn't seem like you're using hugepages.</div><div><br></div><div>I run tests where assigning threads to a VM degrades performance versus isolating the thread and reducing the number of vCPUs in the guest.  More vCPUs is not always the answer.  Thanks,</div><div><br></div><div>Alex</div></div></div></div>