ia64/xen-unstable
changeset 4371:d58e731924a7
bitkeeper revision 1.1236.1.153 (42496bbcmDKIhBdeW5tCa1moqo8b-Q)
Lazy pagetable and LDT switching was unsafe -- do them synchronously
for now, and maybe think about batching across switch_mm and switch_to
in the future (particularly for 2.6, which we care about more than 2.4).
Signed-off-by: Keir Fraser <keir@xensource.com>
Lazy pagetable and LDT switching was unsafe -- do them synchronously
for now, and maybe think about batching across switch_mm and switch_to
in the future (particularly for 2.6, which we care about more than 2.4).
Signed-off-by: Keir Fraser <keir@xensource.com>
author | kaf24@firebug.cl.cam.ac.uk |
---|---|
date | Tue Mar 29 14:52:44 2005 +0000 (2005-03-29) |
parents | 9c722f0a8372 |
children | 8396f6da60b4 |
files | linux-2.4.29-xen-sparse/arch/xen/kernel/ldt.c linux-2.4.29-xen-sparse/arch/xen/kernel/process.c linux-2.4.29-xen-sparse/arch/xen/mm/fault.c linux-2.4.29-xen-sparse/include/asm-xen/mmu_context.h |
line diff
1.1 --- a/linux-2.4.29-xen-sparse/arch/xen/kernel/ldt.c Tue Mar 29 14:39:11 2005 +0000 1.2 +++ b/linux-2.4.29-xen-sparse/arch/xen/kernel/ldt.c Tue Mar 29 14:52:44 2005 +0000 1.3 @@ -117,8 +117,6 @@ int init_new_context(struct task_struct 1.4 void destroy_context(struct mm_struct *mm) 1.5 { 1.6 if (mm->context.size) { 1.7 - if (mm_state_sync & STATE_SYNC_LDT) 1.8 - clear_LDT(); 1.9 make_pages_writable( 1.10 mm->context.ldt, 1.11 (mm->context.size*LDT_ENTRY_SIZE)/PAGE_SIZE);
2.1 --- a/linux-2.4.29-xen-sparse/arch/xen/kernel/process.c Tue Mar 29 14:39:11 2005 +0000 2.2 +++ b/linux-2.4.29-xen-sparse/arch/xen/kernel/process.c Tue Mar 29 14:52:44 2005 +0000 2.3 @@ -305,35 +305,6 @@ void fastcall __switch_to(struct task_st 2.4 struct thread_struct *next = &next_p->thread; 2.5 physdev_op_t op; 2.6 multicall_entry_t _mcl[8], *mcl = _mcl; 2.7 - mmu_update_t _mmu[2], *mmu = _mmu; 2.8 - 2.9 - if ( mm_state_sync & STATE_SYNC_PT ) 2.10 - { 2.11 - mmu->ptr = virt_to_machine(cur_pgd) | MMU_EXTENDED_COMMAND; 2.12 - mmu->val = MMUEXT_NEW_BASEPTR; 2.13 - mmu++; 2.14 - } 2.15 - 2.16 - if ( mm_state_sync & STATE_SYNC_LDT ) 2.17 - { 2.18 - __asm__ __volatile__ ( 2.19 - "xorl %%eax,%%eax; movl %%eax,%%fs; movl %%eax,%%gs" : : : "eax" ); 2.20 - mmu->ptr = (unsigned long)next_p->mm->context.ldt | 2.21 - MMU_EXTENDED_COMMAND; 2.22 - mmu->val = (next_p->mm->context.size << MMUEXT_CMD_SHIFT) | 2.23 - MMUEXT_SET_LDT; 2.24 - mmu++; 2.25 - } 2.26 - 2.27 - if ( mm_state_sync != 0 ) 2.28 - { 2.29 - mcl->op = __HYPERVISOR_mmu_update; 2.30 - mcl->args[0] = (unsigned long)_mmu; 2.31 - mcl->args[1] = mmu - _mmu; 2.32 - mcl->args[2] = 0; 2.33 - mcl++; 2.34 - mm_state_sync = 0; 2.35 - } 2.36 2.37 /* 2.38 * This is basically 'unlazy_fpu', except that we queue a multicall to
3.1 --- a/linux-2.4.29-xen-sparse/arch/xen/mm/fault.c Tue Mar 29 14:39:11 2005 +0000 3.2 +++ b/linux-2.4.29-xen-sparse/arch/xen/mm/fault.c Tue Mar 29 14:52:44 2005 +0000 3.3 @@ -28,7 +28,6 @@ 3.4 extern void die(const char *,struct pt_regs *,long); 3.5 3.6 pgd_t *cur_pgd; 3.7 -int mm_state_sync; 3.8 3.9 extern spinlock_t timerlist_lock; 3.10
4.1 --- a/linux-2.4.29-xen-sparse/include/asm-xen/mmu_context.h Tue Mar 29 14:39:11 2005 +0000 4.2 +++ b/linux-2.4.29-xen-sparse/include/asm-xen/mmu_context.h Tue Mar 29 14:52:44 2005 +0000 4.3 @@ -28,9 +28,6 @@ static inline void enter_lazy_tlb(struct 4.4 #endif 4.5 4.6 extern pgd_t *cur_pgd; 4.7 -extern int mm_state_sync; 4.8 -#define STATE_SYNC_PT 1 4.9 -#define STATE_SYNC_LDT 2 4.10 4.11 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk, unsigned cpu) 4.12 { 4.13 @@ -39,23 +36,16 @@ static inline void switch_mm(struct mm_s 4.14 clear_bit(cpu, &prev->cpu_vm_mask); 4.15 /* Re-load page tables */ 4.16 cur_pgd = next->pgd; 4.17 - mm_state_sync |= STATE_SYNC_PT; 4.18 + xen_pt_switch(__pa(cur_pgd)); 4.19 /* load_LDT, if either the previous or next thread 4.20 * has a non-default LDT. 4.21 */ 4.22 if (next->context.size+prev->context.size) 4.23 - mm_state_sync |= STATE_SYNC_LDT; 4.24 + load_LDT(&next->context); 4.25 } 4.26 } 4.27 4.28 -#define activate_mm(prev, next) \ 4.29 -do { \ 4.30 - switch_mm((prev),(next),NULL,smp_processor_id()); \ 4.31 - if (mm_state_sync & STATE_SYNC_PT) \ 4.32 - xen_pt_switch(__pa(cur_pgd)); \ 4.33 - if (mm_state_sync & STATE_SYNC_LDT) \ 4.34 - load_LDT(&(next)->context); \ 4.35 - mm_state_sync = 0; \ 4.36 -} while ( 0 ) 4.37 +#define activate_mm(prev, next) \ 4.38 + switch_mm((prev),(next),NULL,smp_processor_id()) 4.39 4.40 #endif