mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
qemu: Deny hugepages for non-existent NUMA nodes
https://bugzilla.redhat.com/show_bug.cgi?id=1534418
Just like ec982f6d92
denies hugepages for non-existent
guest NUMA nodes in case there are some nodes configured.
Unfortunately, when there are none, qemuBuildNumaArgStr() is not
called and thus we have to have check in qemuBuildMemPathStr()
too.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
74e7c79066
commit
fa6bdf6afa
@ -7270,6 +7270,16 @@ qemuBuildMemPathStr(virQEMUDriverConfigPtr cfg,
|
||||
if (!def->mem.nhugepages)
|
||||
return 0;
|
||||
|
||||
if (def->mem.hugepages[0].nodemask) {
|
||||
ssize_t next_bit = virBitmapNextSetBit(def->mem.hugepages[0].nodemask, -1);
|
||||
if (next_bit >= 0) {
|
||||
virReportError(VIR_ERR_XML_DETAIL,
|
||||
_("hugepages: node %zd not found"),
|
||||
next_bit);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* There is one special case: if user specified "huge"
|
||||
* pages of regular system pages size.
|
||||
* And there is nothing to do in this case.
|
||||
|
41
tests/qemuxml2argvdata/hugepages-pages8.xml
Normal file
41
tests/qemuxml2argvdata/hugepages-pages8.xml
Normal file
@ -0,0 +1,41 @@
|
||||
<domain type='qemu'>
|
||||
<name>SomeDummyHugepagesGuest</name>
|
||||
<uuid>ef1bdff4-27f3-4e85-a807-5fb4d58463cc</uuid>
|
||||
<memory unit='KiB'>1048576</memory>
|
||||
<currentMemory unit='KiB'>1048576</currentMemory>
|
||||
<memoryBacking>
|
||||
<hugepages>
|
||||
<page size='2048' unit='KiB' nodeset='1'/>
|
||||
</hugepages>
|
||||
</memoryBacking>
|
||||
<vcpu placement='static'>2</vcpu>
|
||||
<os>
|
||||
<type arch='i686' machine='pc'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-i686</emulator>
|
||||
<disk type='block' device='disk'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source dev='/dev/HostVG/QEMUGuest1'/>
|
||||
<target dev='hda' bus='ide'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
</disk>
|
||||
<controller type='usb' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='ide' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||
</controller>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<input type='keyboard' bus='ps2'/>
|
||||
<memballoon model='virtio'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||
</memballoon>
|
||||
</devices>
|
||||
</domain>
|
@ -937,6 +937,9 @@ mymain(void)
|
||||
DO_TEST("hugepages-pages7",
|
||||
QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_OBJECT_MEMORY_FILE,
|
||||
QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
|
||||
DO_TEST_FAILURE("hugepages-pages8",
|
||||
QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_OBJECT_MEMORY_FILE,
|
||||
QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
|
||||
DO_TEST("hugepages-memaccess", QEMU_CAPS_OBJECT_MEMORY_FILE,
|
||||
QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_DEVICE_PC_DIMM,
|
||||
QEMU_CAPS_NUMA);
|
||||
|
Loading…
Reference in New Issue
Block a user