[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [patch 2/2] qemu: add -mem-path-force option to force RAM a
From: |
Marcelo Tosatti |
Subject: |
[Qemu-devel] [patch 2/2] qemu: add -mem-path-force option to force RAM allocation via -mem-path |
Date: |
Mon, 07 Oct 2013 21:41:28 -0300 |
User-agent: |
quilt/0.60-1 |
Default behaviour is to fallback for standard RAM allocation if -mem-path
allocation fails.
Add an option to force -mem-path RAM allocation (failing otherwise).
Signed-off-by: Marcelo Tosatti <address@hidden>
Index: qemu/exec.c
===================================================================
--- qemu.orig/exec.c
+++ qemu/exec.c
@@ -985,6 +985,9 @@ static void *file_ram_alloc(RAMBlock *bl
if (area == MAP_FAILED) {
perror("file_ram_alloc: can't mmap RAM pages");
close(fd);
+ if (mem_path_force) {
+ exit(1);
+ }
return (NULL);
}
Index: qemu/vl.c
===================================================================
--- qemu.orig/vl.c
+++ qemu/vl.c
@@ -189,6 +189,7 @@ const char* keyboard_layout = NULL;
ram_addr_t ram_size;
const char *mem_path = NULL;
int mem_prealloc = 0; /* force preallocation of physical target memory */
+int mem_path_force = 0; /* quit in case -mem-path allocation fails */
int nb_nics;
NICInfo nd_table[MAX_NICS];
int autostart;
@@ -3203,6 +3204,9 @@ int main(int argc, char **argv, char **e
case QEMU_OPTION_mempath:
mem_path = optarg;
break;
+ case QEMU_OPTION_mempath_force:
+ mem_path_force = 1;
+ break;
case QEMU_OPTION_mem_prealloc:
mem_prealloc = 1;
break;
Index: qemu/include/exec/cpu-all.h
===================================================================
--- qemu.orig/include/exec/cpu-all.h
+++ qemu/include/exec/cpu-all.h
@@ -468,6 +468,7 @@ typedef struct RAMList {
extern RAMList ram_list;
extern const char *mem_path;
+extern int mem_path_force;
extern int mem_prealloc;
/* Flags stored in the low bits of the TLB virtual address. These are
Index: qemu/qemu-options.def
===================================================================
--- qemu.orig/qemu-options.def
+++ qemu/qemu-options.def
@@ -66,6 +66,9 @@ stringify(DEFAULT_RAM_SIZE) "]\n", QEMU_
DEF("mem-path", HAS_ARG, QEMU_OPTION_mempath,
"-mem-path FILE provide backing storage for guest RAM\n", QEMU_ARCH_ALL)
+DEF("mem-path-force", 0, QEMU_OPTION_mempath_force,
+"-mem-path-force fail if unable to allocate RAM as specified by
-mem-path\n", QEMU_ARCH_ALL)
+
DEF("mem-prealloc", 0, QEMU_OPTION_mem_prealloc,
"-mem-prealloc preallocate guest memory (use with -mem-path)\n",
QEMU_ARCH_ALL)
Index: qemu/qemu-options.hx
===================================================================
--- qemu.orig/qemu-options.hx
+++ qemu/qemu-options.hx
@@ -228,6 +228,14 @@ STEXI
Allocate guest RAM from a temporarily created file in @var{path}.
ETEXI
+DEF("mem-path-force", 0, QEMU_OPTION_mempath_force,
+ "-mem-path-force fail if unable to allocate RAM as specified by
-mem-path\n", QEMU_ARCH_ALL)
+STEXI
address@hidden -mem-path-force
address@hidden -mem-path-force
+Fail if unable to allocate RAM as specified by -mem-path.
+ETEXI
+
DEF("mem-prealloc", 0, QEMU_OPTION_mem_prealloc,
"-mem-prealloc preallocate guest memory (use with -mem-path)\n",
QEMU_ARCH_ALL)
- [Qemu-devel] [patch 0/2] force -mem-path RAM allocation, Marcelo Tosatti, 2013/10/07
- [Qemu-devel] [patch 2/2] qemu: add -mem-path-force option to force RAM allocation via -mem-path,
Marcelo Tosatti <=
- [Qemu-devel] [patch 1/2] qemu: mempath: prefault pages manually, Marcelo Tosatti, 2013/10/07
- Re: [Qemu-devel] [patch 1/2] qemu: mempath: prefault pages manually, Paolo Bonzini, 2013/10/08
- Re: [Qemu-devel] [patch 1/2] qemu: mempath: prefault pages manually, Marcelo Tosatti, 2013/10/08
- Re: [Qemu-devel] [patch 1/2] qemu: mempath: prefault pages manually, Paolo Bonzini, 2013/10/09
- Re: [Qemu-devel] [patch 1/2] qemu: mempath: prefault pages manually, Marcelo Tosatti, 2013/10/09
- Re: [Qemu-devel] [patch 1/2] qemu: mempath: prefault pages manually, Paolo Bonzini, 2013/10/09
- Re: [Qemu-devel] [patch 1/2] qemu: mempath: prefault pages manually, Paolo Bonzini, 2013/10/10
- Re: [Qemu-devel] [patch 1/2] qemu: mempath: prefault pages manually, Marcelo Tosatti, 2013/10/10
Re: [Qemu-devel] [patch 1/2] qemu: mempath: prefault pages manually, Paolo Bonzini, 2013/10/28