zach@vmware.com
2007-Apr-18 13:02 UTC
[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 Signed-off-by: Zachary Amsden <zach@vmware.com> Index: linux-2.6.13/include/asm-i386/mmu_context.h ==================================================================--- linux-2.6.13.orig/include/asm-i386/mmu_context.h 2005-08-10 17:06:52.000000000 -0700 +++ linux-2.6.13/include/asm-i386/mmu_context.h 2005-08-10 17:11:40.000000000 -0700 @@ -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) Index: linux-2.6.13/include/asm-i386/mach-default/mach_mmu.h ==================================================================--- linux-2.6.13.orig/include/asm-i386/mach-default/mach_mmu.h 2005-08-10 17:11:40.000000000 -0700 +++ linux-2.6.13/include/asm-i386/mach-default/mach_mmu.h 2005-08-10 17:11:40.000000000 -0700 @@ -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