Skip to contentSkip to conversation

qemu: improve hugepage allocation failure message

PATCH Superseded Marcelo Tosatti 4 participants 4 messages Jan 9, 2018 – Jan 10, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu: improve hugepage allocation failure message

Improve hugepage allocation failure message, indicating whats happening to the user.

exec.c +2 -1
index 4722e521d4..439abedb98 100644
@@ -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;
     }
 
#1 lore raw
Quoted 3 lines · Marcelo Tosatti

Improve hugepage allocation failure message, indicating whats happening to the user.

s/whats/what's/

Quoted 19 lines
exec.c +2 -1
index 4722e521d4..439abedb98 100644
@@ -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;
     }
 
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#2 lore raw
In reply to Marcelo Tosatti
Quoted 11 lines · Marcelo Tosatti

Improve hugepage allocation failure message, indicating whats happening to the user.

exec.c +0 -0
index 4722e521d4..439abedb98 100644

exec.c static void *file_ram_alloc(RAMBlock *block, · line 1650

Quoted 9 lines
exec.c +2 -1
@@ -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

#3 lore raw
Quoted 17 lines · Haozhong Zhang
Quoted 16 lines · Marcelo Tosatti

Improve hugepage allocation failure message, indicating whats happening to the user.

exec.c +1 -1
index 4722e521d4..439abedb98 100644
@@ -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, "
Quoted 8 lines

exec.c static void *file_ram_alloc(RAMBlock *block, · line 1650

Quoted 4 lines
exec.c +1 -0
+                         "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