]> git.proxmox.com Git - mirror_qemu.git/commit
Clear mem_path if we fall back to anonymous RAM allocation
authorDavid Gibson <david@gibson.dropbear.id.au>
Thu, 19 Apr 2018 07:19:11 +0000 (17:19 +1000)
committerDavid Gibson <david@gibson.dropbear.id.au>
Fri, 27 Apr 2018 08:05:23 +0000 (18:05 +1000)
commit6233b679cae8741890f981c9dd6570d47715141e
tree5e607a9eb75393c5158a22ddde0ab532f52d5938
parent88f42c6773c0c09f5c38d5eb0cd6e8b7aed4dfeb
Clear mem_path if we fall back to anonymous RAM allocation

If the -mem-path option is set, we attempt to map the guest's RAM from a
file in the given path; it's usually used to back guest RAM with hugepages.
If we're unable to (e.g. not enough free hugepages) then we fall back to
allocating normal anonymous pages.  This behaviour can be surprising, but a
comment in allocate_system_memory_nonnuma() suggests it's legacy behaviour
we can't change.

What really isn't ok, though, is that in this case we leave mem_path set.
That means functions which attempt to determine the pagesize of main RAM
can erroneously think it is hugepage based on the requested path, even
though it's not.

This is particular bad for the pseries machine type.  KVM HV limitations
mean the guest can't use pagesizes larger than the host page size used to
back RAM.  That means that such a fallback, rather than merely giving
poorer performance than expected will cause the guest to freeze up early in
boot as it attempts to use large page mappings that can't work.

This patch addresses the problem by clearing the mem_path variable when we
fall back to anonymous pages, meaning that subsequent attempts to
determine the RAM page size will get an accurate result.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
numa.c