Skip to contentSkip to conversation

file_ram_alloc: propagate error to caller instead of terminating QEMU

PATCH Applied Igor Mammedov 2 participants 2 messages Oct 19, 2015 – Oct 20, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 file_ram_alloc: propagate error to caller instead of terminating QEMU

QEMU shouldn't exits from file_ram_alloc() if -mem-prealloc option is specified and "object_add memory-backend-file,..." fails allocation during memory hotplug.

Propagate error to a caller and let it decide what to do with allocation failure. That leaves QEMU alive if it can't create backend during hotplug time and kills QEMU at startup time if backends or initial memory were misconfigured/ too large.

---
 exec.c | 4 ----
 1 file changed, 4 deletions(-)
exec.c +0 -4
index 7d90a52..0aadd41 100644
@@ -1292,10 +1292,6 @@ static void *file_ram_alloc(RAMBlock *block,
     return area;
 
 error:
-    if (mem_prealloc) {
-        error_report("%s", error_get_pretty(*errp));
-        exit(1);
-    }
     return NULL;
 }
 #endif
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 19 lines · Igor Mammedov

QEMU shouldn't exits from file_ram_alloc() if -mem-prealloc option is specified and "object_add memory-backend-file,..." fails allocation during memory hotplug.

Propagate error to a caller and let it decide what to do with allocation failure. That leaves QEMU alive if it can't create backend during hotplug time and kills QEMU at startup time if backends or initial memory were misconfigured/ too large.

---
 exec.c | 4 ----
 1 file changed, 4 deletions(-)
exec.c +0 -0
index 7d90a52..0aadd41 100644

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

Quoted 10 lines
exec.c +0 -4
@@ -1292,10 +1292,6 @@ static void *file_ram_alloc(RAMBlock *block,
     return area;
 
 error:
-    if (mem_prealloc) {
-        error_report("%s", error_get_pretty(*errp));
-        exit(1);
-    }
     return NULL;
 }
 #endif

Queued, thanks.

Paolo