From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGiBQ-0007CE-4o for qemu-devel@nongnu.org; Thu, 20 Feb 2014 23:58:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGiBD-0001cC-Up for qemu-devel@nongnu.org; Thu, 20 Feb 2014 23:57:56 -0500 Received: from mail-pb0-f52.google.com ([209.85.160.52]:58123) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGiBD-0001c1-Oq for qemu-devel@nongnu.org; Thu, 20 Feb 2014 23:57:43 -0500 Received: by mail-pb0-f52.google.com with SMTP id jt11so2916985pbb.39 for ; Thu, 20 Feb 2014 20:57:42 -0800 (PST) Message-ID: <5306DCC0.7010107@ozlabs.ru> Date: Fri, 21 Feb 2014 15:57:36 +1100 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <1392013975-1656-1-git-send-email-aik@ozlabs.ru> In-Reply-To: <1392013975-1656-1-git-send-email-aik@ozlabs.ru> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH] file ram alloc: fail if cannot preallocate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Alexander Graf On 02/10/2014 05:32 PM, Alexey Kardashevskiy wrote: > At the moment if the user asked for huge pages and there is no more huge > pages, QEMU prints warning and falls back to the anonymous memory > allocator which is quite easy not to notice. QEMU also does so even > if the user specified -mem-prealloc and it seems wrong as the user > specifically requested huge pages for the entire RAM but QEMU failed to do > so and continued. On PPC64 this will produce a fragile guest as QEMU > tells the guest via device-tree that it can use huge pages when it > actually cannot. > > This adds message+exit if RAM cannot be preallocated from huge pages. Too bad? Should I increase my personal pinging timeout from 1 to 2 weeks to avoid annoying the community? :) Thanks! > Signed-off-by: Alexey Kardashevskiy > --- > exec.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/exec.c b/exec.c > index 9ad0a4b..deb8279 100644 > --- a/exec.c > +++ b/exec.c > @@ -1041,6 +1041,10 @@ static void *file_ram_alloc(RAMBlock *block, > > area = mmap(0, memory, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); > if (area == MAP_FAILED) { > + if (mem_prealloc) { > + perror("file_ram_alloc: failed to preallocate RAM"); > + exit(1); > + } > perror("file_ram_alloc: can't mmap RAM pages"); > close(fd); > return (NULL); > -- Alexey