From 9ba3cf540fb902cbb40f0689868d51a2ac111852 Mon Sep 17 00:00:00 2001 From: Marcelo Tosatti Date: Tue, 25 Feb 2014 23:22:07 -0300 Subject: kvm-all: exit in case max vcpus exceeded Rather than fall back to TCG (so the user has to discover whats happening, in case of no access to qemu stdout/stderr). Signed-off-by: Marcelo Tosatti Signed-off-by: Paolo Bonzini --- kvm-all.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index fd8157ad5e..f299532e27 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1420,11 +1420,10 @@ int kvm_init(void) nc->name, nc->num, soft_vcpus_limit); if (nc->num > hard_vcpus_limit) { - ret = -EINVAL; fprintf(stderr, "Number of %s cpus requested (%d) exceeds " "the maximum cpus supported by KVM (%d)\n", nc->name, nc->num, hard_vcpus_limit); - goto err; + exit(1); } } nc++; -- cgit v1.2.3 From f9a49dfa0202348b543983d61fab441b7374a874 Mon Sep 17 00:00:00 2001 From: Marcelo Tosatti Date: Tue, 4 Feb 2014 13:41:53 -0500 Subject: file_ram_alloc: unify mem-path,mem-prealloc error handling -mem-prealloc asks to preallocate memory residing on -mem-path path. Currently QEMU exits in case: - Memory file has been created but allocation via explicit write fails. And it fallbacks to malloc in case: - Querying huge page size fails. - Lack of sync MMU support. - Open fails. - mmap fails. Have the same behaviour for all cases: fail in case -mem-path and -mem-prealloc are specified for regions where the requested size is suitable for hugepages. Signed-off-by: Marcelo Tosatti Signed-off-by: Paolo Bonzini --- exec.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/exec.c b/exec.c index b69fd295f9..f47b2b149e 100644 --- a/exec.c +++ b/exec.c @@ -1031,7 +1031,7 @@ static void *file_ram_alloc(RAMBlock *block, hpagesize = gethugepagesize(path); if (!hpagesize) { - return NULL; + goto error; } if (memory < hpagesize) { @@ -1040,7 +1040,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 '_'. */ @@ -1058,7 +1058,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); @@ -1078,7 +1078,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) { @@ -1122,6 +1122,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, -- cgit v1.2.3 From b0f15a5d5628994c71a6f428f360a5a537ad3b39 Mon Sep 17 00:00:00 2001 From: "Liu, Jinsong" Date: Mon, 3 Mar 2014 05:24:14 +0000 Subject: target-i386: bugfix of Intel MPX The correct size of cpuid 0x0d sub-leaf 4 is 0x40, not 0x10. This is confirmed by Anvin H Peter and Mallick Asit K. Signed-off-by: Liu Jinsong Cc: H. Peter Anvin Cc: Asit K Mallick Signed-off-by: Paolo Bonzini Signed-off-by: Liu, Jinsong --- target-i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 0e8812a11d..9f69d7e192 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -339,7 +339,7 @@ static const ExtSaveArea ext_save_areas[] = { [3] = { .feature = FEAT_7_0_EBX, .bits = CPUID_7_0_EBX_MPX, .offset = 0x3c0, .size = 0x40 }, [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) -- cgit v1.2.3