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>
This commit is contained in:
Peter Maydell 2014-03-11 19:39:17 +00:00
commit 2396187076
3 changed files with 12 additions and 7 deletions

14
exec.c
View File

@ -1029,7 +1029,7 @@ static void *file_ram_alloc(RAMBlock *block,
hpagesize = gethugepagesize(path); hpagesize = gethugepagesize(path);
if (!hpagesize) { if (!hpagesize) {
return NULL; goto error;
} }
if (memory < hpagesize) { if (memory < hpagesize) {
@ -1038,7 +1038,7 @@ static void *file_ram_alloc(RAMBlock *block,
if (kvm_enabled() && !kvm_has_sync_mmu()) { if (kvm_enabled() && !kvm_has_sync_mmu()) {
fprintf(stderr, "host lacks kvm mmu notifiers, -mem-path unsupported\n"); 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 '_'. */ /* Make name safe to use with mkstemp by replacing '/' with '_'. */
@ -1056,7 +1056,7 @@ static void *file_ram_alloc(RAMBlock *block,
if (fd < 0) { if (fd < 0) {
perror("unable to create backing store for hugepages"); perror("unable to create backing store for hugepages");
g_free(filename); g_free(filename);
return NULL; goto error;
} }
unlink(filename); unlink(filename);
g_free(filename); g_free(filename);
@ -1076,7 +1076,7 @@ static void *file_ram_alloc(RAMBlock *block,
if (area == MAP_FAILED) { if (area == MAP_FAILED) {
perror("file_ram_alloc: can't mmap RAM pages"); perror("file_ram_alloc: can't mmap RAM pages");
close(fd); close(fd);
return (NULL); goto error;
} }
if (mem_prealloc) { if (mem_prealloc) {
@ -1120,6 +1120,12 @@ static void *file_ram_alloc(RAMBlock *block,
block->fd = fd; block->fd = fd;
return area; return area;
error:
if (mem_prealloc) {
exit(1);
}
return NULL;
} }
#else #else
static void *file_ram_alloc(RAMBlock *block, static void *file_ram_alloc(RAMBlock *block,

View File

@ -1423,11 +1423,10 @@ int kvm_init(QEMUMachine *machine)
nc->name, nc->num, soft_vcpus_limit); nc->name, nc->num, soft_vcpus_limit);
if (nc->num > hard_vcpus_limit) { if (nc->num > hard_vcpus_limit) {
ret = -EINVAL;
fprintf(stderr, "Number of %s cpus requested (%d) exceeds " fprintf(stderr, "Number of %s cpus requested (%d) exceeds "
"the maximum cpus supported by KVM (%d)\n", "the maximum cpus supported by KVM (%d)\n",
nc->name, nc->num, hard_vcpus_limit); nc->name, nc->num, hard_vcpus_limit);
goto err; exit(1);
} }
} }
nc++; nc++;

View File

@ -339,7 +339,7 @@ static const ExtSaveArea ext_save_areas[] = {
[3] = { .feature = FEAT_7_0_EBX, .bits = CPUID_7_0_EBX_MPX, [3] = { .feature = FEAT_7_0_EBX, .bits = CPUID_7_0_EBX_MPX,
.offset = 0x3c0, .size = 0x40 }, .offset = 0x3c0, .size = 0x40 },
[4] = { .feature = FEAT_7_0_EBX, .bits = CPUID_7_0_EBX_MPX, [4] = { .feature = FEAT_7_0_EBX, .bits = CPUID_7_0_EBX_MPX,
.offset = 0x400, .size = 0x10 }, .offset = 0x400, .size = 0x40 },
}; };
const char *get_register_name_32(unsigned int reg) const char *get_register_name_32(unsigned int reg)