[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V3 10/10] NUMA: show host memory policy info in info
From: |
Wanlong Gao |
Subject: |
[Qemu-devel] [PATCH V3 10/10] NUMA: show host memory policy info in info numa command |
Date: |
Mon, 24 Jun 2013 15:12:08 +0800 |
Show host memory policy of nodes in the info numa monitor command.
After this patch, the monitor command "info numa" will show the
information like following if the host numa support is enabled:
(qemu) info numa
2 nodes
node 0 cpus: 0
node 0 size: 1024 MB
node 0 mempolicy: membind=0,1
node 1 cpus: 1
node 1 size: 1024 MB
node 1 mempolicy: interleave=1
Signed-off-by: Wanlong Gao <address@hidden>
---
monitor.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/monitor.c b/monitor.c
index 61dbebb..b6e93e5 100644
--- a/monitor.c
+++ b/monitor.c
@@ -74,6 +74,11 @@
#endif
#include "hw/lm32/lm32_pic.h"
+#ifdef CONFIG_NUMA
+#include <numa.h>
+#include <numaif.h>
+#endif
+
//#define DEBUG
//#define DEBUG_COMPLETION
@@ -1807,6 +1812,7 @@ static void do_info_numa(Monitor *mon, const QDict *qdict)
int i;
CPUArchState *env;
CPUState *cpu;
+ unsigned long first, next;
monitor_printf(mon, "%d nodes\n", nb_numa_nodes);
for (i = 0; i < nb_numa_nodes; i++) {
@@ -1820,6 +1826,42 @@ static void do_info_numa(Monitor *mon, const QDict
*qdict)
monitor_printf(mon, "\n");
monitor_printf(mon, "node %d size: %" PRId64 " MB\n", i,
numa_info[i].node_mem >> 20);
+
+#ifdef CONFIG_NUMA
+ monitor_printf(mon, "node %d mempolicy: ", i);
+ switch (numa_info[i].flags & NODE_HOST_POLICY_MASK) {
+ case NODE_HOST_BIND:
+ monitor_printf(mon, "membind=");
+ break;
+ case NODE_HOST_INTERLEAVE:
+ monitor_printf(mon, "interleave=");
+ break;
+ case NODE_HOST_PREFERRED:
+ monitor_printf(mon, "preferred=");
+ break;
+ default:
+ monitor_printf(mon, "default\n");
+ continue;
+ }
+
+ if (numa_info[i].flags & NODE_HOST_RELATIVE)
+ monitor_printf(mon, "+");
+
+ next = first = find_first_bit(numa_info[i].host_mem, MAX_CPUMASK_BITS);
+ monitor_printf(mon, "%lu", first);
+ do {
+ if (next == numa_max_node())
+ break;
+ next = find_next_bit(numa_info[i].host_mem, MAX_CPUMASK_BITS,
+ next + 1);
+ if (next > numa_max_node() || next == MAX_CPUMASK_BITS)
+ break;
+
+ monitor_printf(mon, ",%lu", next);
+ } while (true);
+
+ monitor_printf(mon, "\n");
+#endif
}
}
--
1.8.3.1.448.gfb7dfaa
- [Qemu-devel] [PATCH V3 03/10] NUMA: Add Linux libnuma detection, (continued)
- [Qemu-devel] [PATCH V3 03/10] NUMA: Add Linux libnuma detection, Wanlong Gao, 2013/06/24
- [Qemu-devel] [PATCH V3 04/10] NUMA: parse guest numa nodes memory policy, Wanlong Gao, 2013/06/24
- [Qemu-devel] [PATCH V3 07/10] NUMA: set guest numa nodes memory policy, Wanlong Gao, 2013/06/24
- [Qemu-devel] [PATCH V3 09/10] NUMA: add hmp command set-mpol, Wanlong Gao, 2013/06/24
- [Qemu-devel] [PATCH V3 05/10] NUMA: handle Error in cpus, mpol and hostnode parser, Wanlong Gao, 2013/06/24
- [Qemu-devel] [PATCH V3 01/10] NUMA: Support multiple CPU ranges on -numa option, Wanlong Gao, 2013/06/24
- [Qemu-devel] [PATCH V3 06/10] NUMA: split out the common range parser, Wanlong Gao, 2013/06/24
- [Qemu-devel] [PATCH V3 08/10] NUMA: add qmp command set-mpol to set memory policy for NUMA node, Wanlong Gao, 2013/06/24
- [Qemu-devel] [PATCH V3 10/10] NUMA: show host memory policy info in info numa command,
Wanlong Gao <=