[libvirt] [PATCH] qemu: Fix system pages handling in <memoryBacking/>

In one of my previous commits (311b4a67) I've tried to allow to pass regular system pages to <hugepages>. However, there was a little bug that wasn't caught. If domain has guest NUMA topology defined, qemuBuildNumaArgStr() function takes care of generating corresponding command line. The hugepages backing for guest NUMA nodes is handled there too. And here comes the bug: the hugepages setting from XML is stored in KiB internally, however, the system pages size was queried and stored in Bytes. So the check whether these two equal was failing even if it shouldn't. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/qemu/qemu_command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d5679de..1930abd 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6612,7 +6612,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, char *nodemask = NULL; char *mem_path = NULL; int ret = -1; - const long system_page_size = sysconf(_SC_PAGESIZE); + const long system_page_size = sysconf(_SC_PAGESIZE) / 1024; if (virDomainNumatuneHasPerNodeBinding(def->numatune) && !(virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_RAM) || -- 2.0.5

On Wed, Jan 07, 2015 at 03:23:19PM +0100, Michal Privoznik wrote:
In one of my previous commits (311b4a67) I've tried to allow to pass regular system pages to <hugepages>. However, there was a little bug that wasn't caught. If domain has guest NUMA topology defined, qemuBuildNumaArgStr() function takes care of generating corresponding command line. The hugepages backing for guest NUMA nodes is handled there too. And here comes the bug: the hugepages setting from XML is stored in KiB internally, however, the system pages size was queried and stored in Bytes. So the check whether these two equal was failing
s/two equal/two are equal/ I can't think of a system with page size non-divisible by 1024, so ACK. Martin
participants (2)
-
Martin Kletzander
-
Michal Privoznik