Bug 1329819

Summary: virsh nodecpumap --pretty shows wrong result on machine with many cores
Product: Red Hat Enterprise Linux 7 Reporter: Hao Liu <hliu>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: dyuan, hliu, jishao, lhuang, mzhan, pkrempa, rbalakri
Target Milestone: pre-dev-freeze   
Target Release: 7.3   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.3.4-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 18:43:44 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 Hao Liu 2016-04-23 13:55:43 UTC
Description of problem:
virsh nodecpumap --pretty shows wrong result on machine with many cores

Version-Release number of selected component (if applicable):
libvirt-1.3.3-2.el7.x86_64

How reproducible:


Steps to Reproduce:
On a machine with many CPU cores exists.

# virsh nodecpumap --pretty
CPUs present:   120
CPUs online:    120
CPU map:        0-119,192,196,199,258,262,264,267,269-270,272-273,276-278,284-286,290-291,293-294,296,301-302,304,307-310,314,316,318,320,322,325-326,331-334,338,340-342,802-803,805,807-809,813-814,816-818,821-822,825,828-829,831,833,836


Expected results:
CPU map:        0-119

Additional info:
In tools/virsh-host.c: cmdNodeCpuMap
        char *str = virBitmapDataToString(cpumap, cpunum);
The second argument cpunum is in bit, but virBitmapDataToString requires
len in bytes.

Comment 2 Peter Krempa 2016-04-25 11:33:49 UTC
Fixed upstream:

commit 3a703b8120d9f996840bd315b6f74c45a7e98aad
Author: Peter Krempa <pkrempa>
Date:   Mon Apr 25 10:38:01 2016 +0200

    virsh: host: Use bitmap size in bytes rather than bit count

Comment 4 Jingjing Shao 2016-08-20 02:20:56 UTC
verify this bug as below

# rpm -q libvirt
libvirt-2.0.0-4.el7.x86_64

# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                240
On-line CPU(s) list:   0-239
Thread(s) per core:    2
Core(s) per socket:    15
Socket(s):             8
NUMA node(s):          8
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 62
Model name:            Intel(R) Xeon(R) CPU E7-2890 v2 @ 2.80GHz
Stepping:              7
CPU MHz:               1237.687
BogoMIPS:              5600.56
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              38400K
NUMA node0 CPU(s):     0-14,120-134
NUMA node1 CPU(s):     15-29,135-149
NUMA node2 CPU(s):     30-44,150-164
NUMA node3 CPU(s):     45-59,165-179
NUMA node4 CPU(s):     60-74,180-194
NUMA node5 CPU(s):     75-89,195-209
NUMA node6 CPU(s):     90-104,210-224
NUMA node7 CPU(s):     105-119,225-239

# virsh nodecpumap --pretty
CPUs present:   240
CPUs online:    240
CPU map:        0-239

The result is as expected. so I change the status to verified

Comment 6 errata-xmlrpc 2016-11-03 18:43:44 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