Bug 1386513 - Using emulatorpin sets machine.slice/cpuset.cpus incorrectly
Summary: Using emulatorpin sets machine.slice/cpuset.cpus incorrectly
Keywords:
Status: NEW
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-19 07:11 UTC by rokupstys
Modified: 2018-07-18 15:03 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:


Attachments (Terms of Use)

Description rokupstys 2016-10-19 07:11:31 UTC
Description of problem:

/sys/fs/cgroup/cpuset/machine.slice/cpuset.cpus on machine.slice creation is always set to cores that emulator is pinned to via <emulatorpin>. This results in following error on VM startup: Unable to write to '/sys/fs/cgroup/cpuset/machine.slice/machine-qemu\x2d2\x2dwin.scope/vcpu0/cpuset.cpus': Permission denied


Compiled against library: libvirt 2.3.0
Using library: libvirt 2.3.0
Using API: QEMU 2.3.0
Running hypervisor: QEMU 2.7.0


Always reproducible.


Steps to Reproduce:
1. Create VM with cpu setup:
  <vcpu placement='static'>4</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='2'/>
    <vcpupin vcpu='1' cpuset='3'/>
    <vcpupin vcpu='2' cpuset='4'/>
    <vcpupin vcpu='3' cpuset='5'/>
    <emulatorpin cpuset='0-1'/>
  </cputune>
  <cpu mode='host-passthrough'>
    <topology sockets='1' cores='4' threads='1'/>
  </cpu>
2. Start VM via virsh or virt-manager.

Actual results:
Error: Unable to write to '/sys/fs/cgroup/cpuset/machine.slice/machine-qemu\x2d2\x2dwin.scope/vcpu0/cpuset.cpus': Permission denied
~ % cat /sys/fs/cgroup/cpuset/machine.slice/cpuset.cpus
0-1

Expected results:
No error, VM should start.
~ % cat /sys/fs/cgroup/cpuset/machine.slice/cpuset.cpus
0-5

Additional info:
As a workaround i added following line to /etc/libvirt/hooks/qemu script:
echo 0-5 > /sys/fs/cgroup/cpuset/machine.slice/cpuset.cpus

With this workaround VM always fails starting the first time but starts properly the second time.


Note You need to log in before you can comment on or make changes to this bug.