Bug 2208946
| Summary: | Wrong numa tuning mode applies on numa memory when "interleave" or "preferred" mode mixed with "restrictive" mode | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | liang cong <lcong> |
| Component: | libvirt | Assignee: | Michal Privoznik <mprivozn> |
| libvirt sub component: | General | QA Contact: | liang cong <lcong> |
| Status: | CLOSED ERRATA | Docs Contact: | |
| Severity: | medium | ||
| Priority: | unspecified | CC: | jdenemar, lmen, mprivozn, virt-maint, ymankad |
| Version: | 9.3 | Keywords: | AutomationTriaged, Triaged, Upstream |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-9.4.0-1.el9 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-11-07 08:31:41 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: | 9.4.0 |
| Embargoed: | |||
Patches posted upstream: https://listman.redhat.com/archives/libvir-list/2023-May/239950.html Merged upstream as: 17c8a173b6 numa_conf: Deny other memory modes than 'restrictive' if a memnode is 'restrictive' f6ba9fc12a numa_conf: Move memnode mode validation into virDomainNumaDefValidate() a152d856c3 virDomainNumatuneNodeSpecified: Fix const correctness v9.3.0-105-g17c8a173b6 Preverified on upstream build libvirt v9.3.0-110-g3b6d69237f
Test steps:
scenario 1:
1.1 Define a guest with below setting:
<numatune>
<memory mode="interleave" nodeset="0"/> <!-- also preferred or strict mode -->
<memnode cellid="0" mode="restrictive" nodeset="1"/>
</numatune>
...
<numa>
<cell id='0' cpus='0' memory='1048576' unit='KiB'/>
<cell id='1' cpus='1' memory='1024000' unit='KiB'/>
</numa>
1.2 Error msg prompts
# virsh define vm1.xml
error: Failed to define domain from vm1.xml
error: XML error: 'restrictive' mode is required in memory element when mode is 'restrictive' in memnode element
scenario 2:
2.1 Define a guest with below setting:
<numatune>
<memnode cellid="0" mode="restrictive" nodeset="1"/>
</numatune>
...
<numa>
<cell id='0' cpus='0' memory='1048576' unit='KiB'/>
<cell id='1' cpus='1' memory='1024000' unit='KiB'/>
</numa>
2.2 Error msg prompts
# virsh define vm1.xml
error: Failed to define domain from vm1.xml
error: XML error: 'restrictive' mode is required in memory element when mode is 'restrictive' in memnode element
Hi michal, please help to check scenario 2, error msg prompts when only restrictive memnode element defined. Could you help to check if it works as design?
(In reply to liang cong from comment #3) > Hi michal, please help to check scenario 2, error msg prompts when only > restrictive memnode element defined. Could you help to check if it works as > design? Yes, because the default is 'strict'. Therefore, users need to explicitly define 'restrictive'. Verified on build:
# rpm -q libvirt qemu-kvm
libvirt-9.5.0-3.el9.x86_64
qemu-kvm-8.0.0-9.el9.x86_64
Test steps:
scenario 1:
1.1 Define a guest with below setting:
<numatune>
<memory mode="interleave" nodeset="0"/> <!-- also preferred or strict mode -->
<memnode cellid="0" mode="restrictive" nodeset="1"/>
</numatune>
...
<numa>
<cell id='0' cpus='0' memory='1048576' unit='KiB'/>
<cell id='1' cpus='1' memory='1024000' unit='KiB'/>
</numa>
1.2 Error msg prompts
# virsh define vm1.xml
error: Failed to define domain from vm1.xml
error: XML error: 'restrictive' mode is required in memory element when mode is 'restrictive' in memnode element
scenario 2:
2.1 Define a guest with below setting:
<numatune>
<memnode cellid="0" mode="restrictive" nodeset="1"/>
</numatune>
...
<numa>
<cell id='0' cpus='0' memory='1048576' unit='KiB'/>
<cell id='1' cpus='1' memory='1024000' unit='KiB'/>
</numa>
2.2 Error msg prompts
# virsh define vm1.xml
error: Failed to define domain from vm1.xml
error: XML error: 'restrictive' mode is required in memory element when mode is 'restrictive' in memnode element
scenario 3:
3.1 Define a guest with below setting:
<numatune>
<memory mode="restrictive" nodeset="0-1"/>
<memnode cellid="0" mode="strict" nodeset="1"/> <!-- also preferred or interleave mode -->
</numatune>
...
<numa>
<cell id='0' cpus='0' memory='1048576' unit='KiB'/>
<cell id='1' cpus='1' memory='1024000' unit='KiB'/>
</numa>
3.2 Error msg prompts
# virsh define vm1.xml
error: Failed to define domain from vm1.xml
error: XML error: 'restrictive' mode is required in memnode element when mode is 'restrictive' in memory element
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 (Moderate: libvirt security, bug fix, and enhancement update), 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/RHSA-2023:6409 |
Description of problem:Wrong numa tuning mode applies on numa memory when "interleave" or "preferred" mode mixed with "restrictive" mode Version-Release number of selected component (if applicable): # rpm -q libvirt qemu-kvm libvirt-9.3.0-2.el9.x86_64 qemu-kvm-8.0.0-3.el9.x86_64 How reproducible: 100% Steps to Reproduce: Scenario 1: 1.1 Start a guest with below setting: <numatune> <memory mode="interleave" nodeset="0"/> <memnode cellid="0" mode="restrictive" nodeset="1"/> </numatune> ... <numa> <cell id='0' cpus='0' memory='1048576' unit='KiB'/> <cell id='1' cpus='1' memory='1024000' unit='KiB'/> </numa> 1.2 Check guest numa cell 0 memory allocation on host # grep -B1 1048576 /proc/`pidof qemu-kvm`/smaps 7fecf3e00000-7fed33e00000 rw-p 00000000 00:00 0 Size: 1048576 kB grep 7fecf3e00000 /proc/`pidof qemu-kvm`/numa_maps 7fecf3e00000 interleave:0 anon=54798 dirty=54798 N0=6657 N1=48141 kernelpagesize_kB=4 1.3 check qemu cmd line and no specific mode applies on guest numa cell 0 memory ...-overcommit mem-lock=off -smp 2,sockets=2,cores=1,threads=1 -object {"qom-type":"memory-backend-ram","id":"ram-node0","size":1073741824} -numa node,nodeid=0,cpus=0,memdev=ram-node0 -object {"qom-type":"memory-backend-ram","id":"ram-node1","size":1048576000,"host-nodes":[0],"policy":"interleave"} -numa node,nodeid=1,cpus=1,memdev=ram-node1... Actual results: We could see that the guest numa cell 0 memory is applied with interleave mode which is different from what we defined. Scenario 2: 2.1 Start a guest with below setting: <numatune> <memory mode="preferred" nodeset="0"/> <memnode cellid="0" mode="restrictive" nodeset="1"/> </numatune> ... <numa> <cell id='0' cpus='0' memory='1048576' unit='KiB'/> <cell id='1' cpus='1' memory='1024000' unit='KiB'/> </numa> 2.2 Check guest numa cell 0 memory allocation on host # grep -B1 1048576 /proc/`pidof qemu-kvm`/smaps 7f26f7e00000-7f2737e00000 rw-p 00000000 00:00 0 Size: 1048576 kB # grep 7f26f7e00000 /proc/`pidof qemu-kvm`/numa_maps 7f26f7e00000 prefer (many):0 anon=37902 dirty=37902 active=32782 N0=1537 N1=36365 kernelpagesize_kB=4 2.3 check qemu cmd line and no specific mode applies on guest numa cell 0 memory ...-overcommit mem-lock=off -smp 2,sockets=2,cores=1,threads=1 -object {"qom-type":"memory-backend-ram","id":"ram-node0","size":1073741824} -numa node,nodeid=0,cpus=0,memdev=ram-node0 -object {"qom-type":"memory-backend-ram","id":"ram-node1","size":1048576000,"host-nodes":[0],"policy":"preferred"} -numa node,nodeid=1,cpus=1,memdev=ram-node1 ... Actual results: We could see that the guest numa cell 0 memory is applied with preferred mode which is different from what we defined. Expected results: The guest numa cell 0 memory should apply default numa mode Additional info: 1. If I start a guest with below setting: <numatune> <memory mode="strict" nodeset="0"/> <memnode cellid="0" mode="restrictive" nodeset="1"/> </numatune> ... <numa> <cell id='0' cpus='0' memory='1048576' unit='KiB'/> <cell id='1' cpus='1' memory='1024000' unit='KiB'/> </numa> Then check guest numa cell 0 memory allocation on host, the mode is default: # grep -B1 1048576 /proc/`pidof qemu-kvm`/smaps 7fd173e00000-7fd1b3e00000 rw-p 00000000 00:00 0 Size: 1048576 kB # grep 7fd173e00000 /proc/`pidof qemu-kvm`/numa_maps 7fd173e00000 default anon=77326 dirty=77326 active=73230 N0=6657 N1=70669 kernelpagesize_kB=4 2. If restrictive mode could not work with other modes we could add error prompts or restrictions when mixing them, just like if setting: <numatune> <memory mode="restrictive" nodeset="0"/> <memnode cellid="0" mode="strict" nodeset="1"/> <!-- or other mode like "preferred", "interleave" --> </numatune> Error msg prompts " 'restrictive' mode is required in memnode element when mode is 'restrictive' in memory element"