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

[Xen-devel] [RFC PATCH v1 16/16] xen/tools: tracing of Credit1 SMT domain co-scheduling support



Introduce some new event, related to SMT-aware domain co-scheduling,
in Credit1 code, and their handling and parsing in xenalyze.

Signed-off-by: Dario Faggioli <dfaggioli@xxxxxxxx>
---
Cc: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
---
TODO:
- deal with xentrace_format.
---
 tools/xentrace/xenalyze.c |   74 +++++++++++++++++++++++++++++++++++++++++++--
 xen/common/sched_credit.c |   20 ++++++++++++
 2 files changed, 91 insertions(+), 3 deletions(-)

diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c
index a1e2531945..1d586d30b1 100644
--- a/tools/xentrace/xenalyze.c
+++ b/tools/xentrace/xenalyze.c
@@ -7417,6 +7417,18 @@ void dump_sched_vcpu_action(struct record_info *ri, 
const char *action)
     printf(" %s %s d%uv%u\n", ri->dump_header, action, r->domid, r->vcpuid);
 }
 
+static inline const char *csched_pri_to_string(int pri)
+{
+    switch(pri)
+    {
+        case   0: return "BOOST";
+        case  -1: return "UNDER";
+        case  -2: return "OVER";
+        case -64: return "IDLE";
+        default: return "";
+    }
+}
+
 void sched_process(struct pcpu_info *p)
 {
     struct record_info *ri = &p->ri;
@@ -7632,12 +7644,19 @@ void sched_process(struct pcpu_info *p)
             if(opt.dump_all) {
                 struct {
                     unsigned int cpu:16, tasklet:8, idle:8;
+                    unsigned int vcpuid:16, domid:16;
+                    int pri, cosc_dom;
                 } *r = (typeof(r))ri->d;
 
-                printf(" %s csched:schedule cpu %u%s%s\n",
+                printf(" %s csched:schedule cpu %u curr=d%uv%u prio=%s%s%s",
                        ri->dump_header, r->cpu,
-                       r->tasklet ? ", tasklet scheduled" : "",
-                       r->idle ? ", idle" : ", busy");
+                       r->domid, r->vcpuid, csched_pri_to_string(r->pri),
+                       r->idle ? ", (idle)" : ", (busy)",
+                       r->tasklet ? ", tasklet scheduled" : "");
+                if (r->cosc_dom != -1)
+                    printf(", cosched=d%d\n", r->cosc_dom);
+                else
+                    printf(", cosched=/\n");
             }
             break;
         case TRC_SCHED_CLASS_EVT(CSCHED, 10): /* RATELIMIT     */
@@ -7666,6 +7685,55 @@ void sched_process(struct pcpu_info *p)
                        r->check < 0 ? -r->check : r->check);
             }
             break;
+        case TRC_SCHED_CLASS_EVT(CSCHED, 12): /* RUNQ_NEXT     */
+            if(opt.dump_all) {
+                struct {
+                    unsigned int domid, vcpuid;
+                    int pri;
+                } *r = (typeof(r))ri->d;
+
+                printf(" %s csched:runq_next d%uv%u prio=%s\n",
+                       ri->dump_header, r->domid, r->vcpuid,
+                       csched_pri_to_string(r->pri));
+            }
+            break;
+        case TRC_SCHED_CLASS_EVT(CSCHED, 13): /* COSCHED_DOM   */
+            if(opt.dump_all) {
+                struct {
+                    int cosc_dom;
+                } *r = (typeof(r))ri->d;
+
+                printf(" %s csched:smt_cosched_dom=", ri->dump_header);
+                if (r->cosc_dom != -1)
+                    printf("%d\n", r->cosc_dom);
+                else
+                    printf("/\n");
+            }
+            break;
+        case TRC_SCHED_CLASS_EVT(CSCHED, 14): /* RUNQ_CHECK    */
+            if(opt.dump_all) {
+                struct {
+                    unsigned int domid, vcpuid;
+                    int pri;
+                } *r = (typeof(r))ri->d;
+
+                printf(" %s csched:runq_check d%uv%u prio=%s\n",
+                       ri->dump_header, r->domid, r->vcpuid,
+                       csched_pri_to_string(r->pri));
+            }
+            break;
+        case TRC_SCHED_CLASS_EVT(CSCHED, 15): /* STEAL_DCHECK  */
+            if(opt.dump_all) {
+                struct {
+                    unsigned int domid, vcpuid;
+                    int pri;
+                } *r = (typeof(r))ri->d;
+
+                printf(" %s csched:steal_dom_check d%uv%u prio=%s\n",
+                       ri->dump_header, r->domid, r->vcpuid,
+                       csched_pri_to_string(r->pri));
+            }
+            break;
         /* CREDIT 2 (TRC_CSCHED2_xxx) */
         case TRC_SCHED_CLASS_EVT(CSCHED2, 1): /* TICK              */
         case TRC_SCHED_CLASS_EVT(CSCHED2, 4): /* CREDIT_ADD        */
diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index aecb4e3e05..fc64f58c23 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -136,6 +136,10 @@
 #define TRC_CSCHED_SCHEDULE      TRC_SCHED_CLASS_EVT(CSCHED, 9)
 #define TRC_CSCHED_RATELIMIT     TRC_SCHED_CLASS_EVT(CSCHED, 10)
 #define TRC_CSCHED_STEAL_CHECK   TRC_SCHED_CLASS_EVT(CSCHED, 11)
+#define TRC_CSCHED_RUNQ_NEXT     TRC_SCHED_CLASS_EVT(CSCHED, 12)
+#define TRC_CSCHED_COSCHED_DOM   TRC_SCHED_CLASS_EVT(CSCHED, 13)
+#define TRC_CSCHED_RUNQ_CHECK    TRC_SCHED_CLASS_EVT(CSCHED, 14)
+#define TRC_CSCHED_STEAL_DCHECK  TRC_SCHED_CLASS_EVT(CSCHED, 15)
 
 /*
  * Boot parameters
@@ -1785,6 +1789,8 @@ csched_runq_steal(int peer_cpu, int cpu, int pri, int 
balance_step)
     list_for_each( iter, &peer_pcpu->runq )
     {
         speer = __runq_elem(iter);
+        TRACE_3D(TRC_CSCHED_STEAL_DCHECK, speer->vcpu->domain->domain_id,
+                 speer->vcpu->vcpu_id, speer->pri);
 
         /*
          * If next available VCPU here is not of strictly higher
@@ -2024,10 +2030,17 @@ csched_schedule(
     {
         struct {
             unsigned cpu:16, tasklet:8, idle:8;
+            unsigned vcpu:16, dom:16;
+            int pri, cosc_dom;
         } d;
         d.cpu = cpu;
         d.tasklet = tasklet_work_scheduled;
         d.idle = is_idle_vcpu(current);
+        d.dom = scurr->vcpu->domain->domain_id;
+        d.vcpu = scurr->vcpu->vcpu_id;
+        d.pri = scurr->pri;
+        d.cosc_dom = !sched_smt_cosched || !spc->core->sdom ?
+                     -1 : spc->core->sdom->dom->domain_id;
         __trace_var(TRC_CSCHED_SCHEDULE, 1, sizeof(d),
                     (unsigned char *)&d);
     }
@@ -2135,6 +2148,8 @@ csched_schedule(
         spc->core->sdom = NULL;
 
     snext = __runq_elem(runq->next);
+    TRACE_3D(TRC_CSCHED_RUNQ_NEXT, snext->vcpu->domain->domain_id,
+             snext->vcpu->vcpu_id, snext->pri);
 
     /*
      * If domain co-scheduling is enabled, and a domain is running already
@@ -2152,6 +2167,8 @@ csched_schedule(
         list_for_each( iter, runq )
         {
             siter = __runq_elem(iter);
+            TRACE_3D(TRC_CSCHED_RUNQ_CHECK, siter->vcpu->domain->domain_id,
+                     siter->vcpu->vcpu_id, snext->pri);
 
             /*
              * Don't pick up a vcpu which has lower priority than snext, or
@@ -2219,6 +2236,9 @@ csched_schedule(
         }
     }
 
+    TRACE_1D(TRC_CSCHED_COSCHED_DOM, spc->core->sdom == NULL ?
+             -1 : spc->core->sdom->dom->domain_id);
+
     spin_unlock(&spc->core->lock);
 
     /*


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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