Received: from eggs.gnu.org ([2001:4830:134:3::10]:54317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0qg6-0006Tk-QH for qemu-devel@nongnu.org; Mon, 23 Nov 2015 07:57:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a0qg3-00017u-Kw for qemu-devel@nongnu.org; Mon, 23 Nov 2015 07:57:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54402) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0qg3-00017q-FT for qemu-devel@nongnu.org; Mon, 23 Nov 2015 07:57:03 -0500 From: Eduardo Habkost Date: Mon, 23 Nov 2015 10:46:21 -0200 Message-Id: <1448282781-23907-2-git-send-email-ehabkost@redhat.com> In-Reply-To: <1448282781-23907-1-git-send-email-ehabkost@redhat.com> References: <1448282781-23907-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PULL 1/1] hostmem: Ignore ENOSYS while setting MPOL_DEFAULT List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Paolo Bonzini , Pavel Fedin , qemu-devel@nongnu.org From: Pavel Fedin Currently hostmem backend fails if CONFIG_NUMA is enabled in QEMU (the default) but NUMA is not supported by the kernel. This makes it impossible to use ivshmem in such configurations. This patch fixes the problem by ignoring ENOSYS error if policy is set to MPOL_DEFAULT. This way the code behaves in the same way as if CONFIG_NUMA was not defined. qemu will still fail if the user specifies some other policy, so that the user knows it. Signed-off-by: Pavel Fedin Reviewed-by: Eduardo Habkost Signed-off-by: Eduardo Habkost --- backends/hostmem.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backends/hostmem.c b/backends/hostmem.c index 41ba2af..1b4eb45 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -313,9 +313,11 @@ host_memory_backend_memory_complete(UserCreatable *uc, Error **errp) assert(maxnode <= MAX_NODES); if (mbind(ptr, sz, backend->policy, maxnode ? backend->host_nodes : NULL, maxnode + 1, flags)) { - error_setg_errno(errp, errno, - "cannot bind memory to host NUMA nodes"); - return; + if (backend->policy != MPOL_DEFAULT || errno != ENOSYS) { + error_setg_errno(errp, errno, + "cannot bind memory to host NUMA nodes"); + return; + } } #endif /* Preallocate memory after the NUMA policy has been instantiated. -- 2.1.0