WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

Re: [Xen-ia64-devel] PATCH: convert some stats to perfc

To: Tristan Gingold <Tristan.Gingold@xxxxxxxx>, xen-ia64-devel@xxxxxxxxxxxxxxxxxxx, "Magenheimer, Dan (HP Labs Fort Collins)" <dan.magenheimer@xxxxxx>, Alex Williamson <alex.williamson@xxxxxx>
Subject: Re: [Xen-ia64-devel] PATCH: convert some stats to perfc
From: Atsushi SAKAI <sakaia@xxxxxxxxxxxxxx>
Date: Fri, 04 Aug 2006 20:35:14 +0900
Delivery-date: Fri, 04 Aug 2006 04:36:58 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: (Your message of "Thu, 3 Aug 2006 10:03:58 +0200") <200608031003.58473.Tristan.Gingold@xxxxxxxx>
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
References: <200608031003.58473.Tristan.Gingold@xxxxxxxx>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi, Tristan 

 Why you add perfc(context_switch) in context_switch for IA64?
(General sched_ctx is in __enter_scheduler)
It seems double counting.(sched_ctx and context_switch gets the same value)
(I want to hear your opinion.)


Thanks,
Atsushi SAKAI


>Hi,
>
>this patch converts a few counters to perfc.
>I will try to convert *all* counters to perfc but this is a background task.
>I prefer to use the perfc rather than the current counter implementation
>because perfc has a better API.
>
>Tested on dom0.
>
>Tristan.

># HG changeset patch
># User gingold@virtu10
># Node ID 9598c908b5be38882ea7b30aa126fe654dd119ed
># Parent  561df7d9cecc92d08bcc34ed45880062b06dc2e6
>Convert some stats to perfc.
>
>Signed-off-by: Tristan Gingold <tristan.gingold@xxxxxxxx>
>
>diff -r 561df7d9cecc -r 9598c908b5be xen/arch/ia64/asm-offsets.c
>--- a/xen/arch/ia64/asm-offsets.c      Wed Aug 02 15:09:56 2006 -0600
>+++ b/xen/arch/ia64/asm-offsets.c      Thu Aug 03 08:12:21 2006 +0200
>@@ -210,4 +210,9 @@ void foo(void)
>       DEFINE(IA64_KR_IO_BASE_OFFSET, offsetof (cpu_kr_ia64_t, 
> _kr[IA64_KR_IO_BASE]));
>       DEFINE(IA64_KR_CURRENT_STACK_OFFSET, offsetof (cpu_kr_ia64_t, 
> _kr[IA64_KR_CURRENT_STACK]));
>
>+#ifdef PERF_COUNTERS
>+      BLANK();
>+      DEFINE(RECOVER_TO_PAGE_FAULT_PERFC_OFS, offsetof (struct perfcounter, 
>recover_to_page_fault));
>+      DEFINE(RECOVER_TO_BREAK_FAULT_PERFC_OFS, offsetof (struct perfcounter, 
>recover_to_break_fault));
>+#endif
> }
>diff -r 561df7d9cecc -r 9598c908b5be xen/arch/ia64/xen/domain.c
>--- a/xen/arch/ia64/xen/domain.c       Wed Aug 02 15:09:56 2006 -0600
>+++ b/xen/arch/ia64/xen/domain.c       Thu Aug 03 08:12:21 2006 +0200
>@@ -136,7 +136,7 @@ void context_switch(struct vcpu *prev, s
>     uint64_t pta;
>
>     local_irq_save(spsr);
>-    context_switch_count++;
>+    perfc_incrc(context_switch);
>
>     __ia64_save_fpu(prev->arch._thread.fph);
>     __ia64_load_fpu(next->arch._thread.fph);
>diff -r 561df7d9cecc -r 9598c908b5be xen/arch/ia64/xen/faults.c
>--- a/xen/arch/ia64/xen/faults.c       Wed Aug 02 15:09:56 2006 -0600
>+++ b/xen/arch/ia64/xen/faults.c       Thu Aug 03 08:12:21 2006 +0200
>@@ -170,7 +170,7 @@ handle_lazy_cover(struct vcpu *v, struct
>               PSCB(v,ifs) = regs->cr_ifs;
>               PSCB(v,incomplete_regframe) = 1;
>               regs->cr_ifs = 0;
>-              lazy_cover_count++;
>+              perfc_incrc(lazy_cover);
>               return(1); // retry same instruction with cr.ifs off
>       }
>       return(0);
>diff -r 561df7d9cecc -r 9598c908b5be xen/arch/ia64/xen/hypercall.c
>--- a/xen/arch/ia64/xen/hypercall.c    Wed Aug 02 15:09:56 2006 -0600
>+++ b/xen/arch/ia64/xen/hypercall.c    Thu Aug 03 08:12:21 2006 +0200
>@@ -210,7 +210,7 @@ fw_hypercall (struct pt_regs *regs)
>               if (regs->r28 == PAL_HALT_LIGHT) {
>                       if (vcpu_deliverable_interrupts(v) ||
>                               event_pending(v)) {
>-                                      idle_when_pending++;
>+                              perfc_incrc(idle_when_pending);
>                               vcpu_pend_unspecified_interrupt(v);
> //printf("idle w/int#%d pending!\n",pi);
> //this shouldn't happen, but it apparently does quite a bit!  so don't
>@@ -219,7 +219,7 @@ fw_hypercall (struct pt_regs *regs)
> //as deliver_pending_interrupt is called on the way out and will deliver it
>                       }
>                       else {
>-                              pal_halt_light_count++;
>+                              perfc_incrc(pal_halt_light);
>                               do_sched_op_compat(SCHEDOP_yield, 0);
>                       }
>                       regs->r8 = 0;
>diff -r 561df7d9cecc -r 9598c908b5be xen/arch/ia64/xen/hyperprivop.S
>--- a/xen/arch/ia64/xen/hyperprivop.S  Wed Aug 02 15:09:56 2006 -0600
>+++ b/xen/arch/ia64/xen/hyperprivop.S  Thu Aug 03 08:12:21 2006 +0200
>@@ -978,7 +978,7 @@ END(fast_tlb_miss_reflect)
> // we get here if fast_insert fails (e.g. due to metaphysical lookup)
> ENTRY(recover_and_page_fault)
> #ifdef FAST_REFLECT_CNT
>-      movl r21=recover_to_page_fault_count;;
>+      movl r21=perfcounters + RECOVER_TO_PAGE_FAULT_PERFC_OFS;;
>       ld8 r22=[r21];;
>       adds r22=1,r22;;
>       st8 [r21]=r22;;
>@@ -2010,7 +2010,7 @@ END(hyper_ptc_ga)
> // recovery block for hyper_itc metaphysical memory lookup
> ENTRY(recover_and_dispatch_break_fault)
> #ifdef FAST_REFLECT_CNT
>-      movl r21=recover_to_break_fault_count;;
>+      movl r21=perfcounters + RECOVER_TO_BREAK_FAULT_PERFC_OFS;;
>       ld8 r22=[r21];;
>       adds r22=1,r22;;
>       st8 [r21]=r22;;
>diff -r 561df7d9cecc -r 9598c908b5be xen/arch/ia64/xen/privop_stat.c
>--- a/xen/arch/ia64/xen/privop_stat.c  Wed Aug 02 15:09:56 2006 -0600
>+++ b/xen/arch/ia64/xen/privop_stat.c  Thu Aug 03 08:12:21 2006 +0200
>@@ -2,18 +2,6 @@
> #include <asm/vhpt.h>
> #include <xen/lib.h>
> #include <asm/uaccess.h>
>-
>-unsigned long dtlb_translate_count = 0;
>-unsigned long tr_translate_count = 0;
>-unsigned long phys_translate_count = 0;
>-unsigned long vhpt_translate_count = 0;
>-unsigned long fast_vhpt_translate_count = 0;
>-unsigned long recover_to_page_fault_count = 0;
>-unsigned long recover_to_break_fault_count = 0;
>-unsigned long idle_when_pending = 0;
>-unsigned long pal_halt_light_count = 0;
>-unsigned long context_switch_count = 0;
>-unsigned long lazy_cover_count = 0;
>
> unsigned long slow_hyperpriv_cnt[HYPERPRIVOP_MAX+1] = { 0 };
> unsigned long fast_hyperpriv_cnt[HYPERPRIVOP_MAX+1] = { 0 };
>@@ -235,38 +223,6 @@ static int zero_privop_counts(char *buf)
>       return s - buf;
> }
>
>-static int dump_misc_stats(char *buf)
>-{
>-      char *s = buf;
>-      s += sprintf(s,"Virtual TR translations: %ld\n",tr_translate_count);
>-      s += sprintf(s,"Virtual VHPT slow translations: 
>%ld\n",vhpt_translate_count);
>-      s += sprintf(s,"Virtual VHPT fast translations: 
>%ld\n",fast_vhpt_translate_count);
>-      s += sprintf(s,"Virtual DTLB translations: %ld\n",dtlb_translate_count);
>-      s += sprintf(s,"Physical translations: %ld\n",phys_translate_count);
>-      s += sprintf(s,"Recoveries to page fault: 
>%ld\n",recover_to_page_fault_count);
>-      s += sprintf(s,"Recoveries to break fault: 
>%ld\n",recover_to_break_fault_count);
>-      s += sprintf(s,"Idle when pending: %ld\n",idle_when_pending);
>-      s += sprintf(s,"PAL_HALT_LIGHT (no pending): 
>%ld\n",pal_halt_light_count);
>-      s += sprintf(s,"context switches: %ld\n",context_switch_count);
>-      s += sprintf(s,"Lazy covers: %ld\n",lazy_cover_count);
>-      return s - buf;
>-}
>-
>-static void zero_misc_stats(void)
>-{
>-      dtlb_translate_count = 0;
>-      tr_translate_count = 0;
>-      phys_translate_count = 0;
>-      vhpt_translate_count = 0;
>-      fast_vhpt_translate_count = 0;
>-      recover_to_page_fault_count = 0;
>-      recover_to_break_fault_count = 0;
>-      lazy_cover_count = 0;
>-      pal_halt_light_count = 0;
>-      idle_when_pending = 0;
>-      context_switch_count = 0;
>-}
>-
> static const char * const hyperpriv_str[HYPERPRIVOP_MAX+1] = {
>       0, "rfi", "rsm.dt", "ssm.dt", "cover", "itc.d", "itc.i", "ssm.i",
>       "=ivr", "=tpr", "tpr=", "eoi", "itm=", "thash", "ptc.ga", "itr.d",
>@@ -360,7 +316,6 @@ int dump_privop_counts_to_user(char __us
>       n += dump_privop_addrs(buf + n);
> #endif
>       n += dump_vhpt_stats(buf + n);
>-      n += dump_misc_stats(buf + n);
>       if (__copy_to_user(ubuf,buf,n))
>               return -1;
>       return n;
>@@ -381,7 +336,6 @@ int zero_privop_counts_to_user(char __us
>       zero_privop_addrs();
> #endif
>       zero_vhpt_stats();
>-      zero_misc_stats();
>       zero_reflect_counts();
>       if (__copy_to_user(ubuf,buf,n))
>               return -1;
>diff -r 561df7d9cecc -r 9598c908b5be xen/arch/ia64/xen/vcpu.c
>--- a/xen/arch/ia64/xen/vcpu.c Wed Aug 02 15:09:56 2006 -0600
>+++ b/xen/arch/ia64/xen/vcpu.c Thu Aug 03 08:12:21 2006 +0200
>@@ -1500,7 +1500,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UIN
>                       *pteval = (address & _PAGE_PPN_MASK) | __DIRTY_BITS |
>                                 _PAGE_PL_2 | _PAGE_AR_RWX;
>                       *itir = PAGE_SHIFT << 2;
>-                      phys_translate_count++;
>+                      perfc_incrc(phys_translate);
>                       return IA64_NO_FAULT;
>               }
>       }
>@@ -1521,7 +1521,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UIN
>               if (trp != NULL) {
>                       *pteval = trp->pte.val;
>                       *itir = trp->itir;
>-                      tr_translate_count++;
>+                      perfc_incrc(tr_translate);
>                       return IA64_NO_FAULT;
>               }
>       }
>@@ -1531,7 +1531,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UIN
>               if (trp != NULL) {
>                       *pteval = trp->pte.val;
>                       *itir = trp->itir;
>-                      tr_translate_count++;
>+                      perfc_incrc(tr_translate);
>                       return IA64_NO_FAULT;
>               }
>       }
>@@ -1544,7 +1544,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UIN
>           && vcpu_match_tr_entry_no_p(trp,address,rid)) {
>               *pteval = pte.val;
>               *itir = trp->itir;
>-              dtlb_translate_count++;
>+              perfc_incrc(dtlb_translate);
>               return IA64_USE_TLB;
>       }
>
>@@ -1582,7 +1582,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UIN
>       /* found mapping in guest VHPT! */
>       *itir = rr & RR_PS_MASK;
>       *pteval = pte.val;
>-      vhpt_translate_count++;
>+      perfc_incrc(vhpt_translate);
>       return IA64_NO_FAULT;
> }
>
>diff -r 561df7d9cecc -r 9598c908b5be xen/include/asm-ia64/perfc_defn.h
>--- a/xen/include/asm-ia64/perfc_defn.h        Wed Aug 02 15:09:56 2006 -0600
>+++ b/xen/include/asm-ia64/perfc_defn.h        Thu Aug 03 08:12:21 2006 +0200
>@@ -1,1 +1,20 @@
>-/* This file is empty.  */
>+
>+PERFCOUNTER_CPU(dtlb_translate,             "dtlb hit")
>+
>+PERFCOUNTER_CPU(tr_translate,               "TR hit")
>+
>+PERFCOUNTER_CPU(vhpt_translate,             "virtual vhpt translation")
>+PERFCOUNTER_CPU(fast_vhpt_translate,        "virtual vhpt fast translation")
>+
>+PERFCOUNTER(recover_to_page_fault,      "recoveries to page fault")
>+PERFCOUNTER(recover_to_break_fault,      "recoveries to break fault")
>+
>+PERFCOUNTER_CPU(phys_translate,             "metaphysical translation")
>+
>+PERFCOUNTER_CPU(idle_when_pending,          "vcpu idle at event")
>+
>+PERFCOUNTER_CPU(pal_halt_light,                   "calls to pal_halt_light")
>+
>+PERFCOUNTER_CPU(context_switch,                   "context switch")
>+
>+PERFCOUNTER_CPU(lazy_cover,               "lazy cover")
>diff -r 561df7d9cecc -r 9598c908b5be xen/include/asm-ia64/privop_stat.h
>--- a/xen/include/asm-ia64/privop_stat.h       Wed Aug 02 15:09:56 2006 -0600
>+++ b/xen/include/asm-ia64/privop_stat.h       Thu Aug 03 08:12:21 2006 +0200
>@@ -6,24 +6,6 @@ extern int zero_privop_counts_to_user(ch
> extern int zero_privop_counts_to_user(char *, int);
>
> #define PRIVOP_ADDR_COUNT
>-
>-/* vcpu_translate hit with dtlb.  */
>-extern unsigned long dtlb_translate_count;
>-
>-/* vcpu_translate hit with tr.  */
>-extern unsigned long tr_translate_count;
>-
>-/* vcpu_translate in metaphysical mode.  */
>-extern unsigned long phys_translate_count;
>-
>-extern unsigned long vhpt_translate_count;
>-extern unsigned long fast_vhpt_translate_count;
>-extern unsigned long recover_to_page_fault_count;
>-extern unsigned long recover_to_break_fault_count;
>-extern unsigned long idle_when_pending;
>-extern unsigned long pal_halt_light_count;
>-extern unsigned long context_switch_count;
>-extern unsigned long lazy_cover_count;
>
> extern unsigned long slow_hyperpriv_cnt[HYPERPRIVOP_MAX+1];
> extern unsigned long fast_hyperpriv_cnt[HYPERPRIVOP_MAX+1];

>_______________________________________________
>Xen-ia64-devel mailing list
>Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
>http://lists.xensource.com/xen-ia64-devel








_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel

<Prev in Thread] Current Thread [Next in Thread>