[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Extra tracing in Xen to support XenMon.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID e580f80518881f2642703230dfdfa21bfdb21ff4
# Parent  6e3e98e1c182b5416f1e73c0999e2ac87e01964d
Extra tracing in Xen to support XenMon. 
Signed-off-by: Rob Gardner <rob.gardner@xxxxxx>

I also appied some fixes and simplifications to the tracing.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 6e3e98e1c182 -r e580f8051888 xen/common/grant_table.c
--- a/xen/common/grant_table.c  Tue Nov 15 10:36:44 2005
+++ b/xen/common/grant_table.c  Tue Nov 15 13:59:59 2005
@@ -29,6 +29,7 @@
 #include <xen/shadow.h>
 #include <xen/mm.h>
 #include <acm/acm_hooks.h>
+#include <xen/trace.h>
 
 #if defined(CONFIG_X86_64)
 #define GRANT_PTE_FLAGS (_PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
@@ -379,6 +380,8 @@
         }
     }
 
+    TRACE_1D(TRC_MEM_PAGE_GRANT_MAP, dom);
+
     ld->grant_table->maptrack[handle].domid         = dom;
     ld->grant_table->maptrack[handle].ref_and_flags =
         (ref << MAPTRACK_REF_SHIFT) |
@@ -462,6 +465,8 @@
         (void)__put_user(GNTST_bad_domain, &uop->status);
         return GNTST_bad_domain;
     }
+
+    TRACE_1D(TRC_MEM_PAGE_GRANT_UNMAP, dom);
 
     act = &rd->grant_table->active[ref];
     sha = &rd->grant_table->shared[ref];
@@ -802,6 +807,8 @@
         page_set_owner(page, e);
         
         spin_unlock(&e->page_alloc_lock);
+
+        TRACE_1D(TRC_MEM_PAGE_GRANT_TRANSFER, e->domain_id);
         
         /* Tell the guest about its new page frame. */
         sha = &e->grant_table->shared[gop->ref];
diff -r 6e3e98e1c182 -r e580f8051888 xen/common/schedule.c
--- a/xen/common/schedule.c     Tue Nov 15 10:36:44 2005
+++ b/xen/common/schedule.c     Tue Nov 15 13:59:59 2005
@@ -12,15 +12,6 @@
  *              implements support functionality for the Xen scheduler API.
  *
  */
-
-/*#define WAKE_HISTO*/
-/*#define BLOCKTIME_HISTO*/
-
-#if defined(WAKE_HISTO)
-#define BUCKETS 31
-#elif defined(BLOCKTIME_HISTO)
-#define BUCKETS 200
-#endif
 
 #include <xen/config.h>
 #include <xen/init.h>
@@ -45,6 +36,8 @@
 static char opt_sched[10] = "sedf";
 string_param("sched", opt_sched);
 
+/*#define WAKE_HISTO*/
+/*#define BLOCKTIME_HISTO*/
 #if defined(WAKE_HISTO)
 #define BUCKETS 31
 #elif defined(BLOCKTIME_HISTO)
@@ -205,9 +198,7 @@
     if ( likely(domain_runnable(v)) )
     {
         SCHED_OP(wake, v);
-#ifdef WAKE_HISTO
         v->wokenup = NOW();
-#endif
     }
     clear_bit(_VCPUF_cpu_migrated, &v->vcpu_flags);
     spin_unlock_irqrestore(&schedule_data[v->processor].schedule_lock, flags);
@@ -416,10 +407,25 @@
         return continue_running(prev);
     }
 
+    TRACE_2D(TRC_SCHED_SWITCH_INFPREV,
+             prev->domain->domain_id, now - prev->lastschd);
+    TRACE_3D(TRC_SCHED_SWITCH_INFNEXT,
+             next->domain->domain_id, now - next->wokenup, r_time);
+
     clear_bit(_VCPUF_running, &prev->vcpu_flags);
     set_bit(_VCPUF_running, &next->vcpu_flags);
 
     perfc_incrc(sched_ctx);
+
+    /*
+     * Logic of wokenup field in domain struct:
+     * Used to calculate "waiting time", which is the time that a domain
+     * spends being "runnable", but not actually running. wokenup is set
+     * set whenever a domain wakes from sleeping. However, if wokenup is not
+     * also set here then a preempted runnable domain will get a screwed up
+     * "waiting time" value next time it is scheduled.
+     */
+    prev->wokenup = NOW();
 
 #if defined(WAKE_HISTO)
     if ( !is_idle_task(next->domain) && next->wokenup )
diff -r 6e3e98e1c182 -r e580f8051888 xen/include/public/trace.h
--- a/xen/include/public/trace.h        Tue Nov 15 10:36:44 2005
+++ b/xen/include/public/trace.h        Tue Nov 15 13:59:59 2005
@@ -14,6 +14,7 @@
 #define TRC_SCHED   0x0002f000    /* Xen Scheduler trace      */
 #define TRC_DOM0OP  0x0004f000    /* Xen DOM0 operation trace */
 #define TRC_VMX     0x0008f000    /* Xen VMX trace            */
+#define TRC_MEM     0x000af000    /* Xen memory trace         */
 #define TRC_ALL     0xfffff000
 
 /* Trace subclasses */
@@ -40,6 +41,12 @@
 #define TRC_SCHED_S_TIMER_FN    (TRC_SCHED + 11)
 #define TRC_SCHED_T_TIMER_FN    (TRC_SCHED + 12)
 #define TRC_SCHED_DOM_TIMER_FN  (TRC_SCHED + 13)
+#define TRC_SCHED_SWITCH_INFPREV (TRC_SCHED + 14)
+#define TRC_SCHED_SWITCH_INFNEXT (TRC_SCHED + 15)
+
+#define TRC_MEM_PAGE_GRANT_MAP      (TRC_MEM + 1)
+#define TRC_MEM_PAGE_GRANT_UNMAP    (TRC_MEM + 2)
+#define TRC_MEM_PAGE_GRANT_TRANSFER (TRC_MEM + 3)
 
 /* trace events per subclass */
 #define TRC_VMX_VMEXIT          (TRC_VMXEXIT + 1)

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.