qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH] file ram alloc: fail if cannot preallocate


From: Alexey Kardashevskiy
Subject: Re: [Qemu-devel] [RFC PATCH] file ram alloc: fail if cannot preallocate
Date: Fri, 21 Feb 2014 15:57:36 +1100
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

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 <address@hidden>
> ---
>  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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]