[libvirt] [PATCH 5/5] tests: add qemuxml2argv memfd-memory-numa test

Marc-André Lureau marcandre.lureau at redhat.com
Tue Sep 11 08:48:58 UTC 2018


Hi

On Tue, Sep 11, 2018 at 2:57 AM, John Ferlan <jferlan at redhat.com> wrote:
>
>
> On 09/07/2018 07:32 AM, marcandre.lureau at redhat.com wrote:
>> From: Marc-André Lureau <marcandre.lureau at redhat.com>
>>
>> Check anonymous memory is backed by memfd if qemu is capable.
>>
>> Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
>> ---
>>  tests/qemuxml2argvdata/memfd-memory-numa.args | 28 +++++++++++++++
>>  tests/qemuxml2argvdata/memfd-memory-numa.xml  | 36 +++++++++++++++++++
>>  tests/qemuxml2argvtest.c                      |  5 +++
>>  3 files changed, 69 insertions(+)
>>  create mode 100644 tests/qemuxml2argvdata/memfd-memory-numa.args
>>  create mode 100644 tests/qemuxml2argvdata/memfd-memory-numa.xml
>>
>> diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.args b/tests/qemuxml2argvdata/memfd-memory-numa.args
>> new file mode 100644
>> index 0000000000..b26c476196
>> --- /dev/null
>> +++ b/tests/qemuxml2argvdata/memfd-memory-numa.args
>> @@ -0,0 +1,28 @@
>> +LC_ALL=C \
>> +PATH=/bin \
>> +HOME=/home/test \
>> +USER=test \
>> +LOGNAME=test \
>> +QEMU_AUDIO_DRV=none \
>> +/usr/bin/qemu-system-x86_64 \
>> +-name instance-00000092 \
>> +-S \
>> +-machine pc-i440fx-wily,accel=kvm,usb=off,dump-guest-core=off \
>> +-m 14336 \
>> +-mem-prealloc \
>> +-smp 20,sockets=1,cores=8,threads=1 \
>> +-object memory-backend-memfd,id=ram-node0,hugetlb=yes,hugetlbsize=2097152,share=yes,\
>> +size=15032385536,host-nodes=3,policy=preferred \
>
> Another syntax-check error here, needed to move the "share=yes," to the
> subsequent line.
>

ok

>> +-numa node,nodeid=0,cpus=0-7,memdev=ram-node0 \
>> +-uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \
>> +-display none \
>> +-no-user-config \
>> +-nodefaults \
>> +-chardev socket,id=charmonitor,\
>> +path=/tmp/lib/domain--1-instance-00000092/monitor.sock,server,nowait \
>> +-mon chardev=charmonitor,id=monitor,mode=control \
>> +-rtc base=utc \
>> +-no-shutdown \
>> +-no-acpi \
>> +-usb \
>> +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
>> diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.xml b/tests/qemuxml2argvdata/memfd-memory-numa.xml
>> new file mode 100644
>> index 0000000000..abe93e8c4b
>> --- /dev/null
>> +++ b/tests/qemuxml2argvdata/memfd-memory-numa.xml
>> @@ -0,0 +1,36 @@
>> +  <domain type='kvm' id='56'>
>> +    <name>instance-00000092</name>
>> +    <uuid>126f2720-6f8e-45ab-a886-ec9277079a67</uuid>
>> +    <memory unit='KiB'>14680064</memory>
>> +    <currentMemory unit='KiB'>14680064</currentMemory>
>> +    <memoryBacking>
>> +      <hugepages>
>> +          <page size="2" unit="M"/>
>> +      </hugepages>
>> +      <source type='anonymous'/>
>> +      <access mode='shared'/>
>> +      <allocation mode='immediate'/>
>> +    </memoryBacking>
>> +    <numatune>
>> +        <memnode cellid='0' mode='preferred' nodeset='3'/>
>> +    </numatune>
>> +    <vcpu placement='static'>20</vcpu>
>> +    <os>
>> +      <type arch='x86_64' machine='pc-i440fx-wily'>hvm</type>
>> +      <boot dev='hd'/>
>> +    </os>
>> +    <cpu>
>> +      <topology sockets='1' cores='8' threads='1'/>
>> +      <numa>
>> +        <cell id='0' cpus='0-7' memory='14680064' unit='KiB'/>
>> +      </numa>
>> +    </cpu>
>> +    <clock offset='utc'/>
>> +    <on_poweroff>destroy</on_poweroff>
>> +    <on_reboot>restart</on_reboot>
>> +    <on_crash>destroy</on_crash>
>> +    <devices>
>> +      <emulator>/usr/bin/qemu-system-x86_64</emulator>
>> +      <memballoon model='virtio'/>
>> +    </devices>
>> +  </domain>
>> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
>> index 35df63b2ac..76008a8d07 100644
>> --- a/tests/qemuxml2argvtest.c
>> +++ b/tests/qemuxml2argvtest.c
>> @@ -2928,6 +2928,11 @@ mymain(void)
>>      DO_TEST("fd-memory-no-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE,
>>              QEMU_CAPS_KVM);
>>
>> +    DO_TEST("memfd-memory-numa",
>> +            QEMU_CAPS_OBJECT_MEMORY_MEMFD,
>> +            QEMU_CAPS_OBJECT_MEMORY_MEMFD_HUGETLB,
>> +            QEMU_CAPS_KVM);
>> +
>
> Theoretically, if we have 3.1 capabilties to test against, then this
> would use a DO_TEST_CAPS_LATEST, while a "pre-3.1" would still be using
> -ramfd, right?  That is, using DO_TEST_CAPS_VER w/ "3.0.0" would
> generate different results.
>
> I'm conflicted if we should wait for someone to generate the 3.1 caps or
> not. For whatever reason, when I post them they're not quite right for
> someone else's tastes...
>
> Let's see if anyone else has strong feelings one way or another.
>

-memfd is available since 2.12. After patch 1 & 2 are applied, we
should probably switch to use DO_TEST_CAPS_LATEST.

Before 2.12 (or if the capabilities are not exposed by the host qemu)
the argv will use -file. This is already covered by existing tests,
like hugepages-shared.

thanks

> John
>
>>      DO_TEST("cpu-check-none", QEMU_CAPS_KVM);
>>      DO_TEST("cpu-check-partial", QEMU_CAPS_KVM);
>>      DO_TEST("cpu-check-full", QEMU_CAPS_KVM);
>>




More information about the libvir-list mailing list