aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-03-11 19:39:17 +0000
committerPeter Maydell <peter.maydell@linaro.org>2014-03-11 19:39:17 +0000
commit239618707637ec87eba8c452d2b2f75dc5ca20c7 (patch)
tree857da2ab713933e6c797d355726bae54c636e748 /exec.c
parent01207d0b78208c2f49c3f457d6794eea215d5be7 (diff)
parentb0f15a5d5628994c71a6f428f360a5a537ad3b39 (diff)
Merge remote-tracking branch 'remotes/kvm/uq/master' into staging
* remotes/kvm/uq/master: target-i386: bugfix of Intel MPX file_ram_alloc: unify mem-path,mem-prealloc error handling kvm-all: exit in case max vcpus exceeded Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/exec.c b/exec.c
index 680268a163..31ed3750aa 100644
--- a/exec.c
+++ b/exec.c
@@ -1029,7 +1029,7 @@ static void *file_ram_alloc(RAMBlock *block,
hpagesize = gethugepagesize(path);
if (!hpagesize) {
- return NULL;
+ goto error;
}
if (memory < hpagesize) {
@@ -1038,7 +1038,7 @@ static void *file_ram_alloc(RAMBlock *block,
if (kvm_enabled() && !kvm_has_sync_mmu()) {
fprintf(stderr, "host lacks kvm mmu notifiers, -mem-path unsupported\n");
- return NULL;
+ goto error;
}
/* Make name safe to use with mkstemp by replacing '/' with '_'. */
@@ -1056,7 +1056,7 @@ static void *file_ram_alloc(RAMBlock *block,
if (fd < 0) {
perror("unable to create backing store for hugepages");
g_free(filename);
- return NULL;
+ goto error;
}
unlink(filename);
g_free(filename);
@@ -1076,7 +1076,7 @@ static void *file_ram_alloc(RAMBlock *block,
if (area == MAP_FAILED) {
perror("file_ram_alloc: can't mmap RAM pages");
close(fd);
- return (NULL);
+ goto error;
}
if (mem_prealloc) {
@@ -1120,6 +1120,12 @@ static void *file_ram_alloc(RAMBlock *block,
block->fd = fd;
return area;
+
+error:
+ if (mem_prealloc) {
+ exit(1);
+ }
+ return NULL;
}
#else
static void *file_ram_alloc(RAMBlock *block,