From: Wanlong Gao <gaowanlong@cn.fujitsu.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, ehabkost@redhat.com, lersek@redhat.com,
peter.huangpeng@huawei.com, lcapitulino@redhat.com,
drjones@redhat.com, bsd@redhat.com, hutao@cn.fujitsu.com,
y-goto@jp.fujitsu.com, pbonzini@redhat.com, afaerber@suse.de,
gaowanlong@cn.fujitsu.com
Subject: [Qemu-devel] [PATCH V9 12/12] NUMA: convert hmp command info_numa to use qmp command query_numa
Date: Fri, 23 Aug 2013 12:10:03 +0800 [thread overview]
Message-ID: <1377231003-2816-13-git-send-email-gaowanlong@cn.fujitsu.com> (raw)
In-Reply-To: <1377231003-2816-1-git-send-email-gaowanlong@cn.fujitsu.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
---
hmp.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
hmp.h | 1 +
monitor.c | 21 +--------------------
3 files changed, 56 insertions(+), 20 deletions(-)
diff --git a/hmp.c b/hmp.c
index 98d2a76..3b2f04d 100644
--- a/hmp.c
+++ b/hmp.c
@@ -27,6 +27,7 @@
#include "qapi-visit.h"
#include "qapi/opts-visitor.h"
#include "qapi/dealloc-visitor.h"
+#include "sysemu/sysemu.h"
static void hmp_handle_error(Monitor *mon, Error **errp)
{
@@ -1579,3 +1580,56 @@ error:
hmp_handle_error(mon, &local_err);
}
+
+void hmp_info_numa(Monitor *mon, const QDict *qdict)
+{
+ NUMAInfoList *node_list, *node;
+ uint16List *head;
+ int nodeid;
+ char *policy_str = NULL;
+
+ node_list = qmp_query_numa(NULL);
+
+ monitor_printf(mon, "%d nodes\n", nb_numa_nodes);
+ for (node = node_list; node; node = node->next) {
+ nodeid = node->value->nodeid;
+ monitor_printf(mon, "node %d cpus:", nodeid);
+ head = node->value->cpus;
+ for (head = node->value->cpus; head != NULL; head = head->next) {
+ monitor_printf(mon, " %d", (int)head->value);
+ }
+ monitor_printf(mon, "\n");
+ monitor_printf(mon, "node %d size: %" PRId64 " MB\n",
+ nodeid, node->value->memory >> 20);
+ switch (node->value->policy) {
+ case NUMA_NODE_POLICY_DEFAULT:
+ policy_str = g_strdup("default");
+ break;
+ case NUMA_NODE_POLICY_MEMBIND:
+ policy_str = g_strdup("membind");
+ break;
+ case NUMA_NODE_POLICY_INTERLEAVE:
+ policy_str = g_strdup("interleave");
+ break;
+ case NUMA_NODE_POLICY_PREFERRED:
+ policy_str = g_strdup("preferred");
+ break;
+ default:
+ break;
+ }
+ monitor_printf(mon, "node %d policy: %s\n",
+ nodeid, policy_str ? : " ");
+ if (policy_str) {
+ free(policy_str);
+ }
+ monitor_printf(mon, "node %d relative: %s\n", nodeid,
+ node->value->relative ? "true" : "false");
+ monitor_printf(mon, "node %d host-nodes:", nodeid);
+ for (head = node->value->host_nodes; head != NULL; head = head->next) {
+ monitor_printf(mon, " %d", (int)head->value);
+ }
+ monitor_printf(mon, "\n");
+ }
+
+ qapi_free_NUMAInfoList(node_list);
+}
diff --git a/hmp.h b/hmp.h
index ae09525..56a5efd 100644
--- a/hmp.h
+++ b/hmp.h
@@ -37,6 +37,7 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict);
void hmp_info_pci(Monitor *mon, const QDict *qdict);
void hmp_info_block_jobs(Monitor *mon, const QDict *qdict);
void hmp_info_tpm(Monitor *mon, const QDict *qdict);
+void hmp_info_numa(Monitor *mon, const QDict *qdict);
void hmp_quit(Monitor *mon, const QDict *qdict);
void hmp_stop(Monitor *mon, const QDict *qdict);
void hmp_system_reset(Monitor *mon, const QDict *qdict);
diff --git a/monitor.c b/monitor.c
index 343f9f4..712435c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1811,25 +1811,6 @@ static void do_info_mtree(Monitor *mon, const QDict *qdict)
mtree_info((fprintf_function)monitor_printf, mon);
}
-static void do_info_numa(Monitor *mon, const QDict *qdict)
-{
- int i;
- CPUState *cpu;
-
- monitor_printf(mon, "%d nodes\n", nb_numa_nodes);
- for (i = 0; i < nb_numa_nodes; i++) {
- monitor_printf(mon, "node %d cpus:", i);
- for (cpu = first_cpu; cpu != NULL; cpu = cpu->next_cpu) {
- if (cpu->numa_node == i) {
- monitor_printf(mon, " %d", cpu->cpu_index);
- }
- }
- monitor_printf(mon, "\n");
- monitor_printf(mon, "node %d size: %" PRId64 " MB\n", i,
- numa_info[i].node_mem >> 20);
- }
-}
-
#ifdef CONFIG_PROFILER
int64_t qemu_time;
@@ -2597,7 +2578,7 @@ static mon_cmd_t info_cmds[] = {
.args_type = "",
.params = "",
.help = "show NUMA information",
- .mhandler.cmd = do_info_numa,
+ .mhandler.cmd = hmp_info_numa,
},
{
.name = "usb",
--
1.8.4.rc4
prev parent reply other threads:[~2013-08-23 4:11 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-23 4:09 [Qemu-devel] [PATCH V9 00/12] Add support for binding guest numa nodes to host numa nodes Wanlong Gao
2013-08-23 4:09 ` [Qemu-devel] [PATCH V9 01/12] NUMA: add NumaOptions, NumaNodeOptions and NumaMemOptions Wanlong Gao
2013-08-23 4:09 ` [Qemu-devel] [PATCH V9 02/12] NUMA: split -numa option Wanlong Gao
2013-08-23 4:09 ` [Qemu-devel] [PATCH V9 03/12] NUMA: check if the total numa memory size is equal to ram_size Wanlong Gao
2013-08-23 4:09 ` [Qemu-devel] [PATCH V9 04/12] NUMA: move numa related code to numa.c Wanlong Gao
2013-08-23 4:09 ` [Qemu-devel] [PATCH V9 05/12] NUMA: Add numa_info structure to contain numa nodes info Wanlong Gao
2013-08-23 4:09 ` [Qemu-devel] [PATCH V9 06/12] NUMA: Add Linux libnuma detection Wanlong Gao
2013-08-23 8:40 ` Andrew Jones
2013-08-26 1:43 ` Wanlong Gao
2013-08-26 7:46 ` Andrew Jones
2013-08-26 8:16 ` Wanlong Gao
2013-08-26 8:43 ` Andrew Jones
2013-08-28 13:44 ` Paolo Bonzini
2013-08-29 2:22 ` Wanlong Gao
2013-08-29 8:15 ` Andrew Jones
2013-08-29 8:31 ` Andrew Jones
2013-08-23 4:09 ` [Qemu-devel] [PATCH V9 07/12] NUMA: parse guest numa nodes memory policy Wanlong Gao
2013-08-23 14:11 ` Andrew Jones
2013-08-26 1:07 ` Wanlong Gao
2013-08-26 7:12 ` Andrew Jones
2013-08-23 4:09 ` [Qemu-devel] [PATCH V9 08/12] NUMA: set " Wanlong Gao
2013-08-23 8:44 ` Andrew Jones
2013-08-23 4:10 ` [Qemu-devel] [PATCH V9 09/12] NUMA: add qmp command set-mem-policy to set memory policy for NUMA node Wanlong Gao
2013-08-23 4:10 ` [Qemu-devel] [PATCH V9 10/12] NUMA: add hmp command set-mem-policy Wanlong Gao
2013-08-23 4:10 ` [Qemu-devel] [PATCH V9 11/12] NUMA: add qmp command query-numa Wanlong Gao
2013-08-23 4:10 ` Wanlong Gao [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1377231003-2816-13-git-send-email-gaowanlong@cn.fujitsu.com \
--to=gaowanlong@cn.fujitsu.com \
--cc=afaerber@suse.de \
--cc=aliguori@us.ibm.com \
--cc=bsd@redhat.com \
--cc=drjones@redhat.com \
--cc=ehabkost@redhat.com \
--cc=hutao@cn.fujitsu.com \
--cc=lcapitulino@redhat.com \
--cc=lersek@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=y-goto@jp.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).