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-ppc-devel

[XenPPC] [PATCH] Simple instruction trace facility

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [PATCH] Simple instruction trace facility
From: Amos Waterland <apw@xxxxxxxxxx>
Date: Wed, 13 Sep 2006 18:04:43 -0400
Delivery-date: Wed, 13 Sep 2006 15:05:36 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
This very simple patch prints sampled statistics every three seconds
about what has been executing on a particular physical processor.
Example output for cpu 3 on a JS21 is:

 (XEN)    0            44efbc: 166
 (XEN)    1            42a810: 150090839
 (XEN)    2  c0000000004ea660: 1
 (XEN)    3  c000000000037ba0: 1

For reference, 42a810 is in Xen's idle loop, and 44efbc is in it's sleep
implementation.

I don't think it is for submission, hopefully we will soon have a proper
high-performance trace facility accessed via an hcall and logic in the
dom0 kernel that allows a userspace consumer to drain it.  I have
another version of this patch with per-cpu buffers and so on, but I'd
rather we focus on a real tracing facility.  Is anybody working on this?

I am posting it here in case it is useful to other people, and because I
will soon post some statistics for domUs on secondary processors
gathered with it.

---

 exceptions.c |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff -r 82ddfe69c62e xen/arch/powerpc/exceptions.c
--- a/xen/arch/powerpc/exceptions.c     Tue Sep 12 06:48:32 2006 -0400
+++ b/xen/arch/powerpc/exceptions.c     Wed Sep 13 17:50:43 2006 -0400
@@ -29,6 +29,15 @@
 
 #undef DEBUG
 
+#define TRACE_DOMAINS
+
+#ifdef TRACE_DOMAINS
+#define MAX_IARS 1000
+static long iars[MAX_IARS][2];
+static long last_dump_time = 0;
+static int cpu_to_trace = 3;
+#endif
+
 extern ulong ppc_do_softirq(ulong orig_msr);
 extern void do_timer(struct cpu_user_regs *regs);
 extern void do_dec(struct cpu_user_regs *regs);
@@ -41,6 +50,41 @@ void do_timer(struct cpu_user_regs *regs
     /* Set HDEC high so it stops firing and can be reprogrammed by
      * set_preempt() */
     mthdec(INT_MAX);
+
+#ifdef TRACE_DOMAINS
+    if (smp_processor_id() == cpu_to_trace) {
+       int i;
+       long iar = regs->pc;
+
+       for (i = 0; iars[i][0] != 0 && i < MAX_IARS; i++) {
+           if (iars[i][0] == iar) {
+               iars[i][1]++;
+               i = MAX_IARS;
+               break;
+           }
+       }
+
+       if (i < MAX_IARS) {
+           iars[i][0] = iar;
+           iars[i][1] = 1;
+       }
+    }
+
+    if (smp_processor_id() == 0) {
+       int i;
+       long now = mftb();
+       long dump_interval = 3 * timebase_freq;
+       
+       if (now > last_dump_time + dump_interval) {
+           last_dump_time = now;
+           
+           for (i = 0; iars[i][0] != 0 && i < MAX_IARS; i++) {
+               printk("%4d %17lx: %ld\n", i, iars[i][0], iars[i][1]);
+           }
+       }
+    }
+#endif
+
     raise_softirq(TIMER_SOFTIRQ);
 }
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [PATCH] Simple instruction trace facility, Amos Waterland <=