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 1249981 - iothreadpin will pin one of libvirtd thread with qemu 1.5
Summary: iothreadpin will pin one of libvirtd thread with qemu 1.5
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: Virtualization Bugs
URL:
Whiteboard:
: 1272349 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-04 09:56 UTC by Luyao Huang
Modified: 2016-11-03 18:22 UTC (History)
5 users (show)

Fixed In Version: libvirt-1.3.1-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:22:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description Luyao Huang 2015-08-04 09:56:32 UTC
Description of problem:
iothreadpin will pin one of libvirtd thread with qemu 1.5

Version-Release number of selected component (if applicable):
qemu-kvm-1.5.3-97.el7.x86_64
libvirt-1.2.17-3.el7.x86_64

How reproducible:
100%

Steps to Reproduce:

1. prepare a guest with iothreadpin:

# virsh dumpxml test4 |grep iothread
  <iothreads>1</iothreads>
  <iothreadids>
    <iothread id='1'/>
  </iothreadids>
    <iothreadpin iothread='1' cpuset='2'/>


2. start it and check libvirt set in cgroup

# ll /proc/9580/task/
total 0
dr-xr-xr-x. 6 qemu qemu 0 Jul 27 10:31 9580    <----emulator
dr-xr-xr-x. 6 qemu qemu 0 Jul 27 10:32 9589    <----vcpu0
dr-xr-xr-x. 6 qemu qemu 0 Jul 27 10:32 9591    <----vcpu1
dr-xr-xr-x. 6 qemu qemu 0 Jul 27 10:32 9600    <----???

# cat /sys/fs/cgroup/cpuset/machine.slice/machine-qemu\\x2dtest4.scope/iothread1/cpuset.cpus
2

# cat /sys/fs/cgroup/cpuset/machine.slice/machine-qemu\\x2dtest4.scope/iothread1/tasks 
4402

# ps -eLf |grep 4402
root      4391     1  4402  0   16 10:28 ?        00:00:00 /usr/sbin/libvirtd
root     16347 19012 16347  0    1 11:15 pts/0    00:00:00 grep --color=auto 4402

3. check taskset
# taskset --cpu-list -p 4402
pid 4402's current affinity list: 2


4. Then try to change the iothreadpin and recheck the result:

# virsh iothreadpin test4 1 3 

# taskset --cpu-list -p 4402
pid 4402's current affinity list: 3

# cat /sys/fs/cgroup/cpuset/machine.slice/machine-qemu\\x2dtest4.scope/iothread1/cpuset.cpus
3


Actual results:
iothreadpin will pin one of libvirtd thread with qemu 1.5

Expected results:
forbid use iotreadpin with qemu which not support iothread

Additional info:

This is because we cannot get iothread_id and it's value is 0, and then we call
sched_setaffinity() and attach thread in cgroup, but when the pid/task is 0, these functions will attach the current thread, you can check kernel doc Documentation/cgroups/cgroups.txt:

You can attach the current shell task by echoing 0:

# echo 0 > tasks

and manual of sched_setaffinity(2):

Specifying pid as 0 will set the attribute for the calling thread

So i think we should also forbid set 0 as a pid when call these functions.

Comment 1 John Ferlan 2015-10-15 21:30:36 UTC
Posted some patches upstream...

v1: http://www.redhat.com/archives/libvir-list/2015-October/msg00417.html
(patches 1 & 2)

v2:  http://www.redhat.com/archives/libvir-list/2015-October/msg00550.html
(patches 1 -> 3)

Comment 2 John Ferlan 2015-10-16 11:10:38 UTC
Patches pushed upstream

$ git describe cc2d49f9be13e439efcdbd4e1c161750f4208995
v1.2.20-112-gcc2d49f
$

Comment 3 John Ferlan 2015-12-02 20:58:59 UTC
*** Bug 1272349 has been marked as a duplicate of this bug. ***

Comment 5 Luyao Huang 2016-08-11 02:36:48 UTC
Verify this bug with qemu-kvm-1.5.3-121.el7.x86_64 and libvirt-2.0.0-5.el7.x86_64:

1. try to start a guest with iothread:

# virsh dumpxml r7-old
<domain type='kvm'>
  <name>r7-old</name>
  <uuid>5b256268-87b9-40bf-a857-38715dd8a37b</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='auto' current='6'>10</vcpu>
  <iothreads>1</iothreads>

# virsh start r7-old
error: Failed to start domain r7-old
error: unsupported configuration: IOThreads not supported for this QEMU

2. try to attach iothread to a exist guest:

# virsh list
 Id    Name                           State
----------------------------------------------------
 12    r7-old                         running

# virsh iothreadinfo r7-old
error: Unable to get domain IOThreads information
error: unsupported configuration: IOThreads not supported with this binary

# virsh iothreadadd r7-old 1
error: unsupported configuration: IOThreads not supported with this binary

# virsh iothreaddel r7-old 1
error: unsupported configuration: IOThreads not supported with this binary

Comment 7 errata-xmlrpc 2016-11-03 18:22:13 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/RHSA-2016-2577.html


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