Bug 1170495

Summary: ignore emulatorpin when vcpu placement is auto
Product: Red Hat Enterprise Linux 6 Reporter: Jincheng Miao <jmiao>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.6CC: dyuan, honzhang, libvirt-maint, mzhan, rbalakri, virt-bugs
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.10.2-49.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1170492 Environment:
Last Closed: 2015-07-22 05:48:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1170484, 1170492    
Bug Blocks:    

Description Jincheng Miao 2014-12-04 07:17:48 UTC
+++ This bug was initially created as a clone of Bug #1170492 +++

Description of problem:
vcpu placement is default to numatune placement or "static" if cpuset is specified.
So if user edit domain xml as:
  <vcpu placement='static' current='2'>6</vcpu>
  <numatune>
    <memory mode='strict' placement='auto'/>
  </numatune>

libvirt will turn vcpu placement to 'auto', like:
  <vcpu placement='auto' current='2'>6</vcpu>
  <numatune>
    <memory mode='strict' placement='auto'/>
  </numatune>

But this tuning will break the rule of emulatorpin is not allowed if attribute placement of element vcpu is "auto".

In other word, emulatorpin could be set when vcpu placement is 'static', and numatune memory placement is 'auto':
  <vcpu placement='auto' current='2'>6</vcpu>
  <cputune>
    <emulatorpin cpuset='1-3'/>
  </cputune>
  <numatune>
    <memory mode='strict' placement='auto'/>
  </numatune>



Version-Release number of selected component (if applicable):
libvirt-1.2.8-9.el7.x86_64
qemu-kvm-rhev-2.1.2-13.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. edit domain xml
# virsh edit r7a
...
  <vcpu placement='static' current='2'>6</vcpu>
  <cputune>
    <emulatorpin cpuset='1-3'/>
  </cputune>
  <numatune>
    <memory mode='strict' placement='auto'/>
  </numatune>

...

# virsh dumpxml r7a
...
  <vcpu placement='auto' current='2'>6</vcpu>
  <cputune>
    <emulatorpin cpuset='1-3'/>
  </cputune>
  <numatune>
    <memory mode='strict' placement='auto'/>
  </numatune>
...

2. start guest
# virsh start r7a

3. check via emulatorpin
# virsh emulatorpin r7a
emulator: CPU Affinity
----------------------------------
       *: 1-3

4. check via cgroup
# cat /sys/fs/cgroup/cpuset/machine.slice/machine-qemu\\x2dr7a.scope/emulator/cpuset.cpus
0-7


Expect result:
Either report error for specifying emulatorpin when vcpu placement is auto,
or ignoring emulatorpin configuration.

--- Additional comment from Jincheng Miao on 2014-12-04 02:06:05 EST ---

This problem is also existing for iothreadpin of cputune.

And It's also existed in RHEL6, I will clone it to RHEL6.

In RHEL6 libvirt-0.10.2-46.el6.x86_64:
# virsh edit r6
...
  <vcpu placement='static' current='2'>4</vcpu>
  <cputune>
    <emulatorpin cpuset='1-3'/>
  </cputune>
  <numatune>
    <memory mode='strict' placement='auto'/>
  </numatune>
...

# virsh emulatorpin r6
emulator: CPU Affinity
----------------------------------
       *: 1-3

# cat /cgroup/cpuset/libvirt/qemu/r6/emulator/cpuset.cpus 0-7

Comment 3 Jincheng Miao 2015-02-27 06:43:40 UTC
This problem could be reproduced in libvirt-0.10.2-48.el6.x86_64:

1. define a guest with static vcpu placement and auto memory placement, and with emulatorpin
# virsh edit rhel
  <vcpu placement='static' current='2'>5</vcpu>
  <cputune>
    <emulatorpin cpuset='1-3'/>
  </cputune>
  <numatune>
    <memory mode='strict' placement='auto'/>
  </numatune>

2. then domain xml transfers into auto vcpu placement
# virsh dumpxml rhel
  <vcpu placement='auto' current='2'>5</vcpu>
  <cputune>
    <emulatorpin cpuset='1-3'/>
  </cputune>
  <numatune>
    <memory mode='strict' placement='auto'/>
  </numatune>


But in latest libvirt-0.10.2-49.el6.x86_64:
1. 
# virsh edit rhel
  <vcpu placement='static' current='2'>5</vcpu>
  <cputune>
    <emulatorpin cpuset='1-3'/>
  </cputune>
  <numatune>
    <memory mode='strict' placement='auto'/>
  </numatune>

2. 
# virsh dumpxml rhel
  <vcpu placement='static' current='2'>5</vcpu>
  <cputune>
    <emulatorpin cpuset='1-3'/>
  </cputune>
  <numatune>
    <memory mode='strict' placement='auto'/>
  </numatune>

3. check emulatorpinning
# virsh emulatorpin rhelemulator: CPU Affinity
----------------------------------
       *: 1-3


# cat /cgroup/cpuset/libvirt/qemu/rhel/emulator/cpuset.cpus 
1-3

So this problem is fixed, and I will change the status to VERIFIED.

Comment 6 errata-xmlrpc 2015-07-22 05:48:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1252.html