From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LChMl-0002zf-Ez for qemu-devel@nongnu.org; Tue, 16 Dec 2008 16:22:07 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LChMj-0002z7-JC for qemu-devel@nongnu.org; Tue, 16 Dec 2008 16:22:05 -0500 Received: from [199.232.76.173] (port=56712 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LChMj-0002z4-CS for qemu-devel@nongnu.org; Tue, 16 Dec 2008 16:22:05 -0500 Received: from yx-out-1718.google.com ([74.125.44.153]:23823) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LChMj-0005Nd-2V for qemu-devel@nongnu.org; Tue, 16 Dec 2008 16:22:05 -0500 Received: by yx-out-1718.google.com with SMTP id 3so1551476yxi.82 for ; Tue, 16 Dec 2008 13:22:04 -0800 (PST) Message-ID: <49481BE2.8080205@codemonkey.ws> Date: Tue, 16 Dec 2008 15:21:38 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <4947B91C.4050403@amd.com> In-Reply-To: <4947B91C.4050403@amd.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 7/8] v2: add numa monitor command Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andre Przywara Cc: qemu-devel@nongnu.org, Avi Kivity Andre Przywara wrote: > Signed-off-by: Andre Przywara > > # HG changeset patch > # User Andre Przywara > # Date 1229435568 -3600 > # Node ID 4f0a8ac2d88ffffc1dcd82785c1620553baa86da > # Parent 5a74bd76931b79713803795b3943aa8383946521 > add -numa monitor command to repin guest nodes > > diff -r 5a74bd76931b -r 4f0a8ac2d88f monitor.c > --- a/monitor.c Tue Dec 16 14:51:24 2008 +0100 > +++ b/monitor.c Tue Dec 16 14:52:48 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 > @@ -1285,6 +1288,9 @@ 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); > @@ -1292,7 +1298,40 @@ static void do_info_numa(void) > 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 > + { > This should be reformatted. > + for (i = 0; i < numnumanodes; i++) newaff[i] = hostnodes[i]; > This should be a separate line. > + 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]; > + if (hostnodes[i] == (uint64_t)-1) > I don't think using u64's for cpu=>node mappings is a reasonable thing to do at this stage. 64 processors systems are relatively common these days. > + numa_tonodemask_memory (phys_ram_base + offset, > + node_mem[i], &numa_all_nodes); > + else > + 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 > } Regards, Anthony Liguori