ia64/xen-unstable

changeset 10927:3d6c1af609bf

[IA64] Convert some stats to perfc.

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Thu Aug 03 11:21:34 2006 -0600 (2006-08-03)
parents 147144f9ec51
children e7394daf098d
files xen/arch/ia64/asm-offsets.c xen/arch/ia64/xen/domain.c xen/arch/ia64/xen/faults.c xen/arch/ia64/xen/hypercall.c xen/arch/ia64/xen/hyperprivop.S xen/arch/ia64/xen/privop_stat.c xen/arch/ia64/xen/vcpu.c xen/include/asm-ia64/perfc_defn.h xen/include/asm-ia64/privop_stat.h
line diff
     1.1 --- a/xen/arch/ia64/asm-offsets.c	Thu Aug 03 11:10:53 2006 -0600
     1.2 +++ b/xen/arch/ia64/asm-offsets.c	Thu Aug 03 11:21:34 2006 -0600
     1.3 @@ -211,4 +211,9 @@ void foo(void)
     1.4  	DEFINE(IA64_KR_IO_BASE_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_IO_BASE]));
     1.5  	DEFINE(IA64_KR_CURRENT_STACK_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_CURRENT_STACK]));
     1.6  
     1.7 +#ifdef PERF_COUNTERS
     1.8 +	BLANK();
     1.9 +	DEFINE(RECOVER_TO_PAGE_FAULT_PERFC_OFS, offsetof (struct perfcounter, recover_to_page_fault));
    1.10 +	DEFINE(RECOVER_TO_BREAK_FAULT_PERFC_OFS, offsetof (struct perfcounter, recover_to_break_fault));
    1.11 +#endif
    1.12  }
     2.1 --- a/xen/arch/ia64/xen/domain.c	Thu Aug 03 11:10:53 2006 -0600
     2.2 +++ b/xen/arch/ia64/xen/domain.c	Thu Aug 03 11:21:34 2006 -0600
     2.3 @@ -136,7 +136,7 @@ void context_switch(struct vcpu *prev, s
     2.4      uint64_t pta;
     2.5  
     2.6      local_irq_save(spsr);
     2.7 -    context_switch_count++;
     2.8 +    perfc_incrc(context_switch);
     2.9  
    2.10      __ia64_save_fpu(prev->arch._thread.fph);
    2.11      __ia64_load_fpu(next->arch._thread.fph);
     3.1 --- a/xen/arch/ia64/xen/faults.c	Thu Aug 03 11:10:53 2006 -0600
     3.2 +++ b/xen/arch/ia64/xen/faults.c	Thu Aug 03 11:21:34 2006 -0600
     3.3 @@ -170,7 +170,7 @@ handle_lazy_cover(struct vcpu *v, struct
     3.4  		PSCB(v,ifs) = regs->cr_ifs;
     3.5  		PSCB(v,incomplete_regframe) = 1;
     3.6  		regs->cr_ifs = 0;
     3.7 -		lazy_cover_count++;
     3.8 +		perfc_incrc(lazy_cover);
     3.9  		return(1); // retry same instruction with cr.ifs off
    3.10  	}
    3.11  	return(0);
     4.1 --- a/xen/arch/ia64/xen/hypercall.c	Thu Aug 03 11:10:53 2006 -0600
     4.2 +++ b/xen/arch/ia64/xen/hypercall.c	Thu Aug 03 11:21:34 2006 -0600
     4.3 @@ -210,7 +210,7 @@ fw_hypercall (struct pt_regs *regs)
     4.4  		if (regs->r28 == PAL_HALT_LIGHT) {
     4.5  			if (vcpu_deliverable_interrupts(v) ||
     4.6  				event_pending(v)) {
     4.7 -					idle_when_pending++;
     4.8 +				perfc_incrc(idle_when_pending);
     4.9  				vcpu_pend_unspecified_interrupt(v);
    4.10  //printf("idle w/int#%d pending!\n",pi);
    4.11  //this shouldn't happen, but it apparently does quite a bit!  so don't
    4.12 @@ -219,7 +219,7 @@ fw_hypercall (struct pt_regs *regs)
    4.13  //as deliver_pending_interrupt is called on the way out and will deliver it
    4.14  			}
    4.15  			else {
    4.16 -				pal_halt_light_count++;
    4.17 +				perfc_incrc(pal_halt_light);
    4.18  				do_sched_op_compat(SCHEDOP_yield, 0);
    4.19  			}
    4.20  			regs->r8 = 0;
     5.1 --- a/xen/arch/ia64/xen/hyperprivop.S	Thu Aug 03 11:10:53 2006 -0600
     5.2 +++ b/xen/arch/ia64/xen/hyperprivop.S	Thu Aug 03 11:21:34 2006 -0600
     5.3 @@ -977,8 +977,8 @@ END(fast_tlb_miss_reflect)
     5.4  
     5.5  // we get here if fast_insert fails (e.g. due to metaphysical lookup)
     5.6  ENTRY(recover_and_page_fault)
     5.7 -#ifdef FAST_REFLECT_CNT
     5.8 -	movl r21=recover_to_page_fault_count;;
     5.9 +#ifdef PERF_COUNTERS
    5.10 +	movl r21=perfcounters + RECOVER_TO_PAGE_FAULT_PERFC_OFS;;
    5.11  	ld8 r22=[r21];;
    5.12  	adds r22=1,r22;;
    5.13  	st8 [r21]=r22;;
    5.14 @@ -2009,8 +2009,8 @@ END(hyper_ptc_ga)
    5.15  
    5.16  // recovery block for hyper_itc metaphysical memory lookup
    5.17  ENTRY(recover_and_dispatch_break_fault)
    5.18 -#ifdef FAST_REFLECT_CNT
    5.19 -	movl r21=recover_to_break_fault_count;;
    5.20 +#ifdef PERF_COUNTERS
    5.21 +	movl r21=perfcounters + RECOVER_TO_BREAK_FAULT_PERFC_OFS;;
    5.22  	ld8 r22=[r21];;
    5.23  	adds r22=1,r22;;
    5.24  	st8 [r21]=r22;;
     6.1 --- a/xen/arch/ia64/xen/privop_stat.c	Thu Aug 03 11:10:53 2006 -0600
     6.2 +++ b/xen/arch/ia64/xen/privop_stat.c	Thu Aug 03 11:21:34 2006 -0600
     6.3 @@ -3,18 +3,6 @@
     6.4  #include <xen/lib.h>
     6.5  #include <asm/uaccess.h>
     6.6  
     6.7 -unsigned long dtlb_translate_count = 0;
     6.8 -unsigned long tr_translate_count = 0;
     6.9 -unsigned long phys_translate_count = 0;
    6.10 -unsigned long vhpt_translate_count = 0;
    6.11 -unsigned long fast_vhpt_translate_count = 0;
    6.12 -unsigned long recover_to_page_fault_count = 0;
    6.13 -unsigned long recover_to_break_fault_count = 0;
    6.14 -unsigned long idle_when_pending = 0;
    6.15 -unsigned long pal_halt_light_count = 0;
    6.16 -unsigned long context_switch_count = 0;
    6.17 -unsigned long lazy_cover_count = 0;
    6.18 -
    6.19  unsigned long slow_hyperpriv_cnt[HYPERPRIVOP_MAX+1] = { 0 };
    6.20  unsigned long fast_hyperpriv_cnt[HYPERPRIVOP_MAX+1] = { 0 };
    6.21  
    6.22 @@ -235,38 +223,6 @@ static int zero_privop_counts(char *buf)
    6.23  	return s - buf;
    6.24  }
    6.25  
    6.26 -static int dump_misc_stats(char *buf)
    6.27 -{
    6.28 -	char *s = buf;
    6.29 -	s += sprintf(s,"Virtual TR translations: %ld\n",tr_translate_count);
    6.30 -	s += sprintf(s,"Virtual VHPT slow translations: %ld\n",vhpt_translate_count);
    6.31 -	s += sprintf(s,"Virtual VHPT fast translations: %ld\n",fast_vhpt_translate_count);
    6.32 -	s += sprintf(s,"Virtual DTLB translations: %ld\n",dtlb_translate_count);
    6.33 -	s += sprintf(s,"Physical translations: %ld\n",phys_translate_count);
    6.34 -	s += sprintf(s,"Recoveries to page fault: %ld\n",recover_to_page_fault_count);
    6.35 -	s += sprintf(s,"Recoveries to break fault: %ld\n",recover_to_break_fault_count);
    6.36 -	s += sprintf(s,"Idle when pending: %ld\n",idle_when_pending);
    6.37 -	s += sprintf(s,"PAL_HALT_LIGHT (no pending): %ld\n",pal_halt_light_count);
    6.38 -	s += sprintf(s,"context switches: %ld\n",context_switch_count);
    6.39 -	s += sprintf(s,"Lazy covers: %ld\n",lazy_cover_count);
    6.40 -	return s - buf;
    6.41 -}
    6.42 -
    6.43 -static void zero_misc_stats(void)
    6.44 -{
    6.45 -	dtlb_translate_count = 0;
    6.46 -	tr_translate_count = 0;
    6.47 -	phys_translate_count = 0;
    6.48 -	vhpt_translate_count = 0;
    6.49 -	fast_vhpt_translate_count = 0;
    6.50 -	recover_to_page_fault_count = 0;
    6.51 -	recover_to_break_fault_count = 0;
    6.52 -	lazy_cover_count = 0;
    6.53 -	pal_halt_light_count = 0;
    6.54 -	idle_when_pending = 0;
    6.55 -	context_switch_count = 0;
    6.56 -}
    6.57 -
    6.58  static const char * const hyperpriv_str[HYPERPRIVOP_MAX+1] = {
    6.59  	0, "rfi", "rsm.dt", "ssm.dt", "cover", "itc.d", "itc.i", "ssm.i",
    6.60  	"=ivr", "=tpr", "tpr=", "eoi", "itm=", "thash", "ptc.ga", "itr.d",
    6.61 @@ -360,7 +316,6 @@ int dump_privop_counts_to_user(char __us
    6.62  	n += dump_privop_addrs(buf + n);
    6.63  #endif
    6.64  	n += dump_vhpt_stats(buf + n);
    6.65 -	n += dump_misc_stats(buf + n);
    6.66  	if (__copy_to_user(ubuf,buf,n))
    6.67  		return -1;
    6.68  	return n;
    6.69 @@ -381,7 +336,6 @@ int zero_privop_counts_to_user(char __us
    6.70  	zero_privop_addrs();
    6.71  #endif
    6.72  	zero_vhpt_stats();
    6.73 -	zero_misc_stats();
    6.74  	zero_reflect_counts();
    6.75  	if (__copy_to_user(ubuf,buf,n))
    6.76  		return -1;
     7.1 --- a/xen/arch/ia64/xen/vcpu.c	Thu Aug 03 11:10:53 2006 -0600
     7.2 +++ b/xen/arch/ia64/xen/vcpu.c	Thu Aug 03 11:21:34 2006 -0600
     7.3 @@ -1500,7 +1500,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UIN
     7.4  			*pteval = (address & _PAGE_PPN_MASK) | __DIRTY_BITS |
     7.5  			          _PAGE_PL_2 | _PAGE_AR_RWX;
     7.6  			*itir = PAGE_SHIFT << 2;
     7.7 -			phys_translate_count++;
     7.8 +			perfc_incrc(phys_translate);
     7.9  			return IA64_NO_FAULT;
    7.10  		}
    7.11  	}
    7.12 @@ -1521,7 +1521,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UIN
    7.13  		if (trp != NULL) {
    7.14  			*pteval = trp->pte.val;
    7.15  			*itir = trp->itir;
    7.16 -			tr_translate_count++;
    7.17 +			perfc_incrc(tr_translate);
    7.18  			return IA64_NO_FAULT;
    7.19  		}
    7.20  	}
    7.21 @@ -1531,7 +1531,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UIN
    7.22  		if (trp != NULL) {
    7.23  			*pteval = trp->pte.val;
    7.24  			*itir = trp->itir;
    7.25 -			tr_translate_count++;
    7.26 +			perfc_incrc(tr_translate);
    7.27  			return IA64_NO_FAULT;
    7.28  		}
    7.29  	}
    7.30 @@ -1544,7 +1544,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UIN
    7.31  	    && vcpu_match_tr_entry_no_p(trp,address,rid)) {
    7.32  		*pteval = pte.val;
    7.33  		*itir = trp->itir;
    7.34 -		dtlb_translate_count++;
    7.35 +		perfc_incrc(dtlb_translate);
    7.36  		return IA64_USE_TLB;
    7.37  	}
    7.38  
    7.39 @@ -1582,7 +1582,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UIN
    7.40  	/* found mapping in guest VHPT! */
    7.41  	*itir = rr & RR_PS_MASK;
    7.42  	*pteval = pte.val;
    7.43 -	vhpt_translate_count++;
    7.44 +	perfc_incrc(vhpt_translate);
    7.45  	return IA64_NO_FAULT;
    7.46  }
    7.47  
     8.1 --- a/xen/include/asm-ia64/perfc_defn.h	Thu Aug 03 11:10:53 2006 -0600
     8.2 +++ b/xen/include/asm-ia64/perfc_defn.h	Thu Aug 03 11:21:34 2006 -0600
     8.3 @@ -1,1 +1,24 @@
     8.4 -/* This file is empty.  */
     8.5 +#ifndef XEN_PERFC_DEFN_H
     8.6 +#define XEN_PERFC_DEFN_H
     8.7 +
     8.8 +PERFCOUNTER_CPU(dtlb_translate,		"dtlb hit")
     8.9 +
    8.10 +PERFCOUNTER_CPU(tr_translate,		"TR hit")
    8.11 +
    8.12 +PERFCOUNTER_CPU(vhpt_translate,		"virtual vhpt translation")
    8.13 +PERFCOUNTER_CPU(fast_vhpt_translate,	"virtual vhpt fast translation")
    8.14 +
    8.15 +PERFCOUNTER(recover_to_page_fault,	"recoveries to page fault")
    8.16 +PERFCOUNTER(recover_to_break_fault,	"recoveries to break fault")
    8.17 +
    8.18 +PERFCOUNTER_CPU(phys_translate,		"metaphysical translation")
    8.19 +
    8.20 +PERFCOUNTER_CPU(idle_when_pending,	"vcpu idle at event")
    8.21 +
    8.22 +PERFCOUNTER_CPU(pal_halt_light,		"calls to pal_halt_light")
    8.23 +
    8.24 +PERFCOUNTER_CPU(context_switch,		"context switch")
    8.25 +
    8.26 +PERFCOUNTER_CPU(lazy_cover,		"lazy cover")
    8.27 +
    8.28 +#endif
     9.1 --- a/xen/include/asm-ia64/privop_stat.h	Thu Aug 03 11:10:53 2006 -0600
     9.2 +++ b/xen/include/asm-ia64/privop_stat.h	Thu Aug 03 11:21:34 2006 -0600
     9.3 @@ -7,24 +7,6 @@ extern int zero_privop_counts_to_user(ch
     9.4  
     9.5  #define PRIVOP_ADDR_COUNT
     9.6  
     9.7 -/* vcpu_translate hit with dtlb.  */
     9.8 -extern unsigned long dtlb_translate_count;
     9.9 -
    9.10 -/* vcpu_translate hit with tr.  */
    9.11 -extern unsigned long tr_translate_count;
    9.12 -
    9.13 -/* vcpu_translate in metaphysical mode.  */
    9.14 -extern unsigned long phys_translate_count;
    9.15 -
    9.16 -extern unsigned long vhpt_translate_count;
    9.17 -extern unsigned long fast_vhpt_translate_count;
    9.18 -extern unsigned long recover_to_page_fault_count;
    9.19 -extern unsigned long recover_to_break_fault_count;
    9.20 -extern unsigned long idle_when_pending;
    9.21 -extern unsigned long pal_halt_light_count;
    9.22 -extern unsigned long context_switch_count;
    9.23 -extern unsigned long lazy_cover_count;
    9.24 -
    9.25  extern unsigned long slow_hyperpriv_cnt[HYPERPRIVOP_MAX+1];
    9.26  extern unsigned long fast_hyperpriv_cnt[HYPERPRIVOP_MAX+1];
    9.27