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 1618688 - pidstat shows wrong CPU for pinned threads
Summary: pidstat shows wrong CPU for pinned threads
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: sysstat
Version: 7.5
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Michal Sekletar
QA Contact: Radka Brychtova
URL:
Whiteboard:
Depends On:
Blocks: 1630908 1630917 1643104
TreeView+ depends on / blocked
 
Reported: 2018-08-17 10:42 UTC by Julio Entrena Perez
Modified: 2019-08-06 13:16 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-08-06 13:16:08 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:2299 0 None None None 2019-08-06 13:16:15 UTC

Description Julio Entrena Perez 2018-08-17 10:42:50 UTC
Description of problem:
pidstat reports the wrong CPU for a pinned qemu-kvm thread

Version-Release number of selected component (if applicable):
sysstat-10.1.5-13.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Create a virtual machine and pin a VCPU thread to a CPU.
2. Run a CPU intensive workload in the VM (e.g. "openssl speed")
3.

Actual results:
pidstat reports the wrong CPU for the pinned VCPU qemu-kvm thread

Expected results:
pidstat reports the correct CPU for the pinned VCPU qemu-kvm thread

Additional info:

Example: a single VCPU VM has its VCPU pinned to CPU 0 in the host using
- "0#1" for RHV CPU pinning topology 
or
- libvirt:
  <cputune>
    <vcpupin vcpu='0' cpuset='1'/>
  </cputune>

# virsh -r vcpuinfo rhel7a
VCPU:           0
CPU:            1
State:          running
CPU time:       289.8s
CPU Affinity:   -y

# virsh -r vcpupin rhel7a
VCPU: CPU Affinity
----------------------------------
   0: 1
   1: 0-1
   2: 0-1
   3: 0-1

Running "top -H" and adding the P (processor) column shows that the VCPU thread is running in physical CPU 1:

top - 16:11:31 up 16 days, 21:39,  1 user,  load average: 1.08, 0.75, 0.39
Threads: 359 total,   3 running, 356 sleeping,   0 stopped,   0 zombie
%Cpu(s): 50.2 us,  0.2 sy,  0.0 ni, 49.6 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  7881488 total,  1840740 free,  1300100 used,  4740648 buff/cache
KiB Swap:  1023996 total,  1023996 free,        0 used.  6201844 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ P COMMAND                                                                                                        
19762 qemu      20   0 2796560 835020  13424 R 99.3 10.6   6:29.88 1 CPU 0/KVM
 1833 root      20   0 1546680  45292  11412 S  0.3  0.6  29:46.39 0 python                   

Taskset confirms this thread is bound to CPU 1:

# taskset -p 19762
pid 19762's current affinity mask: 2

But pidstat insists on reporting the VCPU thread as running on CPU 0:

# pidstat -ut -p 19753
Linux 3.10.0-693.21.1.el7.x86_64 (rhevh3-375.usersys.redhat.com) 	13/08/18 	_x86_64_	(2 CPU)

16:06:18      UID      TGID       TID    %usr %system  %guest    %CPU   CPU  Command
16:06:18      107     19753         -  100.00    0.00  100.00    0.01     0  qemu-kvm
16:06:18      107         -     19753    0.00    0.00    0.00    0.00     0  |__qemu-kvm
16:06:18      107         -     19757    0.00    0.00    0.00    0.00     0  |__qemu-kvm
16:06:18      107         -     19758    0.00    0.00    0.00    0.00     0  |__IO
16:06:18      107         -     19762    0.00    0.00    0.00    0.00     0  |__CPU
16:06:18      107         -     19765    0.00    0.00    0.00    0.00     0  |__SPICE
16:06:18      107         -     21882    0.00    0.00    0.00    0.00     0  |__worker

Comment 9 errata-xmlrpc 2019-08-06 13:16:08 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://access.redhat.com/errata/RHBA-2019:2299


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