xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Anshul Makkar <anshul.makkar@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	David Vrabel <david.vrabel@citrix.com>
Subject: [PATCH v2 08/11] xen: credit2: only marshall trace point arguments if tracing enabled
Date: Fri, 15 Jul 2016 16:50:04 +0200	[thread overview]
Message-ID: <146859420441.10217.7290796857658609672.stgit@Solace.fritz.box> (raw)
In-Reply-To: <146859397891.10217.10155969474613302167.stgit@Solace.fritz.box>

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
Cc: George Dunlap <george.dunlap@citrix.com>
Cc: Anshul Makkar <anshul.makkar@citrix.com>
Cc: David Vrabel <david.vrabel@citrix.com>
---
Changes from v1:
 * avoid stray code removal in balance_load(), as pointed out by George
   during review.
---
 xen/common/sched_credit2.c |  112 +++++++++++++++++++++++---------------------
 1 file changed, 59 insertions(+), 53 deletions(-)

diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c
index a4aec73..be27ba3 100644
--- a/xen/common/sched_credit2.c
+++ b/xen/common/sched_credit2.c
@@ -638,6 +638,7 @@ __update_runq_load(const struct scheduler *ops,
 
     ASSERT(rqd->avgload <= STIME_MAX && rqd->b_avgload <= STIME_MAX);
 
+    if ( unlikely(tb_init_done) )
     {
         struct {
             uint64_t rq_avgload, b_avgload;
@@ -648,9 +649,9 @@ __update_runq_load(const struct scheduler *ops,
         d.rq_avgload = rqd->avgload;
         d.b_avgload = rqd->b_avgload;
         d.shift = P;
-        trace_var(TRC_CSCHED2_UPDATE_RUNQ_LOAD, 1,
-                  sizeof(d),
-                  (unsigned char *)&d);
+        __trace_var(TRC_CSCHED2_UPDATE_RUNQ_LOAD, 1,
+                    sizeof(d),
+                    (unsigned char *)&d);
     }
 }
 
@@ -693,6 +694,7 @@ __update_svc_load(const struct scheduler *ops,
     }
     svc->load_last_update = now;
 
+    if ( unlikely(tb_init_done) )
     {
         struct {
             uint64_t v_avgload;
@@ -703,9 +705,9 @@ __update_svc_load(const struct scheduler *ops,
         d.vcpu = svc->vcpu->vcpu_id;
         d.v_avgload = svc->avgload;
         d.shift = P;
-        trace_var(TRC_CSCHED2_UPDATE_VCPU_LOAD, 1,
-                  sizeof(d),
-                  (unsigned char *)&d);
+        __trace_var(TRC_CSCHED2_UPDATE_VCPU_LOAD, 1,
+                    sizeof(d),
+                    (unsigned char *)&d);
     }
 }
 
@@ -761,6 +763,7 @@ runq_insert(const struct scheduler *ops, struct csched2_vcpu *svc)
 
     pos = __runq_insert(runq, svc);
 
+    if ( unlikely(tb_init_done) )
     {
         struct {
             unsigned vcpu:16, dom:16;
@@ -769,9 +772,9 @@ runq_insert(const struct scheduler *ops, struct csched2_vcpu *svc)
         d.dom = svc->vcpu->domain->domain_id;
         d.vcpu = svc->vcpu->vcpu_id;
         d.pos = pos;
-        trace_var(TRC_CSCHED2_RUNQ_POS, 1,
-                  sizeof(d),
-                  (unsigned char *)&d);
+        __trace_var(TRC_CSCHED2_RUNQ_POS, 1,
+                    sizeof(d),
+                    (unsigned char *)&d);
     }
 
     return;
@@ -814,7 +817,7 @@ runq_tickle(const struct scheduler *ops, struct csched2_vcpu *new, s_time_t now)
 
     ASSERT(new->rqd == rqd);
 
-    /* TRACE */
+    if ( unlikely(tb_init_done) )
     {
         struct {
             unsigned vcpu:16, dom:16;
@@ -824,9 +827,9 @@ runq_tickle(const struct scheduler *ops, struct csched2_vcpu *new, s_time_t now)
         d.vcpu = new->vcpu->vcpu_id;
         d.processor = new->vcpu->processor;
         d.credit = new->credit;
-        trace_var(TRC_CSCHED2_TICKLE_NEW, 1,
-                  sizeof(d),
-                  (unsigned char *)&d);
+        __trace_var(TRC_CSCHED2_TICKLE_NEW, 1,
+                    sizeof(d),
+                    (unsigned char *)&d);
     }
 
     /*
@@ -884,7 +887,8 @@ runq_tickle(const struct scheduler *ops, struct csched2_vcpu *new, s_time_t now)
             lowest = cur->credit;
         }
 
-        /* TRACE */ {
+        if ( unlikely(tb_init_done) )
+        {
             struct {
                 unsigned vcpu:16, dom:16;
                 unsigned credit;
@@ -892,9 +896,9 @@ runq_tickle(const struct scheduler *ops, struct csched2_vcpu *new, s_time_t now)
             d.dom = cur->vcpu->domain->domain_id;
             d.vcpu = cur->vcpu->vcpu_id;
             d.credit = cur->credit;
-            trace_var(TRC_CSCHED2_TICKLE_CHECK, 1,
-                      sizeof(d),
-                      (unsigned char *)&d);
+            __trace_var(TRC_CSCHED2_TICKLE_CHECK, 1,
+                        sizeof(d),
+                        (unsigned char *)&d);
         }
     }
 
@@ -912,14 +916,15 @@ runq_tickle(const struct scheduler *ops, struct csched2_vcpu *new, s_time_t now)
  tickle:
     BUG_ON(ipid == -1);
 
-    /* TRACE */ {
+    if ( unlikely(tb_init_done) )
+    {
         struct {
             unsigned cpu:16, pad:16;
         } d;
         d.cpu = ipid; d.pad = 0;
-        trace_var(TRC_CSCHED2_TICKLE, 1,
-                  sizeof(d),
-                  (unsigned char *)&d);
+        __trace_var(TRC_CSCHED2_TICKLE, 1,
+                    sizeof(d),
+                    (unsigned char *)&d);
     }
     __cpumask_set_cpu(ipid, &rqd->tickled);
     cpu_raise_softirq(ipid, SCHEDULE_SOFTIRQ);
@@ -981,7 +986,8 @@ static void reset_credit(const struct scheduler *ops, int cpu, s_time_t now,
 
         svc->start_time = now;
 
-        /* TRACE */ {
+        if ( unlikely(tb_init_done) )
+        {
             struct {
                 unsigned vcpu:16, dom:16;
                 unsigned credit_start, credit_end;
@@ -992,9 +998,9 @@ static void reset_credit(const struct scheduler *ops, int cpu, s_time_t now,
             d.credit_start = start_credit;
             d.credit_end = svc->credit;
             d.multiplier = m;
-            trace_var(TRC_CSCHED2_CREDIT_RESET, 1,
-                      sizeof(d),
-                      (unsigned char *)&d);
+            __trace_var(TRC_CSCHED2_CREDIT_RESET, 1,
+                        sizeof(d),
+                        (unsigned char *)&d);
         }
     }
 
@@ -1030,7 +1036,7 @@ void burn_credits(struct csched2_runqueue_data *rqd,
                  __func__, now, svc->start_time);
     }
 
-    /* TRACE */
+    if ( unlikely(tb_init_done) )
     {
         struct {
             unsigned vcpu:16, dom:16;
@@ -1041,9 +1047,9 @@ void burn_credits(struct csched2_runqueue_data *rqd,
         d.vcpu = svc->vcpu->vcpu_id;
         d.credit = svc->credit;
         d.delta = delta;
-        trace_var(TRC_CSCHED2_CREDIT_BURN, 1,
-                  sizeof(d),
-                  (unsigned char *)&d);
+        __trace_var(TRC_CSCHED2_CREDIT_BURN, 1,
+                    sizeof(d),
+                    (unsigned char *)&d);
     }
 }
 
@@ -1079,16 +1085,16 @@ static void update_max_weight(struct csched2_runqueue_data *rqd, int new_weight,
         SCHED_STAT_CRANK(upd_max_weight_full);
     }
 
-    /* TRACE */
+    if ( unlikely(tb_init_done) )
     {
         struct {
             unsigned rqi:16, max_weight:16;
         } d;
         d.rqi = rqd->id;
         d.max_weight = rqd->max_weight;
-        trace_var(TRC_CSCHED2_RUNQ_MAX_WEIGHT, 1,
-                  sizeof(d),
-                  (unsigned char *)&d);
+        __trace_var(TRC_CSCHED2_RUNQ_MAX_WEIGHT, 1,
+                    sizeof(d),
+                    (unsigned char *)&d);
     }
 }
 
@@ -1168,7 +1174,7 @@ __runq_assign(struct csched2_vcpu *svc, struct csched2_runqueue_data *rqd)
     /* Expected new load based on adding this vcpu */
     rqd->b_avgload += svc->avgload;
 
-    /* TRACE */
+    if ( unlikely(tb_init_done) )
     {
         struct {
             unsigned vcpu:16, dom:16;
@@ -1177,9 +1183,9 @@ __runq_assign(struct csched2_vcpu *svc, struct csched2_runqueue_data *rqd)
         d.dom = svc->vcpu->domain->domain_id;
         d.vcpu = svc->vcpu->vcpu_id;
         d.rqi=rqd->id;
-        trace_var(TRC_CSCHED2_RUNQ_ASSIGN, 1,
-                  sizeof(d),
-                  (unsigned char *)&d);
+        __trace_var(TRC_CSCHED2_RUNQ_ASSIGN, 1,
+                    sizeof(d),
+                    (unsigned char *)&d);
     }
 
 }
@@ -1491,7 +1497,7 @@ csched2_cpu_pick(const struct scheduler *ops, struct vcpu *vc)
 out_up:
     spin_unlock(&prv->lock);
 
-    /* TRACE */
+    if ( unlikely(tb_init_done) )
     {
         struct {
             uint64_t b_avgload;
@@ -1503,9 +1509,9 @@ out_up:
         d.vcpu = vc->vcpu_id;
         d.rq_id = c2r(ops, new_cpu);
         d.new_cpu = new_cpu;
-        trace_var(TRC_CSCHED2_PICKED_CPU, 1,
-                  sizeof(d),
-                  (unsigned char *)&d);
+        __trace_var(TRC_CSCHED2_PICKED_CPU, 1,
+                    sizeof(d),
+                    (unsigned char *)&d);
     }
 
     return new_cpu;
@@ -1560,7 +1566,7 @@ static void migrate(const struct scheduler *ops,
                     struct csched2_runqueue_data *trqd, 
                     s_time_t now)
 {
-    /* TRACE */
+    if ( unlikely(tb_init_done) )
     {
         struct {
             unsigned vcpu:16, dom:16;
@@ -1570,9 +1576,9 @@ static void migrate(const struct scheduler *ops,
         d.vcpu = svc->vcpu->vcpu_id;
         d.rqi = svc->rqd->id;
         d.trqi = trqd->id;
-        trace_var(TRC_CSCHED2_MIGRATE, 1,
-                  sizeof(d),
-                  (unsigned char *)&d);
+        __trace_var(TRC_CSCHED2_MIGRATE, 1,
+                    sizeof(d),
+                    (unsigned char *)&d);
     }
 
     if ( svc->flags & CSFLAG_scheduled )
@@ -1698,7 +1704,7 @@ retry:
         if ( i > cpus_max )
             cpus_max = i;
 
-        /* TRACE */
+        if ( unlikely(tb_init_done) )
         {
             struct {
                 unsigned lrq_id:16, orq_id:16;
@@ -1707,9 +1713,9 @@ retry:
             d.lrq_id = st.lrqd->id;
             d.orq_id = st.orqd->id;
             d.load_delta = st.load_delta;
-            trace_var(TRC_CSCHED2_LOAD_CHECK, 1,
-                      sizeof(d),
-                      (unsigned char *)&d);
+            __trace_var(TRC_CSCHED2_LOAD_CHECK, 1,
+                        sizeof(d),
+                        (unsigned char *)&d);
         }
 
         /*
@@ -1740,7 +1746,7 @@ retry:
     if ( unlikely(st.orqd->id < 0) )
         goto out_up;
 
-    /* TRACE */
+    if ( unlikely(tb_init_done) )
     {
         struct {
             uint64_t lb_avgload, ob_avgload;
@@ -1750,9 +1756,9 @@ retry:
         d.lb_avgload = st.lrqd->b_avgload;
         d.orq_id = st.orqd->id;
         d.ob_avgload = st.orqd->b_avgload;
-        trace_var(TRC_CSCHED2_LOAD_BALANCE, 1,
-                  sizeof(d),
-                  (unsigned char *)&d);
+        __trace_var(TRC_CSCHED2_LOAD_BALANCE, 1,
+                    sizeof(d),
+                    (unsigned char *)&d);
     }
 
     /* Look for "swap" which gives the best load average


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-07-15 14:50 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-15 14:49 [PATCH v2 00/11] xen: sched: assorted fixes and improvements to Credit2 Dario Faggioli
2016-07-15 14:49 ` [PATCH v2 01/11] xen: sched: leave CPUs doing tasklet work alone Dario Faggioli
2016-07-18 14:35   ` George Dunlap
2016-07-15 14:49 ` [PATCH v2 02/11] xen: credit2: prevent load balancing to go mad if time goes backwards Dario Faggioli
2016-07-15 14:49 ` [PATCH v2 03/11] xen: credit2: rework load tracking logic Dario Faggioli
2016-07-18 14:46   ` George Dunlap
2016-07-18 14:51     ` Dario Faggioli
2016-07-15 14:49 ` [PATCH v2 04/11] xen/tools: improve tracing of Credit2 load tracking events Dario Faggioli
2016-07-18 15:38   ` Wei Liu
2016-07-15 14:49 ` [PATCH v2 05/11] xen: credit2: use non-atomic cpumask and bit operations Dario Faggioli
2016-07-15 14:49 ` [PATCH v2 06/11] xen: credit2: make the code less experimental Dario Faggioli
2016-07-18 15:04   ` George Dunlap
2016-07-15 14:49 ` [PATCH v2 07/11] xen: credit2: add yet some more tracing Dario Faggioli
2016-07-15 14:50 ` Dario Faggioli [this message]
2016-07-18 15:10   ` [PATCH v2 08/11] xen: credit2: only marshall trace point arguments if tracing enabled George Dunlap
2016-07-15 14:50 ` [PATCH v2 09/11] tools: tracing: deal with new Credit2 events Dario Faggioli
2016-07-18 15:39   ` Wei Liu
2016-07-15 14:50 ` [PATCH v2 10/11] xen: credit2: the private scheduler lock can be an rwlock Dario Faggioli
2016-07-15 14:50 ` [PATCH v2 11/11] xen: credit2: implement true SMT support Dario Faggioli
2016-07-18 16:48   ` George Dunlap
2016-07-18 17:24     ` Dario Faggioli
2016-07-19  9:39       ` George Dunlap
2016-07-19  9:57         ` Dario Faggioli
2016-07-19 10:05           ` George Dunlap
2016-07-19 10:19             ` Dario Faggioli
2016-07-18 17:21 ` [PATCH v2 00/11] xen: sched: assorted fixes and improvements to Credit2 George Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=146859420441.10217.7290796857658609672.stgit@Solace.fritz.box \
    --to=dario.faggioli@citrix.com \
    --cc=anshul.makkar@citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).