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-changelog

[Xen-changelog] [xen-unstable] x86 Cx tracing: export the Cx exit reason

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86 Cx tracing: export the Cx exit reason (pending interrupt during Cx)
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 29 Jun 2009 03:20:21 -0700
Delivery-date: Mon, 29 Jun 2009 03:21:00 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1246269710 -3600
# Node ID 41317562d3329826ad1fadca16b519af335e7e72
# Parent  15cf6f0009d30d5a772d628f5381a01360d87502
x86 Cx tracing: export the Cx exit reason (pending interrupt during Cx)

Signed-off-by: Lu Guanqun <guanqun.lu@xxxxxxxxx>
---
 tools/xentrace/formats       |    2 +-
 xen/arch/x86/acpi/cpu_idle.c |   32 +++++++++++++++++++++++++++++---
 xen/include/xen/trace.h      |   15 +++++++++++++++
 3 files changed, 45 insertions(+), 4 deletions(-)

diff -r 15cf6f0009d3 -r 41317562d332 tools/xentrace/formats
--- a/tools/xentrace/formats    Mon Jun 29 11:00:56 2009 +0100
+++ b/tools/xentrace/formats    Mon Jun 29 11:01:50 2009 +0100
@@ -122,4 +122,4 @@ 0x0040f10f  CPU%(cpu)d  %(tsc)d (+%(relt
 
 0x00801001  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  cpu_freq_change [ %(1)dMHz -> 
%(2)dMHz ]
 0x00802001  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  cpu_idle_entry  [ C0 -> 
C%(1)d, acpi_pm_tick = %(2)d, expected = %(3)dus, predicted = %(4)dus ]
-0x00802002  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  cpu_idle_exit   [ C%(1)d -> 
C0, acpi_pm_tick = %(2)d ]
+0x00802002  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  cpu_idle_exit   [ C%(1)d -> 
C0, acpi_pm_tick = %(2)d, irq = %(3)d %(4)d %(5)d %(6)d ]
diff -r 15cf6f0009d3 -r 41317562d332 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c      Mon Jun 29 11:00:56 2009 +0100
+++ b/xen/arch/x86/acpi/cpu_idle.c      Mon Jun 29 11:01:50 2009 +0100
@@ -190,6 +190,28 @@ static struct {
     unsigned int count;
 } c3_cpu_status = { .lock = SPIN_LOCK_UNLOCKED };
 
+static inline void trace_exit_reason(u32 *irq_traced)
+{
+#ifdef DEBUG
+    if ( unlikely(tb_init_done) )
+    {
+        int i, curbit;
+        u32 irr_status[8] = { 0 };
+
+        /* Get local apic IRR register */
+        for ( i = 0; i < 8; i++ )
+            irr_status[i] = apic_read(APIC_IRR + (i << 4));
+        i = 0;
+        curbit = find_first_bit((const unsigned long *)irr_status, 256);
+        while ( i < 4 && curbit < 256 )
+        {
+            irq_traced[i++] = curbit;
+            curbit = find_next_bit((const unsigned long *)irr_status, 256, 
curbit + 1);
+        }
+    }
+#endif
+}
+
 static void acpi_processor_idle(void)
 {
     struct acpi_processor_power *power = processor_powers[smp_processor_id()];
@@ -198,6 +220,7 @@ static void acpi_processor_idle(void)
     int sleep_ticks = 0;
     u32 t1, t2 = 0;
     u32 exp = 0, pred = 0;
+    u32 irq_traced[4] = { 0 };
 
     cpufreq_dbs_timer_suspend();
 
@@ -267,9 +290,10 @@ static void acpi_processor_idle(void)
             acpi_idle_do_entry(cx);
             /* Get end time (ticks) */
             t2 = inl(pmtmr_ioport);
+            trace_exit_reason(irq_traced);
             /* Trace cpu idle exit */
-            TRACE_2D(TRC_PM_IDLE_EXIT, cx->idx, t2);
-
+            TRACE_6D(TRC_PM_IDLE_EXIT, cx->idx, t2,
+                     irq_traced[0], irq_traced[1], irq_traced[2], 
irq_traced[3]);
             /* Re-enable interrupts */
             local_irq_enable();
             /* Compute time (ticks) that we were actually asleep */
@@ -326,8 +350,10 @@ static void acpi_processor_idle(void)
 
         /* recovering TSC */
         cstate_restore_tsc();
+        trace_exit_reason(irq_traced);
         /* Trace cpu idle exit */
-        TRACE_2D(TRC_PM_IDLE_EXIT, cx->idx, t2);
+        TRACE_6D(TRC_PM_IDLE_EXIT, cx->idx, t2,
+                 irq_traced[0], irq_traced[1], irq_traced[2], irq_traced[3]);
 
         if ( power->flags.bm_check && power->flags.bm_control )
         {
diff -r 15cf6f0009d3 -r 41317562d332 xen/include/xen/trace.h
--- a/xen/include/xen/trace.h   Mon Jun 29 11:00:56 2009 +0100
+++ b/xen/include/xen/trace.h   Mon Jun 29 11:01:50 2009 +0100
@@ -111,4 +111,19 @@ static inline void trace_var(u32 event, 
         }                                                       \
     } while ( 0 )
 
+#define TRACE_6D(_e,d1,d2,d3,d4,d5,d6)                             \
+    do {                                                        \
+        if ( unlikely(tb_init_done) )                           \
+        {                                                       \
+            u32 _d[6];                                          \
+            _d[0] = d1;                                         \
+            _d[1] = d2;                                         \
+            _d[2] = d3;                                         \
+            _d[3] = d4;                                         \
+            _d[4] = d5;                                         \
+            _d[5] = d6;                                         \
+            __trace_var(_e, 1, sizeof(*_d)*6, (unsigned char *)_d); \
+        }                                                       \
+    } while ( 0 )
+
 #endif /* __XEN_TRACE_H__ */

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86 Cx tracing: export the Cx exit reason (pending interrupt during Cx), Xen patchbot-unstable <=