Bug 1294475

Summary: libvirt start vm under incorrect NUMA memory mode
Product: Red Hat Enterprise Linux 7 Reporter: Artyom <alukiano>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.2CC: alukiano, dyuan, lhuang, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-01-04 13:39:43 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:

Description Artyom 2015-12-28 11:41:43 UTC
Description of problem:
I start vm under NUMA memory strict mode, but when I check vm process numa_maps I can see that process run under prefer mode.

Version-Release number of selected component (if applicable):
# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.2 (Maipo)
# uname -r
3.10.0-327.el7.x86_64
# rpm -qa | grep libvirt
libvirt-client-1.2.17-13.el7_2.2.x86_64
libvirt-daemon-config-nwfilter-1.2.17-13.el7_2.2.x86_64
libvirt-daemon-driver-lxc-1.2.17-13.el7_2.2.x86_64
libvirt-lock-sanlock-1.2.17-13.el7_2.2.x86_64
libvirt-daemon-driver-nwfilter-1.2.17-13.el7_2.2.x86_64
libvirt-daemon-driver-interface-1.2.17-13.el7_2.2.x86_64
libvirt-daemon-config-network-1.2.17-13.el7_2.2.x86_64
libvirt-daemon-1.2.17-13.el7_2.2.x86_64
libvirt-daemon-driver-storage-1.2.17-13.el7_2.2.x86_64
libvirt-daemon-driver-network-1.2.17-13.el7_2.2.x86_64
libvirt-1.2.17-13.el7_2.2.x86_64
libvirt-daemon-kvm-1.2.17-13.el7_2.2.x86_64
libvirt-daemon-driver-secret-1.2.17-13.el7_2.2.x86_64
libvirt-daemon-driver-qemu-1.2.17-13.el7_2.2.x86_64
libvirt-python-1.2.17-2.el7.x86_64
libvirt-daemon-driver-nodedev-1.2.17-13.el7_2.2.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Start vm under numa strict mode:
<numatune>
    <memory mode='strict' nodeset='0,2'/>
</numatune>
2. check numa_maps under vm process
# cat /proc/14328/numa_maps | head -n 1
7fb2677fa000 prefer:2

Actual results:
vm process run under prefer mode

Expected results:
vm process run under bind mode

Additional info:

Comment 2 Michal Privoznik 2016-01-04 13:39:43 UTC
This is deliberate. Problem is, if we run it strictly under configured nodes there would be no way how to change it afterwards on a running guest. Therefore, libvirt - just before spawning qemu process - calls numa APIs to set affinity only in preferred mode and uses cgroups to enforce the strictness. See bug 1198645 or upstream commit ea576ee543d6fb955 for more info.

Comment 3 Artyom 2016-01-05 08:00:29 UTC
Thanks for explanation, I will check bug 1198645.