Skip to contentSkip to conversation

mm/vmalloc: Export purge_vmap_area_lazy()

PATCH In review Benjamin Herrenschmidt 3 participants 4 messages Mar 24, 2010 – Mar 25, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mm/vmalloc: Export purge_vmap_area_lazy()

Some powerpc code needs to ensure that all previous iounmap/vunmap has really been flushed out of the MMU hash table. Without that, various hotplug operations may fail when trying to return those pieces to the hypervisor due to existing active mappings.

This exports purge_vmap_area_lazy() to allow the powerpc code to perform that purge when unplugging devices.

---
 include/linux/vmalloc.h |    1 +
 mm/vmalloc.c            |    5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)

Nick, care to give me an Ack so I can get that upstream along with the next patch ASAP (and back into distros) ?

Thanks !
Ben.

include/linux/vmalloc.h +1 -0
index 227c2a5..0d0ae4e 100644
@@ -99,6 +99,7 @@ extern int map_kernel_range_noflush(unsigned long start, unsigned long size,
 				    pgprot_t prot, struct page **pages);
 extern void unmap_kernel_range_noflush(unsigned long addr, unsigned long size);
 extern void unmap_kernel_range(unsigned long addr, unsigned long size);
+extern void purge_vmap_area_lazy(void);
 
 /* Allocate/destroy a 'vmalloc' VM area. */
 extern struct vm_struct *alloc_vm_area(size_t size);
mm/vmalloc.c +2 -3
index ae00746..d25c741 100644
@@ -317,8 +317,6 @@ static void __insert_vmap_area(struct vmap_area *va)
 		list_add_rcu(&va->list, &vmap_area_list);
 }
 
-static void purge_vmap_area_lazy(void);
-
 /*
  * Allocate a region of KVA of the specified size and alignment, within the
  * vstart and vend.
@@ -590,12 +588,13 @@ static void try_purge_vmap_area_lazy(void)
 /*
  * Kick off a purge of the outstanding lazy areas.
  */
-static void purge_vmap_area_lazy(void)
+void purge_vmap_area_lazy(void)
 {
 	unsigned long start = ULONG_MAX, end = 0;
 
 	__purge_vmap_area_lazy(&start, &end, 1, 0);
 }
+EXPORT_SYMBOL_GPL(purge_vmap_area_lazy);
 
 /*
  * Free and unmap a vmap area, caller ensuring flush_cache_vunmap had been

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw
Quoted 7 lines · Benjamin Herrenschmidt

Some powerpc code needs to ensure that all previous iounmap/vunmap has really been flushed out of the MMU hash table. Without that, various hotplug operations may fail when trying to return those pieces to the hypervisor due to existing active mappings.

This exports purge_vmap_area_lazy() to allow the powerpc code to perform that purge when unplugging devices.

You want vm_unmap_aliases(), which also flushes entries in the per-cpu vmap allocator (and is already exported for other code that has similar problems).

Thanks,
Nick

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 4 lines

You want vm_unmap_aliases(), which also flushes entries in the per-cpu vmap allocator (and is already exported for other code that has similar problems).

Ok, I missed that one. I'll update my patch. Thanks.

Cheers,
Ben.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
In reply to Benjamin Herrenschmidt
Quoted 4 lines · Benjamin Herrenschmidt

Some powerpc code needs to ensure that all previous iounmap/vunmap has really been flushed out of the MMU hash table. Without that, various hotplug operations may fail when trying to return those pieces to the hypervisor due to existing active mappings.

Are you talking about KVM or any other hypervisor ?