diff mbox series

qemu: improve hugepage allocation failure message

Message ID 20180109193745.GA18506@amt.cnet
State New
Headers show
Series qemu: improve hugepage allocation failure message | expand

Commit Message

Marcelo Tosatti Jan. 9, 2018, 7:37 p.m. UTC
Improve hugepage allocation failure message, indicating
whats happening to the user.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Comments

Eric Blake Jan. 9, 2018, 7:41 p.m. UTC | #1
On 01/09/2018 01:37 PM, Marcelo Tosatti wrote:
> 
> Improve hugepage allocation failure message, indicating
> whats happening to the user.

s/whats/what's/

> 
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> 
> diff --git a/exec.c b/exec.c
> index 4722e521d4..439abedb98 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1643,7 +1643,8 @@ static void *file_ram_alloc(RAMBlock *block,
>                           block->flags & RAM_SHARED);
>      if (area == MAP_FAILED) {
>          error_setg_errno(errp, errno,
> -                         "unable to map backing store for guest RAM");
> +                         "unable to map backing store for guest RAM, "
> +                         "falling back to malloc based RAM allocation");
>          return NULL;
>      }
>  
> 
>
Haozhong Zhang Jan. 9, 2018, 8:16 p.m. UTC | #2
On 01/09/18 17:37 -0200, Marcelo Tosatti wrote:
> 
> Improve hugepage allocation failure message, indicating
> whats happening to the user.
> 
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> 
> diff --git a/exec.c b/exec.c
> index 4722e521d4..439abedb98 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1643,7 +1643,8 @@ static void *file_ram_alloc(RAMBlock *block,
>                           block->flags & RAM_SHARED);
>      if (area == MAP_FAILED) {
>          error_setg_errno(errp, errno,
> -                         "unable to map backing store for guest RAM");
> +                         "unable to map backing store for guest RAM, "
> +                         "falling back to malloc based RAM allocation");
>          return NULL;
>      }
>  

The backing store here is not always hugetlbfs, e.g., it can be NVDIMM
and even regular files. In those cases, the failure of file_ram_alloc()
does not fall back to malloc.

Haozhong
Paolo Bonzini Jan. 10, 2018, 2:59 p.m. UTC | #3
On 09/01/2018 21:16, Haozhong Zhang wrote:
> On 01/09/18 17:37 -0200, Marcelo Tosatti wrote:
>>
>> Improve hugepage allocation failure message, indicating
>> whats happening to the user.
>>
>> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
>>
>> diff --git a/exec.c b/exec.c
>> index 4722e521d4..439abedb98 100644
>> --- a/exec.c
>> +++ b/exec.c
>> @@ -1643,7 +1643,8 @@ static void *file_ram_alloc(RAMBlock *block,
>>                           block->flags & RAM_SHARED);
>>      if (area == MAP_FAILED) {
>>          error_setg_errno(errp, errno,
>> -                         "unable to map backing store for guest RAM");
>> +                         "unable to map backing store for guest RAM, "
>> +                         "falling back to malloc based RAM allocation");
>>          return NULL;
>>      }
>>  
> 
> The backing store here is not always hugetlbfs, e.g., it can be NVDIMM
> and even regular files. In those cases, the failure of file_ram_alloc()
> does not fall back to malloc.

It's also not happending if !mem_prealloc.  Let's instead add an
error_report in allocate_system_memory_nonnuma (and it's probably better
to use MAP_ANON instead of malloc in the message).

Paolo
diff mbox series

Patch

diff --git a/exec.c b/exec.c
index 4722e521d4..439abedb98 100644
--- a/exec.c
+++ b/exec.c
@@ -1643,7 +1643,8 @@  static void *file_ram_alloc(RAMBlock *block,
                          block->flags & RAM_SHARED);
     if (area == MAP_FAILED) {
         error_setg_errno(errp, errno,
-                         "unable to map backing store for guest RAM");
+                         "unable to map backing store for guest RAM, "
+                         "falling back to malloc based RAM allocation");
         return NULL;
     }