From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a4E9V-0005tO-Jp for qemu-devel@nongnu.org; Wed, 02 Dec 2015 15:37:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a4E9S-0003MV-Ta for qemu-devel@nongnu.org; Wed, 02 Dec 2015 15:37:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43036) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a4E9S-0003Ik-OG for qemu-devel@nongnu.org; Wed, 02 Dec 2015 15:37:22 -0500 References: <1449086675-11836-1-git-send-email-mst@redhat.com> From: Rik van Riel Message-ID: <565F567D.5070601@redhat.com> Date: Wed, 2 Dec 2015 15:37:17 -0500 MIME-Version: 1.0 In-Reply-To: <1449086675-11836-1-git-send-email-mst@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] util/mmap-alloc: fix hugetlb support on ppc64 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" , qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , Greg Kurz On 12/02/2015 03:04 PM, Michael S. Tsirkin wrote: > Since commit 8561c9244ddf1122d "exec: allocate PROT_NONE pages on top of > RAM", it is no longer possible to back guest RAM with hugepages on ppc64 > hosts: > > mmap(NULL, 285212672, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = > 0x3fff57000000 > mmap(0x3fff57000000, 268435456, PROT_READ|PROT_WRITE, > MAP_PRIVATE|MAP_FIXED, 19, 0) = -1 EBUSY (Device or resource busy) > > This is because on ppc64, Linux fixes a page size for a virtual address > at mmap time, so we can't switch a range of memory from anonymous > small pages to hugetlbs with MAP_FIXED. > > See commit d0f13e3c20b6fb73ccb467bdca97fa7cf5a574cd > ("[POWERPC] Introduce address space "slices"") in Linux > history for the details. > > Detect this and create the PROT_NONE mapping using the same fd. > > Naturally, this makes the guard page bigger with hugetlbfs. > > Based on patch by Greg Kurz. > > Cc: Rik van Riel > CC: Greg Kurz > Signed-off-by: Michael S. Tsirkin Acked-by: Rik van Riel -- All rights reversed