Bug 1221047 - 'virsh numatune DomName' shows incorrect numatune node set
Summary: 'virsh numatune DomName' shows incorrect numatune node set
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: ppc64le
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Martin Kletzander
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-05-13 08:31 UTC by Gu Nini
Modified: 2015-11-19 06:31 UTC (History)
11 users (show)

Fixed In Version: libvirt-1.2.16-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:31:04 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Gu Nini 2015-05-13 08:31:51 UTC
Description of problem:
Use cmd 'virsh numatune DomName' to check the numatune host node set , it shows an incorrect one, which is the whole host numa nodes available

Version-Release number of selected component (if applicable):
Host kernel: 3.10.0-244.ael7b.ppc64le
qemu-kvm-rhev: qemu-kvm-rhev-2.3.0-1.ael7b.ppc64le
libvirt: libvirt-1.2.15-1.ael7b.ppc64le

How reproducible:
100%

Steps to Reproduce:
1. Define ans start a guest in virsh with 'numatune'
......
  <memory unit='KiB'>2048000</memory>
  <currentMemory unit='KiB'>2048000</currentMemory>
  <vcpu placement='static'>2</vcpu>

  <numatune>
    <memory mode='strict' nodeset='0-1'/>
    <memnode cellid='0' mode='strict' nodeset='0'/>
    <memnode cellid='1' mode='preferred' nodeset='1'/>
  </numatune>

  <numa>
    <cell id='0' cpus='0' memory='1024000' unit='KiB'/>
    <cell id='1' cpus='1' memory='1024000' unit='KiB'/>
  </numa>
......
2. Check the numatune node set:
1) # virsh numatune DomName
2) # cgget -g cpuset /machine.slice/machine-qemu\\x2dDomName.scope
3) # cgget -g cpuset /machine.slice/machine-qemu\\x2dDomName.scope/emulator
4) # cgget -g cpuset /machine.slice/machine-qemu\\x2dDomName.scope/vcpu1
5) # cgget -g cpuset /machine.slice/machine-qemu\\x2dDomName.scope/vcpu0

Actual results:
In step2, the 1) and 2) get the whole host numa node set: 0-1,16-17; while the 3), 4) and 5) get the correct node set: 0-1

Expected results:
In step2, all cmds should get the correct numatune host node set

Additional info:
The bug also occurs on ppc64 host with following sw versions:
Host kernel: 3.10.0-234.el7.ppc64
qemu-kvm-rhev: qemu-kvm-rhev-2.2.0-8.el7.ppc64
libvirt: libvirt-1.2.13-1.el7.ppc64

Comment 2 Michal Privoznik 2015-05-18 12:05:23 UTC
This is a result of:

commit af2a1f0587d88656f2c14265a63fbc11ecbd924e
Author:     Martin Kletzander <mkletzan@redhat.com>
AuthorDate: Fri Dec 12 15:29:48 2014 +0100
Commit:     Martin Kletzander <mkletzan@redhat.com>
CommitDate: Tue Dec 16 11:15:27 2014 +0100

    qemu: Leave cpuset.mems in parent cgroup alone
    
    Instead of setting the value of cpuset.mems once when the domain starts
    and then re-calculating the value every time we need to change the child
    cgroup values, leave the cgroup alone and rather set the child data
    every time there is new cgroup created.  We don't leave any task in the
    parent group anyway.  This will ease both current and future code.
    
    Signed-off-by: Martin Kletzander <mkletzan@redhat.com>


I'm investigating further.

Comment 3 Martin Kletzander 2015-05-18 23:10:57 UTC
Patch posted upstream:

https://www.redhat.com/archives/libvir-list/2015-May/msg00585.html

Comment 4 Martin Kletzander 2015-05-19 16:06:58 UTC
Fixed upstream with v1.2.15-113-g9deb96f:
commit 9deb96f9f0c061f21a1f37bdbb4f3820795343d6
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Mon May 18 14:55:10 2015 -0700

    qemu: Fix numatune nodeset reporting

Comment 6 Dan Zheng 2015-07-28 03:11:00 UTC
Test on below packages:
libvirt-1.2.17-2.el7.ppc64le
kernel-3.10.0-292.el7.ppc64le
qemu-kvm-rhev-2.3.0-9.el7.ppc64le

Test 1: Get numa info
Pass

1.1 # numactl --show
policy: default
preferred node: current
physcpubind: 0 8 16 24 32 40 48 56 64 72 80 88 96 104 112 120 128 136 144 152 
cpubind: 0 1 16 17 
nodebind: 0 1 16 17 
membind: 0 1 16 17 

1.2 Edit XML as below and start the guest
  <vcpu placement='static'>2</vcpu>

  <numatune>
    <memory mode='strict' nodeset='0-1'/>
    <memnode cellid='0' mode='strict' nodeset='0'/>
    <memnode cellid='1' mode='preferred' nodeset='1'/>
  </numatune>

  <numa>
    <cell id='0' cpus='0' memory='1024000' unit='KiB'/>
    <cell id='1' cpus='1' memory='1024000' unit='KiB'/>
  </numa>

1.3 # virsh numatune dzhengvm2
numa_mode      : strict
numa_nodeset   : 0-1               ===> Correct


# cgget -g cpuset /machine.slice/machine-qemu\\x2ddzhengvm2.scope
/machine.slice/machine-qemu\x2ddzhengvm2.scope:
cpuset.memory_spread_slab: 0
cpuset.memory_spread_page: 0
cpuset.memory_pressure: 0
cpuset.memory_migrate: 1
cpuset.sched_relax_domain_level: -1
cpuset.sched_load_balance: 1
cpuset.mem_hardwall: 0
cpuset.mem_exclusive: 0
cpuset.cpu_exclusive: 0
cpuset.mems: 0-1,16-17             ===> Correct
cpuset.cpus: 0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152

# cgget -g cpuset /machine.slice/machine-qemu\\x2ddzhengvm2.scope/emulator
/machine.slice/machine-qemu\x2ddzhengvm2.scope/emulator:
cpuset.memory_spread_slab: 0
cpuset.memory_spread_page: 0
cpuset.memory_pressure: 0
cpuset.memory_migrate: 1
cpuset.sched_relax_domain_level: -1
cpuset.sched_load_balance: 1
cpuset.mem_hardwall: 0
cpuset.mem_exclusive: 0
cpuset.cpu_exclusive: 0
cpuset.mems: 0-1                   ===> Correct
cpuset.cpus: 0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152

# cgget -g cpuset /machine.slice/machine-qemu\\x2ddzhengvm2.scope/vcpu0
/machine.slice/machine-qemu\x2ddzhengvm2.scope/vcpu0:
cpuset.memory_spread_slab: 0
cpuset.memory_spread_page: 0
cpuset.memory_pressure: 0
cpuset.memory_migrate: 1
cpuset.sched_relax_domain_level: -1
cpuset.sched_load_balance: 1
cpuset.mem_hardwall: 0
cpuset.mem_exclusive: 0
cpuset.cpu_exclusive: 0
cpuset.mems: 0-1                  ===> Correct
cpuset.cpus: 0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152

# cgget -g cpuset /machine.slice/machine-qemu\\x2ddzhengvm2.scope/vcpu1
/machine.slice/machine-qemu\x2ddzhengvm2.scope/vcpu1:
cpuset.memory_spread_slab: 0
cpuset.memory_spread_page: 0
cpuset.memory_pressure: 0
cpuset.memory_migrate: 1
cpuset.sched_relax_domain_level: -1
cpuset.sched_load_balance: 1
cpuset.mem_hardwall: 0
cpuset.mem_exclusive: 0
cpuset.cpu_exclusive: 0
cpuset.mems: 0-1                   ===> Correct
cpuset.cpus: 0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152

# cat /proc/`pidof -s qemu-kvm`/status
...
Cpus_allowed:	01010101,01010101,01010101,01010101,01010101
Cpus_allowed_list:	0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152
Mems_allowed:	00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000003
Mems_allowed_list:	0-1        ===> Correct
voluntary_ctxt_switches:	48066
nonvoluntary_ctxt_switches:	3

Test 2: set numa info
Pass

2.1 # virsh numatune dzhengvm2 --nodeset 1
2.2 # cgget -g cpuset /machine.slice/machine-qemu\\x2ddzhengvm2.scope/vcpu1
/machine.slice/machine-qemu\x2ddzhengvm2.scope/vcpu1:
...
cpuset.mems: 1
# cgget -g cpuset /machine.slice/machine-qemu\\x2ddzhengvm2.scope/vcpu0
/machine.slice/machine-qemu\x2ddzhengvm2.scope/vcpu0:
cpuset.cpu_exclusive: 0
cpuset.mems: 1
cpuset.cpus: 0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152

# cgget -g cpuset /machine.slice/machine-qemu\\x2ddzhengvm2.scope
/machine.slice/machine-qemu\x2ddzhengvm2.scope:
...
cpuset.mems: 0-1,16-17
cpuset.cpus: 0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152

# virsh numatune dzhengvm2
numa_mode      : strict
numa_nodeset   : 1

Test 3: change numa mode
Pass

3.1 Start a guest with numa_mode strict
3.2 # virsh numatune dzhengvm2 --mode 1
error: Unable to change numa parameters
error: Requested operation is not valid: can't change numatune mode for running domain
3.3 Destroy the guest
3.4
# virsh numatune dzhengvm2 --mode  1

# virsh numatune dzhengvm2
numa_mode      : preferred
numa_nodeset   : 1


Test 4: --config
Pass

4.1 Start a guest 
# virsh numatune dzhengvm2 
numa_mode      : strict
numa_nodeset   : 1
4.2 
# virsh numatune dzhengvm2 --nodeset 0 --config
# virsh numatune dzhengvm2
numa_mode      : strict
numa_nodeset   : 1
4.3 restart the guest and check again.
# virsh numatune dzhengvm2
numa_mode      : strict
numa_nodeset   : 0

Test 5: --live for running and destroyed guest
Pass

5.1 Start a guest
# virsh numatune dzhengvm2
numa_mode      : strict
numa_nodeset   : 0

# virsh numatune dzhengvm2 --nodeset 1 --live 

# virsh numatune dzhengvm2
numa_mode      : strict
numa_nodeset   : 1

# virsh destroy dzhengvm2
Domain dzhengvm2 destroyed

# virsh numatune dzhengvm2 --nodeset 0 --live 
error: Unable to change numa parameters
error: Requested operation is not valid: domain is not running

Test 6: --current for running and destroyed guest
Pass

6.1 with running guest
# virsh numatune dzhengvm2
numa_mode      : strict
numa_nodeset   : 1

# virsh numatune dzhengvm2 --nodeset 0 --current 

# virsh numatune dzhengvm2
numa_mode      : strict
numa_nodeset   : 0

# virsh destroy dzhengvm2
Domain dzhengvm2 destroyed

# virsh numatune dzhengvm2 --nodeset 1 --current 

# virsh numatune dzhengvm2
numa_mode      : strict
numa_nodeset   : 1

Comment 8 errata-xmlrpc 2015-11-19 06:31:04 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/RHBA-2015-2202.html


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