Skip to contentSkip to conversation

i386 / Introduce hypervisor lazy pinning hooks

PATCH In review [email protected] 1 participant 1 message Aug 11, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 14/14 i386 / Introduce hypervisor lazy pinning hooks

Xen uses lazy pinning of MM structures including the page table root and LDT, which requires hooks at context creation and destruction time to maintain the lazy list.

Patch-against: 2.6.13-rc5-mm1
Patch-keys: i386 mmu paravirt xen

include/asm-i386/mmu_context.h +5 -1
Index: linux-2.6.13/include/asm-i386/mmu_context.h
===================================================================
@@ -6,6 +6,7 @@
 #include <asm/atomic.h>
 #include <asm/pgalloc.h>
 #include <asm/tlbflush.h>
+#include <mach_mmu.h>
 
 /*
  * Used for LDT copy/destruction.
@@ -15,12 +16,14 @@
 	struct mm_struct * old_mm;
 	int retval = 0;
 
+	memset(&mm->context, 0, sizeof(mm->context));
 	init_MUTEX(&mm->context.sem);
-	mm->context.size = 0;
 	old_mm = current->mm;
 	if (old_mm && unlikely(old_mm->context.size > 0)) {
 		retval = copy_ldt(&mm->context, &old_mm->context);
 	}
+	if (retval == 0)
+		add_lazy_mm(mm);
 	return retval;
 }
 
@@ -31,6 +34,7 @@
 {
 	if (unlikely(mm->context.size))
 		destroy_ldt(mm);
+	del_lazy_mm(mm);
 }
 
 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
include/asm-i386/mach-default/mach_mmu.h +10 -0
Index: linux-2.6.13/include/asm-i386/mach-default/mach_mmu.h
===================================================================
@@ -0,0 +1,10 @@
+#ifndef __ASM_MACH_MMU_H
+#define __ASM_MACH_MMU_H
+
+/*
+ * Stub hooks for lazy hypervisor pinning.
+ */
+#define add_lazy_mm(_mm)
+#define del_lazy_mm(_mm)
+
+#endif