[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V12 13/13] NUMA: convert hmp command info_numa t
From: |
Luiz Capitulino |
Subject: |
Re: [Qemu-devel] [PATCH V12 13/13] NUMA: convert hmp command info_numa to use qmp command query_numa |
Date: |
Tue, 10 Sep 2013 10:03:34 -0400 |
On Wed, 4 Sep 2013 17:03:42 +0800
Wanlong Gao <address@hidden> wrote:
> Signed-off-by: Wanlong Gao <address@hidden>
Looks good to me, but we probably want someone with numa
expertise to review it too:
Reviewed-by: Luiz Capitulino <address@hidden>
> ---
> 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 ae695b0..2d878c6 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_PREFERRED:
> + policy_str = g_strdup("preferred");
> + break;
> + case NUMA_NODE_POLICY_MEMBIND:
> + policy_str = g_strdup("membind");
> + break;
> + case NUMA_NODE_POLICY_INTERLEAVE:
> + policy_str = g_strdup("interleave");
> + 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 be34488..ce9dfe7 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -1995,25 +1995,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);
> - CPU_FOREACH(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;
> @@ -2781,7 +2762,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",
- [Qemu-devel] [PATCH V12 07/13] NUMA: expand MAX_NODES from 64 to 128, (continued)
- [Qemu-devel] [PATCH V12 07/13] NUMA: expand MAX_NODES from 64 to 128, Wanlong Gao, 2013/09/04
- [Qemu-devel] [PATCH V12 03/13] NUMA: Add numa_info structure to contain numa nodes info, Wanlong Gao, 2013/09/04
- [Qemu-devel] [PATCH V12 01/13] NUMA: move numa related code to new file numa.c, Wanlong Gao, 2013/09/04
- [Qemu-devel] [PATCH V12 04/13] NUMA: convert -numa option to use OptsVisitor, Wanlong Gao, 2013/09/04
- [Qemu-devel] [PATCH V12 12/13] NUMA: add qmp command query-numa, Wanlong Gao, 2013/09/04
- [Qemu-devel] [PATCH V12 10/13] NUMA: add qmp command set-mem-policy to set memory policy for NUMA node, Wanlong Gao, 2013/09/04
- [Qemu-devel] [PATCH V12 05/13] NUMA: introduce NumaMemOptions, Wanlong Gao, 2013/09/04
- [Qemu-devel] [PATCH V12 13/13] NUMA: convert hmp command info_numa to use qmp command query_numa, Wanlong Gao, 2013/09/04
- Re: [Qemu-devel] [PATCH V12 13/13] NUMA: convert hmp command info_numa to use qmp command query_numa,
Luiz Capitulino <=
- [Qemu-devel] [PATCH V12 08/13] NUMA: parse guest numa nodes memory policy, Wanlong Gao, 2013/09/04
- [Qemu-devel] [PATCH V12 11/13] NUMA: add hmp command set-mem-policy, Wanlong Gao, 2013/09/04
- Re: [Qemu-devel] [PATCH V12 00/13] Add support for binding guest numa nodes to host numa nodes, Wanlong Gao, 2013/09/09