Skip to contentSkip to conversation

add long interrupt measurement capability

PATCH In review Dan Magenheimer 5 participants 12 messages Apr 29, 2009 – May 19, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add long interrupt measurement capability

Hi Keir --

Since I see you are still taking boot-option patches for 3.4, I thought I'd retry this one which optionally measures cycles spent in each irq. I thought you had just decided it was too late for 3.4... if you rejected it for another reason, please let me know.

Thanks,
Dan

Quoted 5 lines

From: Dan Magenheimer
Sent: Tuesday, April 14, 2009 9:39 AM
To: Keir Fraser; Tian, Kevin; Xen-Devel (E-mail)
Subject: RE: [Xen-devel] million cycle interrupt

Quoted 7 lines

But first, Keir, would you take this patch so that this kind of issue can be more easily diagnosed in the future? If you're worried about the extra two global variable reads, you could wrap an "#ifndef NDEBUG" around it (with #else #define opt_measure_irqs 0), but it might be nice to have this diagnostic capability in released code.

xen/arch/x86/irq.c +50 -3
diff -r d9de5cc2b0bc xen/arch/x86/irq.c
@@ -25,7 +25,11 @@ int opt_noirqbalance = 0;
 int opt_noirqbalance = 0;
 boolean_param("noirqbalance", opt_noirqbalance);
 
+int opt_measure_irqs = 0;
+boolean_param("measure_irqs", opt_measure_irqs);
+
 irq_desc_t irq_desc[NR_VECTORS];
+irq_desc_measure_t irq_desc_measure[NR_VECTORS];
 
 static DEFINE_SPINLOCK(vector_lock);
 int vector_irq[NR_VECTORS] __read_mostly = {
@@ -114,6 +118,8 @@ asmlinkage void do_IRQ(struct cpu_user_r
     unsigned int      vector = regs->entry_vector;
     irq_desc_t       *desc = &irq_desc[vector];
     struct irqaction *action;
+    irq_desc_measure_t    *mdesc;
+    unsigned long tsc_in = 0, diff;
 
     perfc_incr(irqs);
 
@@ -123,7 +129,18 @@ asmlinkage void do_IRQ(struct cpu_user_r
     if ( likely(desc->status & IRQ_GUEST) )
     {
         irq_enter();
+        if ( opt_measure_irqs )
+            tsc_in = (unsigned long)get_cycles();
         __do_IRQ_guest(vector);
+        if ( opt_measure_irqs )
+        {
+            diff = (unsigned long)get_cycles() - tsc_in;
+            mdesc = &irq_desc_measure[vector];
+            mdesc->count++;
+            mdesc->tot_cycles += diff;
+            if ( diff > mdesc->max_cycles )
+                mdesc->max_cycles = diff;
+        }
         irq_exit();
         spin_unlock(&desc->lock);
         return;
@@ -147,7 +164,18 @@ asmlinkage void do_IRQ(struct cpu_user_r
         desc->status &= ~IRQ_PENDING;
         irq_enter();
         spin_unlock_irq(&desc->lock);
+        if ( opt_measure_irqs )
+            tsc_in = (unsigned long)get_cycles();
         action->handler(vector_to_irq(vector), action->dev_id, regs);
+        if ( opt_measure_irqs )
+        {
+            diff = (unsigned long)get_cycles() - tsc_in;
+            mdesc = &irq_desc_measure[vector];
+            mdesc->count++;
+            mdesc->tot_cycles += diff;
+            if ( diff > mdesc->max_cycles )
+                mdesc->max_cycles = diff;
+        }
         spin_lock_irq(&desc->lock);
         irq_exit();
     }
@@ -1071,9 +1099,11 @@ static void dump_irqs(unsigned char key)
 {
     int i, glob_irq, irq, vector;
     irq_desc_t *desc;
+    irq_desc_measure_t *mdesc = NULL;
     irq_guest_action_t *action;
     struct domain *d;
     unsigned long flags;
+    unsigned long max_max_cycles = 0;
 
     printk("Guest interrupt information:\n");
 
@@ -1088,12 +1118,23 @@ static void dump_irqs(unsigned char key)
 
         spin_lock_irqsave(&desc->lock, flags);
 
+        if ( opt_measure_irqs )
+        {
+            mdesc = &irq_desc_measure[vector];
+            if ( mdesc->max_cycles > max_max_cycles )
+                max_max_cycles = mdesc->max_cycles;
+        }
         if ( !(desc->status & IRQ_GUEST) )
+        {
             printk("   Vec%3d IRQ%3d: type=%-15s status=%08x "
-                   "mapped, unbound\n",
+                   "mapped, unbound",
                    vector, glob_irq, desc->handler->typename, desc->status);
-        else
-        {
+            if ( opt_measure_irqs )
+                printk(" cycles(n/avg/max)=%lu/%lu/%lu", mdesc->count,
+                       mdesc->count ? (mdesc->tot_cycles / mdesc->count) : 0,
+                       mdesc->max_cycles);
+            printk("\n");
+        } else {
             action = (irq_guest_action_t *)desc->action;
 
             printk("   Vec%3d IRQ%3d: type=%-15s status=%08x "
@@ -1123,11 +1164,17 @@ static void dump_irqs(unsigned char key)
                     printk(",");
             }
 
+            if ( opt_measure_irqs )
+                printk(" cycles(n/avg/max)=%lu/%lu/%lu", mdesc->count,
+                       mdesc->count ? (mdesc->tot_cycles / mdesc->count) : 0,
+                       mdesc->max_cycles);
             printk("\n");
         }
 
         spin_unlock_irqrestore(&desc->lock, flags);
     }
+    if ( max_max_cycles )
+        printk("max_max_cycles = %lu\n",max_max_cycles);
 
     dump_ioapic_irq_info();
 }
xen/include/xen/irq.h +6 -0
diff -r d9de5cc2b0bc xen/include/xen/irq.h
@@ -67,6 +67,12 @@ typedef struct {
     cpumask_t affinity;
 } __cacheline_aligned irq_desc_t;
 
+typedef struct {
+    unsigned long max_cycles;
+    unsigned long tot_cycles;
+    unsigned long count;
+} irq_desc_measure_t;
+
 extern irq_desc_t irq_desc[NR_VECTORS];
 
 extern int setup_irq_vector(unsigned int, struct irqaction *);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 6 lines · Dan Magenheimer

Since I see you are still taking boot-option patches for 3.4, I thought I'd retry this one which optionally measures cycles spent in each irq. I thought you had just decided it was too late for 3.4... if you rejected it for another reason, please let me know.

I don't think it has sufficient general utility to be applied. Anyone who would actually have the want and wit to run this option can apply the patch themselves.

-- Keir

#2 lore raw

Dan, Couldn't you add this to xentrace ?

-dulloor

Quoted 13 lines · Keir Fraser
Quoted 6 lines · Dan Magenheimer

Since I see you are still taking boot-option patches for 3.4, I thought I'd retry this one which optionally measures cycles spent in each irq. I thought you had just decided it was too late for 3.4... if you rejected it for another reason, please let me know.

I don't think it has sufficient general utility to be applied. Anyone who would actually have the want and wit to run this option can apply the patch themselves.

Quoted 9 lines

-- Keir

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw

Perhaps. However measuring cycles is important and, more specifically, measuring MAX cycles spent across a set of interrupts. As a result, I suspect any code that measures this (regardless of whether the result is reported by xentrace or debug-key) would likely encounter the same objection from Keir.

-----Original Message-----
From: Dulloor [mailto:[email protected]]
Sent: Thursday, May 07, 2009 6:14 PM
To: Keir Fraser
Cc: Dan Magenheimer; Xen-Devel (E-mail)
Subject: Re: [Xen-devel] Re: [PATCH] add long interrupt measurement capability

Dan, Couldn't you add this to xentrace ?

-dulloor

On Wed, Apr 29, 2009 at 2:03 PM, Keir Fraser <[email protected]> wrote:

Quoted 6 lines · Dan Magenheimer

Since I see you are still taking boot-option patches for 3.4, I thought I'd retry this one which optionally measures cycles spent in each irq. I thought you had just decided it was too late for 3.4... if you rejected it for another reason, please let me know.

I don't think it has sufficient general utility to be applied. Anyone who would actually have the want and wit to run this option can apply the patch themselves.

-- Keir

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw
Quoted 6 lines

Perhaps. However measuring cycles is important and, more specifically, measuring MAX cycles spent across a set of interrupts. As a result, I suspect any code that measures this (regardless of whether the result is reported by xentrace or debug-key) would likely encounter the same objection from Keir.

I can't imagine there'd be any objection to adding trace macros to record this. The xentrace log processing tool can then be updated to generate max or histogram values.

Ian

Quoted 47 lines

-----Original Message-----
From: Dulloor [mailto:[email protected]]
Sent: Thursday, May 07, 2009 6:14 PM
To: Keir Fraser
Cc: Dan Magenheimer; Xen-Devel (E-mail)
Subject: Re: [Xen-devel] Re: [PATCH] add long interrupt measurement capability

Dan, Couldn't you add this to xentrace ?

-dulloor

On Wed, Apr 29, 2009 at 2:03 PM, Keir Fraser
<[email protected]> wrote:

Quoted 6 lines · Dan Magenheimer

Since I see you are still taking boot-option patches for 3.4, I thought I'd retry this one which optionally measures cycles spent in each irq. I thought you had just decided it was too late for 3.4... if you rejected it for another reason, please let me know.

I don't think it has sufficient general utility to be applied. Anyone who
would actually have the want and wit to run this option can apply the patch
themselves.

-- Keir

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#5 lore raw
Quoted 10 lines · Ian Pratt
Quoted 6 lines

Perhaps. However measuring cycles is important and, more specifically, measuring MAX cycles spent across a set of interrupts. As a result, I suspect any code that measures this (regardless of whether the result is reported by xentrace or debug-key) would likely encounter the same objection from Keir.

I can't imagine there'd be any objection to adding trace macros to record this. The xentrace log processing tool can then be updated to generate max or histogram values.

Yes, xentrace records would be okay. It's adding another debug key and printing to Xen console for this purpose which I do not think is worthwhile.

-- Keir

#6 lore raw

Here is a xentrace patch.

- Should irq_desc_measure_t move to some .h file ?
- I have defined the new trace event in general class. Is it fine ?

- I have defined tsc_in as volatile to avoid initializing it in the main code path.

thanks
dulloor

Quoted 11 lines · Keir Fraser
Quoted 9 lines · Ian Pratt
Quoted 6 lines

Perhaps. However measuring cycles is important and, more specifically, measuring MAX cycles spent across a set of interrupts. As a result, I suspect any code that measures this (regardless of whether the result is reported by xentrace or debug-key) would likely encounter the same objection from Keir.

I can't imagine there'd be any objection to adding trace macros to record this. The xentrace log processing tool can then be updated to generate

Quoted 11 lines

max or

Quoted 1 line

histogram values.

Yes, xentrace records would be okay. It's adding another debug key and printing to Xen console for this purpose which I do not think is worthwhile.

-- Keir

tools/xentrace/formats +1 -0
diff -r 7a73e3aeb224 tools/xentrace/formats
@@ -3,6 +3,7 @@ 0x0001f001  CPU%(cpu)d  %(tsc)d (+%(relt
 0x0001f001  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  lost_records      0x%(1)08x
 0x0001f002  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  wrap_buffer       0x%(1)08x
 0x0001f003  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  cpu_change        0x%(1)08x
+0x0001f004  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  do_guest_irq    [ vector = 0x%(1)08x, count = 0x%(2)08x, tot_cycles = 0x%(3)08x, max_cycles = 0x%(4)08x ]
 
 0x00021011  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  running_to_runnable [ dom:vcpu = 0x%(1)08x ]
 0x00021021  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  running_to_blocked  [ dom:vcpu = 0x%(1)08x ]
xen/arch/x86/irq.c +39 -0
diff -r 7a73e3aeb224 xen/arch/x86/irq.c
@@ -16,6 +16,7 @@
 #include <xen/compat.h>
 #include <xen/iocap.h>
 #include <xen/iommu.h>
+#include <xen/trace.h>
 #include <asm/msi.h>
 #include <asm/current.h>
 #include <asm/flushtlb.h>
@@ -26,6 +27,16 @@ boolean_param("noirqbalance", opt_noirqb
 boolean_param("noirqbalance", opt_noirqbalance);
 
 irq_desc_t irq_desc[NR_VECTORS];
+
+typedef struct irq_desc_measure
+{
+    unsigned long max_cycles;
+    unsigned long tot_cycles;
+    unsigned long count;
+} irq_desc_measure_t;
+
+irq_desc_measure_t irq_desc_measure[NR_VECTORS];
+
 
 static DEFINE_SPINLOCK(vector_lock);
 int vector_irq[NR_VECTORS] __read_mostly = {
@@ -109,11 +120,33 @@ int assign_irq_vector(int irq)
     return vector;
 }
 
+static inline void trace_guest_irq(unsigned int vector, 
+        unsigned long tsc_in)
+{
+    if(tb_init_done)
+    {
+        irq_desc_measure_t *desc = &irq_desc_measure[vector];
+        long tsc_diff = (long)((unsigned long)get_cycles() - tsc_in);
+
+        if(unlikely(tsc_diff < 0))
+            return;
+        
+        desc->tot_cycles += tsc_diff;
+        if(tsc_diff > desc->max_cycles)
+            desc->max_cycles = tsc_diff;
+        desc->count++;
+        TRACE_4D(TRC_TRACE_GUEST_IRQ, vector,
+                 desc->count, desc->tot_cycles, desc->max_cycles);
+    }
+    return;
+}
+
 asmlinkage void do_IRQ(struct cpu_user_regs *regs)
 {
     unsigned int      vector = regs->entry_vector;
     irq_desc_t       *desc = &irq_desc[vector];
     struct irqaction *action;
+    __volatile__ unsigned long tsc_in;
 
     perfc_incr(irqs);
 
@@ -123,7 +156,10 @@ asmlinkage void do_IRQ(struct cpu_user_r
     if ( likely(desc->status & IRQ_GUEST) )
     {
         irq_enter();
+        if(tb_init_done)
+            tsc_in = (unsigned long)get_cycles();
         __do_IRQ_guest(vector);
+        trace_guest_irq(vector, tsc_in);
         irq_exit();
         spin_unlock(&desc->lock);
         return;
@@ -147,7 +183,10 @@ asmlinkage void do_IRQ(struct cpu_user_r
         desc->status &= ~IRQ_PENDING;
         irq_enter();
         spin_unlock_irq(&desc->lock);
+        if(tb_init_done)
+            tsc_in = (unsigned long)get_cycles();
         action->handler(vector_to_irq(vector), action->dev_id, regs);
+        trace_guest_irq(vector, tsc_in);
         spin_lock_irq(&desc->lock);
         irq_exit();
     }
xen/include/public/trace.h +1 -0
diff -r 7a73e3aeb224 xen/include/public/trace.h
@@ -59,6 +59,7 @@
 #define TRC_LOST_RECORDS        (TRC_GEN + 1)
 #define TRC_TRACE_WRAP_BUFFER  (TRC_GEN + 2)
 #define TRC_TRACE_CPU_CHANGE    (TRC_GEN + 3)
+#define TRC_TRACE_GUEST_IRQ     (TRC_GEN + 4)
 
 #define TRC_SCHED_RUNSTATE_CHANGE   (TRC_SCHED_MIN + 1)
 #define TRC_SCHED_CONTINUE_RUNNING  (TRC_SCHED_MIN + 2)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#7 lore raw

I guess you can handle it much simpler by stamping a record in both irq_enter and irq_exit. All the statistics jobs are left for xentrace script to digest.

Also I'd call it as trace_irq instead of trace_guest_irq. :-)

Thanks,
Kevin

________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of Dulloor
Sent: 2009年5月9日 17:12
To: Keir Fraser
Cc: Ian Pratt; Xen-Devel (E-mail); Dan Magenheimer
Subject: Re: [Xen-devel] Re: [PATCH] add long interrupt measurement capability

Here is a xentrace patch.

- Should irq_desc_measure_t move to some .h file ?
- I have defined the new trace event in general class. Is it fine ?

- I have defined tsc_in as volatile to avoid initializing it in the main code path.

thanks
dulloor

On Sat, May 9, 2009 at 3:56 AM, Keir Fraser <[email protected]<mailto:[email protected]>> wrote:

Quoted 10 lines · On 08/05/2009 22:53, "Ian Pratt" <[email protected]<mailto:[email protected]…
Quoted 6 lines

Perhaps. However measuring cycles is important and, more specifically, measuring MAX cycles spent across a set of interrupts. As a result, I suspect any code that measures this (regardless of whether the result is reported by xentrace or debug-key) would likely encounter the same objection from Keir.

I can't imagine there'd be any objection to adding trace macros to record this. The xentrace log processing tool can then be updated to generate max or histogram values.

Yes, xentrace records would be okay. It's adding another debug key and printing to Xen console for this purpose which I do not think is worthwhile.

-- Keir

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#8 lore raw

- Changed the name to trace_irq :)

- trace_irq dumps just tsc_in and tsc_out values in a single record. I guess there is no need to write two records (wasting trace-buf mem, more processing, additional logic in xentrace and/or xentrace_format).

- xentrace_format does what Dan wanted.

-dulloor

2009/5/11 Tian, Kevin <[email protected]>

Quoted 23 lines

I guess you can handle it much simpler by stamping a record in both
irq_enter and irq_exit. All the statistics jobs are left for xentrace script to digest.

Also I'd call it as trace_irq instead of trace_guest_irq. :-)

Thanks,
Kevin

------------------------------
*From:* [email protected] [mailto:
[email protected]] *On Behalf Of *Dulloor *Sent:* 2009年5月9日 17:12
*To:* Keir Fraser
*Cc:* Ian Pratt; Xen-Devel (E-mail); Dan Magenheimer *Subject:* Re: [Xen-devel] Re: [PATCH] add long interrupt measurement capability

Here is a xentrace patch.

- Should irq_desc_measure_t move to some .h file ?
- I have defined the new trace event in general class. Is it fine ?

Quoted 32 lines

- I have defined tsc_in as volatile to avoid initializing it in the main code path.

thanks
dulloor

Quoted 23 lines · Keir Fraser
Quoted 8 lines · Ian Pratt
Quoted 6 lines

Perhaps. However measuring cycles is important and, more specifically, measuring MAX cycles spent across a set of interrupts. As a result, I suspect any code that measures this (regardless of whether the result is reported by xentrace or debug-key) would likely encounter the same objection from Keir.

I can't imagine there'd be any objection to adding trace macros to

record

Quoted 1 line

this. The xentrace log processing tool can then be updated to generate

max or

Quoted 1 line

histogram values.

Yes, xentrace records would be okay. It's adding another debug key and printing to Xen console for this purpose which I do not think is worthwhile.

-- Keir

tools/xentrace/formats +1 -0
diff -r 7a73e3aeb224 tools/xentrace/formats
@@ -3,6 +3,7 @@ 0x0001f001  CPU%(cpu)d  %(tsc)d (+%(relt
 0x0001f001  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  lost_records      0x%(1)08x
 0x0001f002  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  wrap_buffer       0x%(1)08x
 0x0001f003  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  cpu_change        0x%(1)08x
+0x0001f004  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  trace_irq    [ vector = %(1)d, count = %(2)d, tot_cycles = 0x%(3)08x, max_cycles = 0x%(4)08x ]
 
 0x00021011  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  running_to_runnable [ dom:vcpu = 0x%(1)08x ]
 0x00021021  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  running_to_blocked  [ dom:vcpu = 0x%(1)08x ]
tools/xentrace/xentrace_format +17 -0
diff -r 7a73e3aeb224 tools/xentrace/xentrace_format
@@ -110,6 +110,10 @@ D7REC  = "IIIIIII"
 
 last_tsc = [0]
 
+TRC_TRACE_IRQ = 0x1f004
+NR_VECTORS = 256
+irq_measure = [{'count':0, 'tot_cycles':0, 'max_cycles':0}] * NR_VECTORS
+
 i=0
 
 while not interrupted:
@@ -179,6 +183,19 @@ while not interrupted:
         if event == 0x1f003:
             cpu = d1
 
+        if event == TRC_TRACE_IRQ:
+            # IN - d1:vector, d2:tsc_in, d3:tsc_out
+            # OUT - d1:vector, d2:count, d3:tot_cycles, d4:max_cycles
+            tsc_diff = d3 - d2
+            if tsc_diff < 0:
+                break
+            irq_measure[d1]['count'] += 1
+            irq_measure[d1]['tot_cycles'] += tsc_diff
+            if irq_measure[d1]['max_cycles'] < tsc_diff:
+                irq_measure[d1]['max_cycles'] = tsc_diff
+            d2 = irq_measure[d1]['count']
+            d3 = irq_measure[d1]['tot_cycles']
+            d4 = irq_measure[d1]['max_cycles']
 
         #tsc = (tscH<<32) | tscL
 
xen/arch/x86/irq.c +16 -0
diff -r 7a73e3aeb224 xen/arch/x86/irq.c
@@ -16,6 +16,7 @@
 #include <xen/compat.h>
 #include <xen/iocap.h>
 #include <xen/iommu.h>
+#include <xen/trace.h>
 #include <asm/msi.h>
 #include <asm/current.h>
 #include <asm/flushtlb.h>
@@ -109,11 +110,20 @@ int assign_irq_vector(int irq)
     return vector;
 }
 
+static inline void trace_irq(unsigned int vector, 
+        unsigned long tsc_in, unsigned long tsc_out)
+{
+    if(tb_init_done)
+        TRACE_3D(TRC_TRACE_IRQ, vector, tsc_in, tsc_out);
+    return;
+}
+
 asmlinkage void do_IRQ(struct cpu_user_regs *regs)
 {
     unsigned int      vector = regs->entry_vector;
     irq_desc_t       *desc = &irq_desc[vector];
     struct irqaction *action;
+    __volatile__ unsigned long tsc_in;
 
     perfc_incr(irqs);
 
@@ -123,7 +133,10 @@ asmlinkage void do_IRQ(struct cpu_user_r
     if ( likely(desc->status & IRQ_GUEST) )
     {
         irq_enter();
+        if(tb_init_done)
+            tsc_in = (unsigned long)get_cycles();
         __do_IRQ_guest(vector);
+        trace_irq(vector, tsc_in, get_cycles());
         irq_exit();
         spin_unlock(&desc->lock);
         return;
@@ -147,7 +160,10 @@ asmlinkage void do_IRQ(struct cpu_user_r
         desc->status &= ~IRQ_PENDING;
         irq_enter();
         spin_unlock_irq(&desc->lock);
+        if(tb_init_done)
+            tsc_in = (unsigned long)get_cycles();
         action->handler(vector_to_irq(vector), action->dev_id, regs);
+        trace_irq(vector, tsc_in, get_cycles());
         spin_lock_irq(&desc->lock);
         irq_exit();
     }
xen/include/public/trace.h +1 -0
diff -r 7a73e3aeb224 xen/include/public/trace.h
@@ -59,6 +59,7 @@
 #define TRC_LOST_RECORDS        (TRC_GEN + 1)
 #define TRC_TRACE_WRAP_BUFFER  (TRC_GEN + 2)
 #define TRC_TRACE_CPU_CHANGE    (TRC_GEN + 3)
+#define TRC_TRACE_IRQ           (TRC_GEN + 4)
 
 #define TRC_SCHED_RUNSTATE_CHANGE   (TRC_SCHED_MIN + 1)
 #define TRC_SCHED_CONTINUE_RUNNING  (TRC_SCHED_MIN + 2)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#9 lore raw

Hi Keir,

Can you consider this for check-in.

-dulloor

2009/5/11 Dulloor <[email protected]>

Quoted 6 lines

- Changed the name to trace_irq :)

- trace_irq dumps just tsc_in and tsc_out values in a single record. I guess there is no need to write two records (wasting trace-buf mem, more processing, additional logic in xentrace and/or xentrace_format).

Quoted 62 lines

- xentrace_format does what Dan wanted.

-dulloor

2009/5/11 Tian, Kevin <[email protected]>

I guess you can handle it much simpler by stamping a record in both

Quoted 54 lines

irq_enter and irq_exit. All the statistics jobs are left for xentrace script to digest.

Also I'd call it as trace_irq instead of trace_guest_irq. :-)

Thanks,
Kevin

------------------------------
*From:* [email protected] [mailto:
[email protected]] *On Behalf Of *Dulloor *Sent:* 2009年5月9日 17:12
*To:* Keir Fraser
*Cc:* Ian Pratt; Xen-Devel (E-mail); Dan Magenheimer *Subject:* Re: [Xen-devel] Re: [PATCH] add long interrupt measurement capability

Here is a xentrace patch.

- Should irq_desc_measure_t move to some .h file ?
- I have defined the new trace event in general class. Is it fine ?

- I have defined tsc_in as volatile to avoid initializing it in the main code path.

thanks
dulloor

Quoted 23 lines · Keir Fraser
Quoted 8 lines · Ian Pratt
Quoted 6 lines

Perhaps. However measuring cycles is important and, more specifically, measuring MAX cycles spent across a set of interrupts. As a result, I suspect any code that measures this (regardless of whether the result is reported by xentrace or debug-key) would likely encounter the same objection from Keir.

I can't imagine there'd be any objection to adding trace macros to

record

Quoted 1 line

this. The xentrace log processing tool can then be updated to generate

max or

Quoted 1 line

histogram values.

Yes, xentrace records would be okay. It's adding another debug key and printing to Xen console for this purpose which I do not think is worthwhile.

-- Keir

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#10 lore raw

I applied it earlier today.

Quoted 83 lines · Dulloor

Hi Keir,

Can you consider this for check-in.

-dulloor

2009/5/11 Dulloor <[email protected]>

Quoted 74 lines

- Changed the name to trace_irq :)

- trace_irq dumps just tsc_in and tsc_out values in a single record. I guess there is no need to write two records (wasting trace-buf mem, more processing, additional logic in xentrace and/or xentrace_format).

- xentrace_format does what Dan wanted.

-dulloor

2009/5/11 Tian, Kevin <[email protected]>

Quoted 61 lines

I guess you can handle it much simpler by stamping a record in both irq_enter and irq_exit. All the statistics jobs are left for xentrace script to digest.

Also I'd call it as trace_irq instead of trace_guest_irq. :-)

Thanks,
Kevin

Quoted 52 lines

From: [email protected]
[mailto:[email protected]] On Behalf Of Dulloor
Sent: 2009年5月9日 17:12
To: Keir Fraser
Cc: Ian Pratt; Xen-Devel (E-mail); Dan Magenheimer

Subject: Re: [Xen-devel] Re: [PATCH] add long interrupt measurement capability

Here is a xentrace patch.

- Should irq_desc_measure_t move to some .h file ?
- I have defined the new trace event in general class. Is it fine ?

- I have defined tsc_in as volatile to avoid initializing it in the main code path.

thanks
dulloor

Quoted 23 lines · Keir Fraser
Quoted 7 lines · Ian Pratt
Quoted 6 lines

Perhaps. However measuring cycles is important and, more specifically, measuring MAX cycles spent across a set of interrupts. As a result, I suspect any code that measures this (regardless of whether the result is reported by
xentrace or debug-key) would likely encounter the same objection from Keir.

Quoted 5 lines

I can't imagine there'd be any objection to adding trace macros to record
this. The xentrace log processing tool can then be updated to generate max or
histogram values.

Yes, xentrace records would be okay. It's adding another debug key and printing to Xen console for this purpose which I do not think is worthwhile.

-- Keir

#11 lore raw
In reply to Keir Fraser
Quoted 10 lines
Quoted 2 lines

I can't imagine there'd be any objection to adding trace

macros to record

Quoted 1 line

this. The xentrace log processing tool can then be updated

to generate max or

Quoted 1 line

histogram values.

Yes, xentrace records would be okay. It's adding another debug key and printing to Xen console for this purpose which I do not think is worthwhile.

Well, for the record, the original patch does NOT add another debug key, it just adds data to an existing one.