Bug 1227180

Summary: "virsh emulatorpin <domain>" doesn't get the updated cpulist after the cpulist changes to "0-7" from "0-6"(on a host with cpu number is multiple of 8).
Product: Red Hat Enterprise Linux 7 Reporter: Fangge Jin <fjin>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.2CC: dyuan, lhuang, mzhan, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.17-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 06:39:40 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:

Description Fangge Jin 2015-06-02 05:29:19 UTC
Description:
 "virsh emulatorpin <domain>" doesn't get the updated cpulist after the cpulist changes to "0-7" from "0-6". This only happens on the host whose cpu number is multiple of 8.

Version:
libvirt-1.2.15-2.el7.x86_64
qemu-kvm-rhev-2.3.0-1.el7.x86_64
kernel-3.10.0-247.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
0. # virsh nodecpumap
CPUs present:   8
CPUs online:    8
CPU map:        yyyyyyyy

1.
# virsh edit r71
...
   <vcpu placement='static' cpuset='0-6'>1</vcpu>
...

2.Start guest r71.
# virsh emulatorpin rhel7.0
emulator: CPU Affinity
----------------------------------
       *: 0-6

3.
# virsh emulatorpin rhel7.0 --cpulist 0-7
# echo $?
0
4.
# virsh emulatorpin rhel7.0
emulator: CPU Affinity
----------------------------------
       *: 0-6
5.# cgget -g cpuset /machine.slice/machine-qemu\\x2drhel7.0.scope/emulator
/machine.slice/machine-qemu\x2drhel7.0.scope/emulator:
cpuset.memory_spread_slab: 0
cpuset.memory_spread_page: 0
cpuset.memory_pressure: 0
cpuset.memory_migrate: 1
cpuset.sched_relax_domain_level: -1
cpuset.sched_load_balance: 1
cpuset.mem_hardwall: 0
cpuset.mem_exclusive: 0
cpuset.cpu_exclusive: 0
cpuset.mems: 0
cpuset.cpus: 0-7


Actual results:
In step4, "virsh emulatorpin rhel7.0" doesn't get the updated cpulist after the cpulist changes to "0-7" from "0-6".

Expected results:
In step4, "virsh emulatorpin rhel7.0" can get the updated cpulist "0-7".

Comment 2 Peter Krempa 2015-06-15 14:31:07 UTC
Fixed upstream:
commit 4ed2b9a7e4bf2109b3711e493e6c4559d7227885
Author: Peter Krempa <pkrempa>
Date:   Fri Jun 12 15:53:05 2015 +0200

    qemu: emulatorpin: Don't reset pinning when pinning to all cpus
    
    Similarly to a02a161bb8a6caf0db4dd446ed1cdf53d97b40 remove the default
    pinning assumption from emulatorpin.

v1.2.16-154-g4ed2b9a

Comment 4 Luyao Huang 2015-08-05 09:05:01 UTC
i can reproduce this issue with libvirt-1.2.15-2.el7.x86_64:

1.

# virsh nodecpumap
CPUs present:   32
CPUs online:    32
CPU map:        yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

2. set cpuset like this in xml:

  <vcpu placement='static' cpuset='0-30'>4</vcpu>

3. start guest and check emulatorpin:

# virsh emulatorpin rhel7.0-rhel
emulator: CPU Affinity
----------------------------------
       *: 0-30

# virsh emulatorpin rhel7.0-rhel 0-31

# virsh emulatorpin rhel7.0-rhel
emulator: CPU Affinity
----------------------------------
       *: 0-30

4. cannot find emulatorpin in xml

And verify this bug with libvirt-1.2.17-3.el7.x86_64:


1.

# virsh nodecpumap
CPUs present:   32
CPUs online:    32
CPU map:        yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy


2. set cpuset like this in xml:

  <vcpu placement='static' cpuset='0-30'>4</vcpu>

3. start guest and check emulatorpin:

# virsh emulatorpin rhel7.0-rhel
emulator: CPU Affinity
----------------------------------
       *: 0-30

4. bind emulator to all cpu:
# virsh emulatorpin rhel7.0-rhel 0-31

5.
# virsh emulatorpin rhel7.0-rhel
emulator: CPU Affinity
----------------------------------
       *: 0-31

6. recheck the xml:
  <cputune>
    <emulatorpin cpuset='0-31'/>
  </cputune>

Comment 6 errata-xmlrpc 2015-11-19 06:39:40 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-2202.html