[PATCH v3 5/5] qemu_domain.c: align all pSeries mem modules when PARSE_ABI_UPDATE
Andrea Bolognani
abologna at redhat.com
Fri Dec 4 15:14:52 UTC 2020
On Thu, 2020-12-03 at 22:05 -0300, Daniel Henrique Barboza wrote:
> qemuDomainAlignMemorySizes() has an operation order problem. We are
> calculating 'initialmem' without aligning the memory modules first.
> Since we're aligning the dimms afterwards this can create inconsistencies
> in the end result. x86 has alignment of 1-2MiB and it's not severely
> impacted by it, but pSeries works with 256MiB alignment and the difference
> is noticeable.
>
> This is the case of the existing 'memory-hotplug-ppc64-nonuma' test.
> The test consists of a 2GiB (aligned value) guest with 2 ~520MiB dimms,
> both unaligned. 'initialmem' is calculated by taking total_mem and
> subtracting the dimms size (via virDomainDefGetMemoryInitial()), which
> wil give us 2GiB - 520MiB - 520MiB, ending up with a little more than
> an 1GiB of 'initialmem'. Note that this value is now unaligned, and
> will be aligned up via VIR_ROUND_UP(), and we'll end up with 'initialmem'
> of 1GiB + 256MiB. Given that the dimms are aligned later on, the end
> result for QEMU is that the guest will have a 'mem' size of 1310720k,
> plus the two 512 MiB dimms, exceeding in 256MiB the desired 2GiB
> memory and currentMemory specified in the XML.
>
> Existing guests can't be fixed without breaking ABI, but we have
> code already in place to align pSeries NVDIMM modules for new guests.
> Let's extend it to align all pSeries mem modules.
>
> A new test, 'memory-hotplug-ppc64-nonuma-abi-update', a copy of the
> existing 'memory-hotplug-ppc64-nonuma', was added to demonstrate the
> result for new pSeries guests. For the same unaligned XML mentioned
> above, after applying this patch:
>
> - starting QEMU mem size without PARSE_ABI_UPDATE:
> -m size=1310720k,slots=16,maxmem=4194304k \ (no changes)
>
> - starting QEMU mem size with PARSE_ABI_UPDATE:
> -m size=1048576k,slots=16,maxmem=4194304k \ (size fixed)
>
> Reviewed-by: Michal Privoznik <mprivozn at redhat.com>
> Signed-off-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
> ---
> src/qemu/qemu_domain.c | 14 +++++--
> ...emory-hotplug-ppc64-nonuma-abi-update.args | 29 ++++++++++++++
> ...memory-hotplug-ppc64-nonuma-abi-update.xml | 1 +
> tests/qemuxml2argvtest.c | 7 ++++
> ...memory-hotplug-ppc64-nonuma-abi-update.xml | 38 +++++++++++++++++++
> tests/qemuxml2xmltest.c | 7 ++++
> 6 files changed, 92 insertions(+), 4 deletions(-)
> create mode 100644 tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma-abi-update.args
> create mode 120000 tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma-abi-update.xml
> create mode 100644 tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma-abi-update.xml
Reviewed-by: Andrea Bolognani <abologna at redhat.com>
--
Andrea Bolognani / Red Hat / Virtualization
More information about the libvir-list
mailing list