aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/numa.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-07-28 07:54:12 +0100
committerKeir Fraser <keir.fraser@citrix.com>2010-07-28 07:54:12 +0100
commit4dff228603baee05a142af732a4131d36d620248 (patch)
treeb278ccadc241d6f38e616a5b2341545c3819f33d /xen/arch/x86/numa.c
parent891c9ebad752ce367c9e639b8edb48aaba462338 (diff)
downloadxen-4dff228603baee05a142af732a4131d36d620248.tar.gz
xen-4dff228603baee05a142af732a4131d36d620248.tar.bz2
xen-4dff228603baee05a142af732a4131d36d620248.zip
Walking the page lists needs the page_alloc lock
There are a few places in Xen where we walk a domain's page lists without holding the page_alloc lock. They race with updates to the page lists, which are normally rare but can be quite common under PoD when the domain is close to its memory limit and the PoD reclaimer is busy. This patch protects those places by taking the page_alloc lock. I think this is OK for the two debug-key printouts - they don't run from irq context and look deadlock-free. The tboot change seems safe too unless tboot shutdown functions are called from irq context or with the page_alloc lock held. The p2m one is the scariest but there are already code paths in PoD that take the page_alloc lock with the p2m lock held so it's no worse than existing code. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Diffstat (limited to 'xen/arch/x86/numa.c')
-rw-r--r--xen/arch/x86/numa.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
index 466ff76db6..92c2f5b631 100644
--- a/xen/arch/x86/numa.c
+++ b/xen/arch/x86/numa.c
@@ -385,11 +385,13 @@ static void dump_numa(unsigned char key)
for_each_online_node(i)
page_num_node[i] = 0;
+ spin_lock(&d->page_alloc_lock);
page_list_for_each(page, &d->page_list)
{
i = phys_to_nid((paddr_t)page_to_mfn(page) << PAGE_SHIFT);
page_num_node[i]++;
}
+ spin_unlock(&d->page_alloc_lock);
for_each_online_node(i)
printk(" Node %u: %u\n", i, page_num_node[i]);