From: Zachary Amsden 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. Signed-off-by: Zachary Amsden Signed-off-by: Andrew Morton --- include/asm-i386/mach-default/mach_mmu.h | 10 ++++++++++ include/asm-i386/mmu_context.h | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff -puN include/asm-i386/mach-default/mach_mmu.h~i386--introduce-hypervisor-lazy-pinning-hooks include/asm-i386/mach-default/mach_mmu.h --- 25/include/asm-i386/mach-default/mach_mmu.h~i386--introduce-hypervisor-lazy-pinning-hooks Wed Aug 17 13:34:04 2005 +++ 25-akpm/include/asm-i386/mach-default/mach_mmu.h Wed Aug 17 13:34:04 2005 @@ -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 diff -puN include/asm-i386/mmu_context.h~i386--introduce-hypervisor-lazy-pinning-hooks include/asm-i386/mmu_context.h --- 25/include/asm-i386/mmu_context.h~i386--introduce-hypervisor-lazy-pinning-hooks Wed Aug 17 13:34:04 2005 +++ 25-akpm/include/asm-i386/mmu_context.h Wed Aug 17 13:34:04 2005 @@ -6,6 +6,7 @@ #include #include #include +#include /* * Used for LDT copy/destruction. @@ -15,12 +16,14 @@ static inline int init_new_context(struc 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 @@ static inline void destroy_context(struc { 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) _