From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LAjlZ-000740-74 for qemu-devel@nongnu.org; Thu, 11 Dec 2008 06:31:37 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LAjlW-00073Z-Sx for qemu-devel@nongnu.org; Thu, 11 Dec 2008 06:31:36 -0500 Received: from [199.232.76.173] (port=52677 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LAjlW-00073U-Lr for qemu-devel@nongnu.org; Thu, 11 Dec 2008 06:31:34 -0500 Received: from outbound-dub.frontbridge.com ([213.199.154.16]:45940 helo=IE1EHSOBE005.bigfish.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_MD5:16) (Exim 4.60) (envelope-from ) id 1LAjlW-0006WQ-6x for qemu-devel@nongnu.org; Thu, 11 Dec 2008 06:31:34 -0500 Message-ID: <4940FA16.30307@amd.com> Date: Thu, 11 Dec 2008 12:31:34 +0100 From: Andre Przywara MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040509060705050702040700" Subject: [Qemu-devel] [PATCH 3/3] NUMA: add monitor interface Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org, Avi Kivity --------------040509060705050702040700 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit This patch adds the new commands 'info numa' and 'numa' to the monitor. (See mail 0/3 for more details). Signed-off-by: Andre Przywara -- Andre Przywara AMD-Operating System Research Center (OSRC), Dresden, Germany Tel: +49 351 277-84917 ----to satisfy European Law for business letters: AMD Saxony Limited Liability Company & Co. KG, Wilschdorfer Landstr. 101, 01109 Dresden, Germany Register Court Dresden: HRA 4896, General Partner authorized to represent: AMD Saxony LLC (Wilmington, Delaware, US) General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy --------------040509060705050702040700 Content-Type: text/x-patch; name="qemunuma_monitor.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="qemunuma_monitor.patch" # HG changeset patch # User Andre Przywara # Date 1228992347 -3600 # Node ID c7ddfcb009edab9b72d500c488abc4c0f2312c56 # Parent 0501b7490a00ef7a77e69f846d332f797162052a add numa monitor support diff -r 0501b7490a00 -r c7ddfcb009ed monitor.c --- a/monitor.c Thu Dec 11 11:42:41 2008 +0100 +++ b/monitor.c Thu Dec 11 11:45:47 2008 +0100 @@ -39,6 +39,9 @@ #include "qemu-timer.h" #include "migration.h" #include "kvm.h" +#ifdef CONFIG_NUMA +#include +#endif //#define DEBUG //#define DEBUG_COMPLETION @@ -1281,6 +1284,52 @@ static void do_info_kvm(void) #endif } +static void do_info_numa(void) +{ +int i, j; + +#ifndef CONFIG_NUMA + term_printf("NUMA placement support: not compiled\n"); +#endif + term_printf("%d nodes\n", numnumanodes); + for (i = 0; i < numnumanodes; i++) { + term_printf ("node %d cpus:", i); + for (j = 0; j < 64; j++) + if (node_to_cpus[i] & (1ULL << j)) term_printf (" %d", j); + term_printf ("\n"); + term_printf ("node %d size: %" PRId64 " MB\n", i, node_mem[i] >> 20); + term_printf ("node %d host: ", i); + if (hostnodes[i] == (uint64_t)-1) term_printf ("*\n"); else + term_printf ("%" PRId64 "\n", hostnodes[i]); + } +} + +static void do_numa(const char *affinity) +{ +#ifdef CONFIG_NUMA +uint64_t newaff[MAX_NODES]; +int i; +unsigned long offset = 0; + + if (numnumanodes <= 0) term_printf ("No NUMA nodes defined.\n"); else + if (numa_available() == -1) term_printf ("Not a NUMA host.\n"); else + { + for (i = 0; i < numnumanodes; i++) newaff[i] = hostnodes[i]; + parse_numa_args (affinity, newaff, NULL, NULL, MAX_NODES, 0); + for (i = 0; i < numnumanodes; i++) { + if (newaff[i] != hostnodes[i]) { + hostnodes[i] = newaff[i]; + numa_tonode_memory (phys_ram_base + offset, node_mem[i], + hostnodes[i] % (numa_max_node() + 1)); + } + offset += node_mem[i]; + } + } +#else + term_printf ("NUMA host affinity support not compiled in\n"); +#endif +} + #ifdef CONFIG_PROFILER int64_t kqemu_time; @@ -1500,6 +1549,8 @@ static const term_cmd_t term_cmds[] = { "value", "set maximum speed (in bytes) for migrations" }, { "balloon", "i", do_balloon, "target", "request VM to change it's memory allocation (in MB)" }, + { "numa", "s", do_numa, + "affinity", "change NUMA affinity" }, { NULL, NULL, }, }; @@ -1538,6 +1589,8 @@ static const term_cmd_t info_cmds[] = { "", "show kqemu information", }, { "kvm", "", do_info_kvm, "", "show kvm information", }, + { "numa", "", do_info_numa, + "", "show NUMA information", }, { "usb", "", usb_info, "", "show guest USB devices", }, { "usbhost", "", usb_host_info, --------------040509060705050702040700--