Bug 828729

Summary: CPU topology parsing bug on special NUMA platform
Product: Red Hat Enterprise Linux 6 Reporter: Osier Yang <jyang>
Component: libvirtAssignee: Osier Yang <jyang>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 6.4CC: acathrow, dallan, dyasny, dyuan, gsun, mzhan, rwu, zhwang
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.9.13-2.el6 Doc Type: Bug Fix
Doc Text:
Cause: Libvirt has problem of parsing the CPU topology on special platform (E.g. AMD Magny Cours). Consequence: The wrong CPU topology parsing could cause various problems: 1) Performance lost Domain process and domain vCPU threads can only be pinned to part of the physical CPUs. 2) Domain might be not able to start If a domain uses vcpu "auto" placement, and the advisory nodeset returned from numad contains node which exceeds the range of wrong total CPU number. The domain will fail to start. 3) Wrong CPU number affects lots of stuffs. E.g. For command "virsh vcpuinfo", "virsh vcpupin", etc. It will always output with the truncated CPU list. Fix: Parse the "cpu cores" in /proc/cpuinfo to get the correct CPU number. Result: All stuffs related with the CPU topology work again on the special platform.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 07:16:29 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:
Bug Depends On:    
Bug Blocks: 836919    

Description Osier Yang 2012-06-05 09:26:32 UTC
Description of problem:

On some special NUMA platform, the CPU topology is orgnized in an unusual
way, and we don't consider it in when parsing it in libvirt, such as for
AMD Magny Cours, 

  "Instead of developing one CPU with 12 cores, the Magny Cours is
actually two 6 core “Bulldozer” CPUs combined in to one package"
    
I.e, each package has two NUMA nodes, and the two numa nodes share
the same core ID set (0-6), which means parsing the cores number
from sysfs doesn't work in this case.
    
And the wrong CPU number could cause three problems for libvirt:
    
  1) performance lost
    
    A domain without "cpuset" or "placement='auto'" (to drive numad)
  specified will be only pinned to part of the CPUs.
    
  2) domain can be started
    
    If a domain uses numad, and the advisory nodeset returned from
  numad contains node which exceeds the range of wrong total CPU
  number. The domain will fail to start, as the bitmask passed to
  sched_setaffinity could be fully filled with zero.
    
  3) wrong CPU number affects lots of stuffs.
    
    E.g. for command "virsh vcpuinfo", "virsh vcpupin", it will always
  output with the truncated CPU list.

  For more details:
    
  https://www.redhat.com/archives/libvir-list/2012-May/msg00607.html

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Osier Yang 2012-06-05 09:30:30 UTC
The problem is already resolved by upstream commit 10d9038b7, but it should be included in z-stream for 6.3.

Comment 4 Wayne Sun 2012-06-27 06:14:37 UTC
pkgs:
# rpm -q libvirt
libvirt-0.9.10-21.el6.x86_64

# cat /proc/cpuinfo |grep "model name"|tail -1
model name	: AMD Opteron(tm) Processor 6172

steps:
# virsh nodeinfo
Please enter your authentication name: vdsm@rhevh
Please enter your password: 
CPU model:           x86_64
CPU(s):              48
CPU frequency:       2100 MHz
CPU socket(s):       4
Core(s) per socket:  6
Thread(s) per core:  1
NUMA cell(s):        1
Memory size:         529297552 kB

# cat /proc/cpuinfo |grep processor |wc -l
48

# cat /proc/cpuinfo |grep "cpu cores"|tail -1
cpu cores	: 12

The cpu cores from cpuinfo is 12, the nodeifo output is 6.

Comment 5 Osier Yang 2012-06-27 14:17:15 UTC
(In reply to comment #4)
> pkgs:
> # rpm -q libvirt
> libvirt-0.9.10-21.el6.x86_64
> 
> # cat /proc/cpuinfo |grep "model name"|tail -1
> model name	: AMD Opteron(tm) Processor 6172
> 
> steps:
> # virsh nodeinfo
> Please enter your authentication name: vdsm@rhevh
> Please enter your password: 
> CPU model:           x86_64
> CPU(s):              48
> CPU frequency:       2100 MHz
> CPU socket(s):       4
> Core(s) per socket:  6
> Thread(s) per core:  1
> NUMA cell(s):        1
> Memory size:         529297552 kB
> 
> # cat /proc/cpuinfo |grep processor |wc -l
> 48
> 
> # cat /proc/cpuinfo |grep "cpu cores"|tail -1
> cpu cores	: 12
> 
> The cpu cores from cpuinfo is 12, the nodeifo output is 6.

The fix is not in 6.3 yet. Will come with the 6.3.z soon, perhaps next week.

Comment 8 Wayne Sun 2012-07-05 04:39:31 UTC
# rpm -q libvirt
libvirt-0.9.13-2.el6.x86_64

# cat /proc/cpuinfo |grep "model name"|tail -1
model name	: AMD Opteron(tm) Processor 6172

steps:
# virsh nodeinfo
CPU model:           x86_64
CPU(s):              48
CPU frequency:       2100 MHz
CPU socket(s):       4
Core(s) per socket:  12
Thread(s) per core:  1
NUMA cell(s):        1
Memory size:         529263760 KiB

# cat /proc/cpuinfo |grep processor |wc -l
48

# cat /proc/cpuinfo |grep "cpu cores"|tail -1
cpu cores	: 12

The cpu cores from cpuinfo is 12, the nodeifo output is also 12.

Comment 9 zhenfeng wang 2012-08-31 07:20:22 UTC
# rpm -q libvirt
libvirt-0.10.0-1.el6.x86_64

# cat /proc/cpuinfo |grep "model name"|tail -1
model name	: AMD Opteron(tm) Processor 6172

# virsh nodeinfo
CPU model:           x86_64
CPU(s):              48
CPU frequency:       2100 MHz
CPU socket(s):       1
Core(s) per socket:  6
Thread(s) per core:  1
NUMA cell(s):        8
Memory size:         529263712 KiB

# cat /proc/cpuinfo |grep processor |wc -l
48

# cat /proc/cpuinfo |grep "cpu cores"|tail -1
cpu cores	: 12

The cpu cores from cpuinfo is 12, the nodeifo output is 6 ,the NUMA cells is 8

Comment 10 errata-xmlrpc 2013-02-21 07:16:29 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