|
Lazy pagetable and LDT switching was unsafe -- do them synchronously: msg#00446emulators.xen.cvs
ChangeSet 1.1389, 2005/03/29 15:52:44+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx 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@xxxxxxxxxxxxx> arch/xen/kernel/ldt.c | 2 -- arch/xen/kernel/process.c | 29 ----------------------------- arch/xen/mm/fault.c | 1 - include/asm-xen/mmu_context.h | 18 ++++-------------- 4 files changed, 4 insertions(+), 46 deletions(-) diff -Nru a/linux-2.4.29-xen-sparse/arch/xen/kernel/ldt.c b/linux-2.4.29-xen-sparse/arch/xen/kernel/ldt.c --- a/linux-2.4.29-xen-sparse/arch/xen/kernel/ldt.c 2005-03-29 10:02:38 -05:00 +++ b/linux-2.4.29-xen-sparse/arch/xen/kernel/ldt.c 2005-03-29 10:02:38 -05:00 @@ -117,8 +117,6 @@ void destroy_context(struct mm_struct *mm) { if (mm->context.size) { - if (mm_state_sync & STATE_SYNC_LDT) - clear_LDT(); make_pages_writable( mm->context.ldt, (mm->context.size*LDT_ENTRY_SIZE)/PAGE_SIZE); diff -Nru a/linux-2.4.29-xen-sparse/arch/xen/kernel/process.c b/linux-2.4.29-xen-sparse/arch/xen/kernel/process.c --- a/linux-2.4.29-xen-sparse/arch/xen/kernel/process.c 2005-03-29 10:02:38 -05:00 +++ b/linux-2.4.29-xen-sparse/arch/xen/kernel/process.c 2005-03-29 10:02:38 -05:00 @@ -305,35 +305,6 @@ struct thread_struct *next = &next_p->thread; physdev_op_t op; multicall_entry_t _mcl[8], *mcl = _mcl; - mmu_update_t _mmu[2], *mmu = _mmu; - - if ( mm_state_sync & STATE_SYNC_PT ) - { - mmu->ptr = virt_to_machine(cur_pgd) | MMU_EXTENDED_COMMAND; - mmu->val = MMUEXT_NEW_BASEPTR; - mmu++; - } - - if ( mm_state_sync & STATE_SYNC_LDT ) - { - __asm__ __volatile__ ( - "xorl %%eax,%%eax; movl %%eax,%%fs; movl %%eax,%%gs" : : : "eax" ); - mmu->ptr = (unsigned long)next_p->mm->context.ldt | - MMU_EXTENDED_COMMAND; - mmu->val = (next_p->mm->context.size << MMUEXT_CMD_SHIFT) | - MMUEXT_SET_LDT; - mmu++; - } - - if ( mm_state_sync != 0 ) - { - mcl->op = __HYPERVISOR_mmu_update; - mcl->args[0] = (unsigned long)_mmu; - mcl->args[1] = mmu - _mmu; - mcl->args[2] = 0; - mcl++; - mm_state_sync = 0; - } /* * This is basically 'unlazy_fpu', except that we queue a multicall to diff -Nru a/linux-2.4.29-xen-sparse/arch/xen/mm/fault.c b/linux-2.4.29-xen-sparse/arch/xen/mm/fault.c --- a/linux-2.4.29-xen-sparse/arch/xen/mm/fault.c 2005-03-29 10:02:38 -05:00 +++ b/linux-2.4.29-xen-sparse/arch/xen/mm/fault.c 2005-03-29 10:02:38 -05:00 @@ -28,7 +28,6 @@ extern void die(const char *,struct pt_regs *,long); pgd_t *cur_pgd; -int mm_state_sync; extern spinlock_t timerlist_lock; diff -Nru a/linux-2.4.29-xen-sparse/include/asm-xen/mmu_context.h b/linux-2.4.29-xen-sparse/include/asm-xen/mmu_context.h --- a/linux-2.4.29-xen-sparse/include/asm-xen/mmu_context.h 2005-03-29 10:02:38 -05:00 +++ b/linux-2.4.29-xen-sparse/include/asm-xen/mmu_context.h 2005-03-29 10:02:38 -05:00 @@ -28,9 +28,6 @@ #endif extern pgd_t *cur_pgd; -extern int mm_state_sync; -#define STATE_SYNC_PT 1 -#define STATE_SYNC_LDT 2 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk, unsigned cpu) { @@ -39,23 +36,16 @@ clear_bit(cpu, &prev->cpu_vm_mask); /* Re-load page tables */ cur_pgd = next->pgd; - mm_state_sync |= STATE_SYNC_PT; + xen_pt_switch(__pa(cur_pgd)); /* load_LDT, if either the previous or next thread * has a non-default LDT. */ if (next->context.size+prev->context.size) - mm_state_sync |= STATE_SYNC_LDT; + load_LDT(&next->context); } } -#define activate_mm(prev, next) \ -do { \ - switch_mm((prev),(next),NULL,smp_processor_id()); \ - if (mm_state_sync & STATE_SYNC_PT) \ - xen_pt_switch(__pa(cur_pgd)); \ - if (mm_state_sync & STATE_SYNC_LDT) \ - load_LDT(&(next)->context); \ - mm_state_sync = 0; \ -} while ( 0 ) +#define activate_mm(prev, next) \ + switch_mm((prev),(next),NULL,smp_processor_id()) #endif |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Remove per-cpu batch queues for mmu updates and multicalls. Instead: 00446, BitKeeper Bot |
|---|---|
| Next by Date: | Fix lazy state switching when context-switching to/from the idle: 00446, BitKeeper Bot |
| Previous by Thread: | Remove per-cpu batch queues for mmu updates and multicalls. Insteadi: 00446, BitKeeper Bot |
| Next by Thread: | Fix lazy state switching when context-switching to/from the idle: 00446, BitKeeper Bot |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |