Skip to contentSkip to conversation

[7210] added -numa cmdline parameter parser (Andre Przywara)

Qemu-devel Anthony Liguori 1 participant 1 message Apr 21, 2009

lore
Share & tools
lore
#0 lore raw

Revision: 7210

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7210
Author:   aliguori
Date:     2009-04-21 22:30:27 +0000 (Tue, 21 Apr 2009)

Log Message:
-----------
added -numa cmdline parameter parser (Andre Przywara)

adds a -numa command line parameter and sets a QEMU global array with the memory sizes. The CPU-to-node assignemnt is written into the CPUState. If no specific values for memory and CPUs are given, all resources will be split equally across all nodes.
This code currently support only up to 64 virtual CPUs.

Modified Paths:
--------------
trunk/cpu-defs.h
trunk/exec.c
trunk/qemu-options.hx
trunk/sysemu.h
trunk/vl.c

Modified: trunk/cpu-defs.h
===================================================================

cpu-defs.h +1 -0
@@ -205,6 +205,7 @@
                                                                         \
     CPUState *next_cpu; /* next CPU sharing TB cache */                 \
     int cpu_index; /* CPU index (informative) */                        \
+    int numa_node; /* NUMA node this cpu is belonging to  */            \
     int running; /* Nonzero if cpu is currently running(usermode).  */  \
     /* user data */                                                     \
     void *opaque;                                                       \

Modified: trunk/exec.c
===================================================================

exec.c +1 -0
@@ -554,6 +554,7 @@
         cpu_index++;
     }
     env->cpu_index = cpu_index;
+    env->numa_node = 0;
     TAILQ_INIT(&env->breakpoints);
     TAILQ_INIT(&env->watchpoints);
     *penv = env;

Modified: trunk/qemu-options.hx
===================================================================

qemu-options.hx +8 -0
@@ -47,6 +47,14 @@
 to 4.
 ETEXI
 
+DEF("numa", HAS_ARG, QEMU_OPTION_numa,
+    "-numa node[,mem=size][,cpus=cpu[-cpu]][,nodeid=node]\n")
+STEXI
+@item -numa @var{opts}
+Simulate a multi node NUMA system. If mem and cpus are omitted, resources
+are split equally.
+ETEXI
+
 DEF("fda", HAS_ARG, QEMU_OPTION_fda,
     "-fda/-fdb file  use 'file' as floppy disk 0/1 image\n")
 DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "")

Modified: trunk/sysemu.h
===================================================================

sysemu.h +5 -1
@@ -108,6 +108,10 @@
 extern int kqemu_allowed;
 #endif
 
+#define MAX_NODES 64
+extern int nb_numa_nodes;
+extern uint64_t node_mem[MAX_NODES];
+
 #define MAX_OPTION_ROMS 16
 extern const char *option_rom[MAX_OPTION_ROMS];
 extern int nb_option_roms;
@@ -248,7 +252,7 @@
 void do_usb_del(Monitor *mon, const char *devname);
 void usb_info(Monitor *mon);
 
-const char *get_opt_name(char *buf, int buf_size, const char *p);
+const char *get_opt_name(char *buf, int buf_size, const char *p, char delim);
 const char *get_opt_value(char *buf, int buf_size, const char *p);
 int get_param_value(char *buf, int buf_size,
                     const char *tag, const char *str);

Modified: trunk/vl.c
===================================================================

vl.c +129 -4

203 lines not on this page · raw message