RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 871312 - emulatorpin affinity isn't the same as Cpus_allowed_list of emulator ' thread when cpuset is specified
Summary: emulatorpin affinity isn't the same as Cpus_allowed_list of emulator ' thread...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.4
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Martin Kletzander
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-30 08:24 UTC by hongming
Modified: 2013-02-21 07:11 UTC (History)
8 users (show)

Fixed In Version: libvirt-0.10.2-7.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-02-21 07:11:19 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2013:0276 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2013-02-20 21:18:26 UTC

Description hongming 2012-10-30 08:24:46 UTC
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 14:57:00 UTC
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-31 01:02:21 UTC
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 15:07:43 UTC
OK, that makes sense, I sent a fix upstream and I'm waiting for ACK.

Comment 7 hongming 2012-11-06 03:35:56 UTC
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 07:11:19 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.

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.