Introduce another variant of QEMU's -numa option to allow host node pinning. This was separated from the guest relevant configuration to make it cleaner to use, especially for management applications. The syntax is -numa pin,nodeid=n,host=m to assign the guest node n to host node m. Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx> --- sysemu.h | 1 + vl.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 0 deletions(-) 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; -- 1.6.4 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html