diff mbox

[2/3] NUMA: add parsing of host NUMA pin option

Message ID 1277327377-29629-3-git-send-email-andre.przywara@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andre Przywara June 23, 2010, 9:09 p.m. UTC
None
diff mbox

Patch

diff --git a/sysemu.h b/sysemu.h
index 6018d97..1b3f77b 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -139,6 +139,7 @@  extern long hpagesize;
 extern int nb_numa_nodes;
 extern uint64_t node_mem[MAX_NODES];
 extern uint64_t node_cpumask[MAX_NODES];
+extern int node_pin[MAX_NODES];
 
 #define MAX_OPTION_ROMS 16
 extern const char *option_rom[MAX_OPTION_ROMS];
diff --git a/vl.c b/vl.c
index 0ee963c..02e0bed 100644
--- a/vl.c
+++ b/vl.c
@@ -234,6 +234,7 @@  int boot_menu;
 int nb_numa_nodes;
 uint64_t node_mem[MAX_NODES];
 uint64_t node_cpumask[MAX_NODES];
+int node_pin[MAX_NODES];
 
 static QEMUTimer *nographic_timer;
 
@@ -771,6 +772,22 @@  static void numa_add(const char *optarg)
             node_cpumask[nodenr] = value;
         }
         nb_numa_nodes++;
+    } else if (!strcmp(option, "pin")) {
+        if (get_param_value(option, 128, "nodeid", optarg) == 0) {
+            fprintf(stderr, "error: need nodeid for -numa pin,...\n");
+            exit(1);
+        } else {
+            nodenr = strtoull(option, NULL, 10);
+            if (nodenr >= nb_numa_nodes) {
+            	fprintf(stderr, "nodeid exceed specified NUMA nodes\n");
+            	exit(1);
+            }
+        }
+        if (get_param_value(option, 128, "host", optarg) == 0) {
+            node_pin[nodenr] = -1;
+        } else {
+            node_pin[nodenr] = strtoull(option, NULL, 10);
+        }
     }
     return;
 }
@@ -1873,6 +1890,7 @@  int main(int argc, char **argv, char **envp)
     for (i = 0; i < MAX_NODES; i++) {
         node_mem[i] = 0;
         node_cpumask[i] = 0;
+        node_pin[i] = -1;
     }
 
     assigned_devices_index = 0;