[vfio-users] CPU pinning with cgroups

Alex Williamson alex.l.williamson at gmail.com
Mon Sep 7 20:19:40 UTC 2015


On Sun, Sep 6, 2015 at 7:19 PM, Garrett Powell <garretttracypowell at gmail.com
> wrote:

> I've been having trouble with my guest freezing up, which I'm told is due
> to a lack of CPU pinning. I'm currently trying to set up CPU pinning with
> cgroups (specifically cpuset), but the freezing isn't going away. Could
> anyone tell me what I'm doing wrong? I'm specifically referring to the
> *cgcreate*, *cgset *and* cgexec* lines. Here's my launch script:
>
> #!/bin/bash
>
> export QEMU_AUDIO_DRV=pa
> export QEMU_PA_SERVER=localhost
> export PULSE_SERVER=localhost
>
> vfio-bind 0000:06:00.0
>
> synergys --daemon --config /etc/synergy.conf
>
> for i in {0..3}; do
>     echo performance >
> /sys/devices/system/cpu/cpu${i}/cpufreq/scaling_governor
> done
>
> echo 5120 > /proc/sys/vm/nr_hugepages
>
> cgcreate -g cpuset:kvm
> cgset -r cpuset.cpus=0-3 -r cpuset.mems=0 -r cpuset.cpu_exclusive=1 kvm
> cgexec -g cpuset:kvm qemu-system-x86_64 \
>

Ok, so you've change to pCPUs 0-3 instead of 4-7, but doesn't this have the
same problem as your previous attempt with taskset?  You're using a
different tool, but afaict you're still not doing 1:1 pinning of vCPUs,
you're pining them to a set of pCPUs.  Taskset can work, but you need to
get the thread ID for each vCPU thread and pin it.  The problem is not the
tool you're using but how you're using it, to set the entire process and
all the threads it will launch to a range of CPUs rather than pulling out
the vCPU threads and individually pinning them.  There's this really great
tool that already does this, it's called libvirt.  Thanks,

Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/vfio-users/attachments/20150907/ae30a185/attachment.htm>


More information about the vfio-users mailing list