From 2765f0bf9f8c65ce43c5e8cfc4d08cd32b90180d Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Tue, 5 Aug 2008 09:28:24 +0100 Subject: [PATCH] x86: debug key prints memory node info of each domain This patch will collect memory location (the domain has how many pages in different node) of each domain and display if you input debug key. Signed-off-by: Zhou Ting --- xen/arch/x86/numa.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c index ab3050b3e6..0debd987bc 100644 --- a/xen/arch/x86/numa.c +++ b/xen/arch/x86/numa.c @@ -14,6 +14,7 @@ #include #include #include +#include static int numa_setup(char *s); custom_param("numa", numa_setup); @@ -281,6 +282,9 @@ static void dump_numa(unsigned char key) { s_time_t now = NOW(); int i; + struct domain *d; + struct page_info *page; + unsigned int page_num_node[MAX_NUMNODES]; printk("'%c' pressed -> dumping numa info (now-0x%X:%08X)\n", key, (u32)(now>>32), (u32)now); @@ -297,6 +301,28 @@ static void dump_numa(unsigned char key) } for_each_online_cpu(i) printk("CPU%d -> NODE%d\n", i, cpu_to_node[i]); + + rcu_read_lock(&domlist_read_lock); + + printk("Memory location of each domain:\n"); + for_each_domain(d) + { + printk("Domain %u (total: %u):\n", d->domain_id, d->tot_pages); + + for_each_online_node(i) + page_num_node[i] = 0; + + list_for_each_entry(page, &d->page_list, list) + { + i = phys_to_nid(page_to_mfn(page) << PAGE_SHIFT); + page_num_node[i]++; + } + + for_each_online_node(i) + printk(" Node %u: %u\n", i, page_num_node[i]); + } + + rcu_read_unlock(&domlist_read_lock); } static __init int register_numa_trigger(void) -- 2.30.2