ia64/xen-unstable

changeset 11813:de50245ad4e3

[IA64] micro optimize __domain_flush_vtlb_track_entry.

try to use local purge instead of global purge when possible.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author awilliam@xenbuild.aw
date Tue Oct 17 14:22:08 2006 -0600 (2006-10-17)
parents fd79ca20d91a
children 15fa2785ef1c
files xen/arch/ia64/xen/vhpt.c xen/include/asm-ia64/perfc_defn.h
line diff
     1.1 --- a/xen/arch/ia64/xen/vhpt.c	Tue Oct 17 14:16:19 2006 -0600
     1.2 +++ b/xen/arch/ia64/xen/vhpt.c	Tue Oct 17 14:22:08 2006 -0600
     1.3 @@ -381,7 +381,8 @@ void
     1.4  	struct vcpu* v;
     1.5  	int cpu;
     1.6  	int vcpu;
     1.7 -
     1.8 +	int local_purge = 1;
     1.9 +	
    1.10  	BUG_ON((vaddr >> VRN_SHIFT) != VRN7);
    1.11  	/*
    1.12  	 * heuristic:
    1.13 @@ -414,17 +415,35 @@ void
    1.14  
    1.15  			/* Invalidate VHPT entries.  */
    1.16  			vcpu_flush_vhpt_range(v, vaddr, PAGE_SIZE);
    1.17 +
    1.18 +			/*
    1.19 +			 * current->processor == v->processor
    1.20 +			 * is racy. we may see old v->processor and
    1.21 +			 * a new physical processor of v might see old
    1.22 +			 * vhpt entry and insert tlb.
    1.23 +			 */
    1.24 +			if (v != current)
    1.25 +				local_purge = 0;
    1.26  		}
    1.27  	} else {
    1.28  		for_each_cpu_mask(cpu, entry->pcpu_dirty_mask) {
    1.29  			/* Invalidate VHPT entries.  */
    1.30  			cpu_flush_vhpt_range(cpu, vaddr, PAGE_SIZE);
    1.31 +
    1.32 +			if (d->vcpu[cpu] != current)
    1.33 +				local_purge = 0;
    1.34  		}
    1.35  	}
    1.36 -	/* ptc.ga has release semantics. */
    1.37  
    1.38  	/* ptc.ga  */
    1.39 -	ia64_global_tlb_purge(vaddr, vaddr + PAGE_SIZE, PAGE_SHIFT);
    1.40 +	if (local_purge) {
    1.41 +		ia64_ptcl(vaddr, PAGE_SHIFT << 2);
    1.42 +		perfc_incrc(domain_flush_vtlb_local);
    1.43 +	} else {
    1.44 +		/* ptc.ga has release semantics. */
    1.45 +		ia64_global_tlb_purge(vaddr, vaddr + PAGE_SIZE, PAGE_SHIFT);
    1.46 +		perfc_incrc(domain_flush_vtlb_global);
    1.47 +	}
    1.48  
    1.49  	if (swap_rr0) {
    1.50  		vcpu_set_rr(current, 0, old_rid);
     2.1 --- a/xen/include/asm-ia64/perfc_defn.h	Tue Oct 17 14:16:19 2006 -0600
     2.2 +++ b/xen/include/asm-ia64/perfc_defn.h	Tue Oct 17 14:22:08 2006 -0600
     2.3 @@ -115,6 +115,8 @@ PERFCOUNTER_CPU(vcpu_flush_vtlb_all,    
     2.4  PERFCOUNTER_CPU(domain_flush_vtlb_all,          "domain_flush_vtlb_all")
     2.5  PERFCOUNTER_CPU(vcpu_flush_tlb_vhpt_range,      "vcpu_flush_tlb_vhpt_range")
     2.6  PERFCOUNTER_CPU(domain_flush_vtlb_track_entry,  "domain_flush_vtlb_track_entry")
     2.7 +PERFCOUNTER_CPU(domain_flush_vtlb_local,        "domain_flush_vtlb_local")
     2.8 +PERFCOUNTER_CPU(domain_flush_vtlb_global,       "domain_flush_vtlb_global")
     2.9  PERFCOUNTER_CPU(domain_flush_vtlb_range,        "domain_flush_vtlb_range")
    2.10  
    2.11  // domain.c