Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 871312 - emulatorpin affinity isn't the same as Cpus_allowed_list of emulator ' thread when cpuset is specified
emulatorpin affinity isn't the same as Cpus_allowed_list of emulator ' thread...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
6.4
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Martin Kletzander
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-30 04:24 EDT by hongming
Modified: 2013-02-21 02:11 EST (History)
8 users (show)

See Also:
Fixed In Version: libvirt-0.10.2-7.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-21 02:11:19 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2013:0276 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2013-02-20 16:18:26 EST

  None (edit)
Description hongming 2012-10-30 04:24:46 EDT
Description of problem:
The emulatorpin affinity isn't the same as Cpus_allowed_list of emulator'thread when cpuset is specified and domain'xml don't includes emulatorpin element.


Version-Release number of selected component (if applicable):
libvirt-0.10.2-6.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
# virsh start rhel6.3
Domain rhel6.3 started

# virsh dumpxml rhel6.3|grep cpu
  <vcpu placement='static' cpuset='1-2' current='1'>4</vcpu>

# virsh dumpxml rhel6.3|grep emulatorpin

# pidof qemu-kvm
27909

# cat /proc/27909/task/27909/status |grep Cpus_allowed_list
Cpus_allowed_list:	1-2

# virsh emulatorpin rhel6.3
emulator: CPU Affinity
----------------------------------
       *: 0-3

  
Actual results:
The emulatorpin affinity isn't the same as Cpus_allowed_list of emulator'thread when cpuset is specified and domain'xml don't includes emulatorpin element.

Expected results:
emulatorpin command return correct emulatorpin affinity.

Additional info:
Comment 2 Martin Kletzander 2012-10-30 10:57:00 EDT
I'm sorry I cannot reproduce that, look:

# cat demo.xml 
<domain type='kvm'>
  <name>demo</name>
  <memory>32768</memory>
  <vcpu placement='static' cpuset='1-2' current='1'>4</vcpu>
  <os>
    <type arch='x86_64'>hvm</type>
  </os>
  <clock offset="utc"/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>destroy</on_reboot>
  <on_crash>destroy</on_crash>
</domain>
# virsh create demo.xml 
Domain demo created from demo.xml

# pidof qemu-kvm
19490
# grep Cpus_allowed_list /proc/19490/task/*/status
/proc/19490/task/19490/status:Cpus_allowed_list:	1-2
/proc/19490/task/19492/status:Cpus_allowed_list:	1-2
# rpm -q libvirt
libvirt-0.10.2-6.el6.x86_64

Could you paste the whole XML, check if you have cgroups mounted and check what cpus have the tasks assigned in them?  Thanks
Comment 3 hongming 2012-10-30 21:02:21 EDT
The point is the last step as follows.  What's the result in your test ?

# virsh emulatorpin rhel6.3
emulator: CPU Affinity
----------------------------------
       *: 0-3

emulatorpin should return the Cpus_allowed_list of qemu'main thread.  The expected result should be the same as Cpus_allowed_list. 
--------------------------------------------------------------------------------

# ll /cgroup/cpu/libvirt/qemu/rhel6.3/
total 0
--w--w--w- 1 root root 0 Oct 31 08:52 cgroup.event_control
-rw-r--r-- 1 root root 0 Oct 31 08:52 cgroup.procs
-rw-r--r-- 1 root root 0 Oct 31 08:52 cpu.cfs_period_us
-rw-r--r-- 1 root root 0 Oct 31 08:52 cpu.cfs_quota_us
-rw-r--r-- 1 root root 0 Oct 31 08:52 cpu.rt_period_us
-rw-r--r-- 1 root root 0 Oct 31 08:52 cpu.rt_runtime_us
-rw-r--r-- 1 root root 0 Oct 31 08:52 cpu.shares
-r--r--r-- 1 root root 0 Oct 31 08:52 cpu.stat
drwxr-xr-x 2 root root 0 Oct 31 08:52 emulator
-rw-r--r-- 1 root root 0 Oct 31 08:52 notify_on_release
-rw-r--r-- 1 root root 0 Oct 31 08:52 tasks
drwxr-xr-x 2 root root 0 Oct 31 08:52 vcpu0

# virsh dumpxml rhel6.3
<domain type='kvm' id='2'>
  <name>rhel6.3</name>
  <uuid>9669ae9b-4996-b7e7-5648-53a6df93d5aa</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static' cpuset='0-2' current='1'>4</vcpu>
  <os>
    <type arch='x86_64' machine='rhel6.4.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic eoi='on'/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/var/lib/libvirt/images/kvm-rhel6.3-x86_64.img'/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:c5:20:41'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/2'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/2'>
      <source path='/dev/pts/2'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='spice' port='5900' autoport='yes' listen='0.0.0.0' keymap='fdshjlf78970'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <sound model='ich6'>
      <alias name='sound0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='none'/>
</domain>
Comment 4 Martin Kletzander 2012-10-31 11:07:43 EDT
OK, that makes sense, I sent a fix upstream and I'm waiting for ACK.
Comment 7 hongming 2012-11-05 22:35:56 EST
Verify it as follows. The result is expected. Move its status to VERIFIED.

# rpm -q libvirt
libvirt-0.10.2-7.el6.x86_64

# virsh start rhel6.3
Domain rhel6.3 started

# virsh dumpxml rhel6.3 |grep vcpu
  <vcpu placement='static' cpuset='2-3' current='1'>7</vcpu>

# virsh emulatorpin rhel6.3
emulator: CPU Affinity
----------------------------------
       *: 2-3


# pidof qemu-kvm
30119

# grep Cpus_allowed_list /proc/30119/task/*/status
/proc/30119/task/30119/status:Cpus_allowed_list:	2-3
/proc/30119/task/30141/status:Cpus_allowed_list:	2-3
/proc/30119/task/30142/status:Cpus_allowed_list:	2-3
Comment 8 errata-xmlrpc 2013-02-21 02:11:19 EST
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.

http://rhn.redhat.com/errata/RHSA-2013-0276.html

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