From: Andre Przywara Subject: [PATCH 2/3] NUMA: add parsing of host NUMA pin option Date: Wed, 23 Jun 2010 23:09:36 +0200 Message-ID: <1277327377-29629-3-git-send-email-andre.przywara@amd.com> References: <1277327377-29629-1-git-send-email-andre.przywara@amd.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , Andre Przywara To: Return-path: Received: from outbound-va3.frontbridge.com ([216.32.180.16]:11589 "EHLO VA3EHSOBE008.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753176Ab0FWVZx (ORCPT ); Wed, 23 Jun 2010 17:25:53 -0400 In-Reply-To: <1277327377-29629-1-git-send-email-andre.przywara@amd.com> Sender: kvm-owner@vger.kernel.org List-ID: 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 --- 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