]> git.ipfire.org Git - thirdparty/qemu.git/commit
hostmem: don't use mbind() if host-nodes is empty
authorIgor Mammedov <imammedo@redhat.com>
Thu, 30 Apr 2020 15:46:06 +0000 (11:46 -0400)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 24 Aug 2020 23:55:30 +0000 (18:55 -0500)
commit9e6e3ba30984267be4721022f579fb168d43c8a4
treeeb49460176c285d9116d8edcd6366b77f7f9b84e
parentfdd76fecdde1ad444ff4deb7f1c4f7e4a1ef97d6
hostmem: don't use mbind() if host-nodes is empty

Since 5.0 QEMU uses hostmem backend for allocating main guest RAM.
The backend however calls mbind() which is typically NOP
in case of default policy/absent host-nodes bitmap.
However when runing in container with black-listed mbind()
syscall, QEMU fails to start with error
 "cannot bind memory to host NUMA nodes: Operation not permitted"
even when user hasn't provided host-nodes to pin to explictly
(which is the case with -m option)

To fix issue, call mbind() only in case when user has provided
host-nodes explicitly (i.e. host_nodes bitmap is not empty).
That should allow to run QEMU in containers with black-listed
mbind() without memory pinning. If QEMU provided memory-pinning
is required user still has to white-list mbind() in container
configuration.

Reported-by: Manuel Hohmann <mhohmann@physnet.uni-hamburg.de>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20200430154606.6421-1-imammedo@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit 70b6d525dfb51d5e523d568d1139fc051bc223c5)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
backends/hostmem.c