提交 fa6bdf6a 编写于 作者: M Michal Privoznik

qemu: Deny hugepages for non-existent NUMA nodes

https://bugzilla.redhat.com/show_bug.cgi?id=1534418

Just like ec982f6d 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: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 74e7c790
...@@ -7270,6 +7270,16 @@ qemuBuildMemPathStr(virQEMUDriverConfigPtr cfg, ...@@ -7270,6 +7270,16 @@ qemuBuildMemPathStr(virQEMUDriverConfigPtr cfg,
if (!def->mem.nhugepages) if (!def->mem.nhugepages)
return 0; 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" /* There is one special case: if user specified "huge"
* pages of regular system pages size. * pages of regular system pages size.
* And there is nothing to do in this case. * And there is nothing to do in this case.
......
<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) ...@@ -937,6 +937,9 @@ mymain(void)
DO_TEST("hugepages-pages7", DO_TEST("hugepages-pages7",
QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_OBJECT_MEMORY_FILE,
QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD); 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, DO_TEST("hugepages-memaccess", QEMU_CAPS_OBJECT_MEMORY_FILE,
QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_DEVICE_PC_DIMM,
QEMU_CAPS_NUMA); QEMU_CAPS_NUMA);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册