ia64/xen-unstable

changeset 5549:e1627c8b4e45

bitkeeper revision 1.1731 (42ba7ea7qvujqMf6s6vK-pJzJhkEBA)

The attached patch replaces the three hypercalls with a signle
multi-call in switch_mm, as x86 xenlinux does.

Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Jun 23 09:19:35 2005 +0000 (2005-06-23)
parents d5eaab0c875d
children 25ceeee71ab6
files linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/mmu_context.h
line diff
     1.1 --- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/mmu_context.h	Thu Jun 23 09:15:41 2005 +0000
     1.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/mmu_context.h	Thu Jun 23 09:19:35 2005 +0000
     1.3 @@ -33,20 +33,40 @@ static inline void switch_mm(struct mm_s
     1.4  			     struct task_struct *tsk)
     1.5  {
     1.6  	unsigned cpu = smp_processor_id();
     1.7 +	struct mmuext_op _op[3], *op = _op;
     1.8 +
     1.9  	if (likely(prev != next)) {
    1.10  		/* stop flush ipis for the previous mm */
    1.11  		clear_bit(cpu, &prev->cpu_vm_mask);
    1.12 -#ifdef CONFIG_SMP
    1.13 +#if 0  /* XEN: no lazy tlb */
    1.14  		write_pda(mmu_state, TLBSTATE_OK);
    1.15  		write_pda(active_mm, next);
    1.16  #endif
    1.17  		set_bit(cpu, &next->cpu_vm_mask);
    1.18 -                load_cr3(next->pgd);
    1.19 -                xen_new_user_pt(__pa(__user_pgd(next->pgd)));
    1.20 -		if (unlikely(next->context.ldt != prev->context.ldt)) 
    1.21 -			load_LDT_nolock(&next->context, cpu);
    1.22 +
    1.23 +		/* load_cr3(next->pgd) */
    1.24 +		per_cpu(cur_pgd, smp_processor_id()) = next->pgd;
    1.25 +		op->cmd = MMUEXT_NEW_BASEPTR;
    1.26 +		op->mfn = pfn_to_mfn(__pa(next->pgd) >> PAGE_SHIFT);
    1.27 +		op++;
    1.28 +
    1.29 +		/* xen_new_user_pt(__pa(__user_pgd(next->pgd))) */
    1.30 +		op->cmd = MMUEXT_NEW_USER_BASEPTR;
    1.31 +		op->mfn = pfn_to_mfn(__pa(__user_pgd(next->pgd)) >> PAGE_SHIFT);
    1.32 +		op++;
    1.33 +		
    1.34 +		if (unlikely(next->context.ldt != prev->context.ldt)) {
    1.35 +			/* load_LDT_nolock(&next->context, cpu) */
    1.36 +			op->cmd = MMUEXT_SET_LDT;
    1.37 +			op->linear_addr = (unsigned long)next->context.ldt;
    1.38 +			op->nr_ents     = next->context.size;
    1.39 +			op++;
    1.40 +		}
    1.41 +
    1.42 +		BUG_ON(HYPERVISOR_mmuext_op(_op, op-_op, NULL, DOMID_SELF));
    1.43  	}
    1.44 -#ifdef CONFIG_SMP
    1.45 +
    1.46 +#if 0 /* XEN: no lazy tlb */
    1.47  	else {
    1.48  		write_pda(mmu_state, TLBSTATE_OK);
    1.49  		if (read_pda(active_mm) != next)