linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* vm_unmap_aliases and Xen
@ 2008-10-23 23:48 Jeremy Fitzhardinge
  2008-10-28  5:19 ` Nick Piggin
  0 siblings, 1 reply; 9+ messages in thread
From: Jeremy Fitzhardinge @ 2008-10-23 23:48 UTC (permalink / raw)
  To: Nick Piggin; +Cc: Linux Kernel Mailing List, Linux Memory Management List

I've been having a few problems with Xen, I suspect as a result of the 
lazy unmapping in vmalloc.c.

One immediate one is that vm_unmap_aliases() will oops if you call it 
before vmalloc_init() is called, which can happen in the Xen case.  RFC 
patch below.

But the bigger problem I'm seeing is that despite calling 
vm_unmap_aliases() at the pertinent places, I'm still seeing errors 
resulting from stray aliases.  Is it possible that vm_unmap_aliases() 
could be missing some, or not completely synchronous?

Subject: vmap: cope with vm_unmap_aliases before vmalloc_init()

Xen can end up calling vm_unmap_aliases() before vmalloc_init() has
been called.  In this case its safe to make it a simple no-op.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
diff -r 42c8b29f7ccf mm/vmalloc.c
--- a/mm/vmalloc.c	Wed Oct 22 12:43:39 2008 -0700
+++ b/mm/vmalloc.c	Wed Oct 22 21:39:00 2008 -0700
@@ -591,6 +591,8 @@
 
 #define VMAP_BLOCK_SIZE		(VMAP_BBMAP_BITS * PAGE_SIZE)
 
+static bool vmap_initialized = false;
+
 struct vmap_block_queue {
 	spinlock_t lock;
 	struct list_head free;
@@ -827,6 +829,9 @@
 	int cpu;
 	int flush = 0;
 
+	if (!vmap_initialized)
+		return;
+
 	for_each_possible_cpu(cpu) {
 		struct vmap_block_queue *vbq = &per_cpu(vmap_block_queue, cpu);
 		struct vmap_block *vb;
@@ -940,6 +945,8 @@
 		INIT_LIST_HEAD(&vbq->dirty);
 		vbq->nr_dirty = 0;
 	}
+
+	vmap_initialized = true;
 }
 
 void unmap_kernel_range(unsigned long addr, unsigned long size)



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-11-06 14:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-23 23:48 vm_unmap_aliases and Xen Jeremy Fitzhardinge
2008-10-28  5:19 ` Nick Piggin
2008-10-28  8:04   ` Jeremy Fitzhardinge
2008-10-28  8:22   ` [PATCH 1/2] vmap: cope with vm_unmap_aliases before vmalloc_init() Jeremy Fitzhardinge
2008-11-05 18:52     ` Jeremy Fitzhardinge
2008-11-06 10:02       ` Ingo Molnar
2008-11-06 10:41         ` Nick Piggin
2008-11-06 14:51           ` Ingo Molnar
2008-10-28  8:23   ` [PATCH 2/2] xen: make sure stray alias mappings are gone before pinning Jeremy Fitzhardinge

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).