Skip to contentSkip to conversation

xen: sched: rework and add performance counters

PATCH In review Dario Faggioli 3 participants 13 messages Feb 27, 2015 – Mar 17, 2015

lore
Share & tools
lore
#0 lore raw

v2 cover xen: sched: rework and add performance counters

Take 2 of this:

http://lists.xen.org/archives/html/xen-devel/2015-02/msg03249.html

I've made all the changes suggested during v1.

The series has Meng's Reviewed-by for the changes to sched_rt.c, and Jan's Ack for the non-strictly scheduling related part (1 file! :-D), so I think what is missing is George's view/Ack.

Thanks and Regards,
Dario

---
Dario Faggioli (4):
xen: sched: honour generic perf conuters in the RTDS scheduler
xen: sched: make counters for vCPU sleep and wakeup generic
xen: sched: make counters for vCPU tickling generic
xen: credit2: add a few performance counters

 xen/common/sched_credit2.c   |   39 +++++++++++++++++++++++++++++++++++----
 xen/common/sched_rt.c        |   18 ++++++++++++++++++
 xen/include/xen/perfc_defn.h |   29 +++++++++++++++++++++--------
 3 files changed, 74 insertions(+), 12 deletions(-)

--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

#1 lore raw

PATCH v2 1/4 xen: sched: honour generic perf conuters in the RTDS scheduler

more specifically, about vCPU initialization and destruction events, in line with adb26c09f26e ("xen: sched: introduce a couple of counters in credit2 and SEDF").

Cc George Dunlap <[email protected]>
Cc Meng Xu <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
---
 xen/common/sched_rt.c |    4 ++++
 1 file changed, 4 insertions(+)
xen/common/sched_rt.c +4 -0
index df4adac..58dd646 100644
@@ -525,6 +525,8 @@ rt_alloc_vdata(const struct scheduler *ops, struct vcpu *vc, void *dd)
     if ( !is_idle_vcpu(vc) )
         svc->budget = RTDS_DEFAULT_BUDGET;
 
+    SCHED_STAT_CRANK(vcpu_init);
+
     return svc;
 }
 
@@ -574,6 +576,8 @@ rt_vcpu_remove(const struct scheduler *ops, struct vcpu *vc)
     struct rt_dom * const sdom = svc->sdom;
     spinlock_t *lock;
 
+    SCHED_STAT_CRANK(vcpu_destroy);
+
     BUG_ON( sdom == NULL );
 
     lock = vcpu_schedule_lock_irq(vc);
Reviewed-by on v2 1/4
#2 lore raw

Re: [PATCH v2 1/4] xen: sched: honour generic perf conuters in the RTDS scheduler

Quoted 10 lines · Dario Faggioli

more specifically, about vCPU initialization and destruction events, in line with adb26c09f26e ("xen: sched: introduce a couple of counters in credit2 and SEDF").

Cc George Dunlap <[email protected]>
Cc Meng Xu <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Quoted 27 lines
---
 xen/common/sched_rt.c |    4 ++++
 1 file changed, 4 insertions(+)
xen/common/sched_rt.c +4 -0
index df4adac..58dd646 100644
@@ -525,6 +525,8 @@ rt_alloc_vdata(const struct scheduler *ops, struct vcpu *vc, void *dd)
     if ( !is_idle_vcpu(vc) )
         svc->budget = RTDS_DEFAULT_BUDGET;
 
+    SCHED_STAT_CRANK(vcpu_init);
+
     return svc;
 }
 
@@ -574,6 +576,8 @@ rt_vcpu_remove(const struct scheduler *ops, struct vcpu *vc)
     struct rt_dom * const sdom = svc->sdom;
     spinlock_t *lock;
 
+    SCHED_STAT_CRANK(vcpu_destroy);
+
     BUG_ON( sdom == NULL );
 
     lock = vcpu_schedule_lock_irq(vc);
#3 lore raw

PATCH v2 2/4 xen: sched: make counters for vCPU sleep and wakeup generic

In reply to Dario Faggioli

and update them from Credit2 and RTDS. In Credit2, while there, remove some stale comments too.

---
 xen/common/sched_credit2.c   |   12 ++++++++----
 xen/common/sched_rt.c        |   12 ++++++++++++
 xen/include/xen/perfc_defn.h |   10 +++++-----
 3 files changed, 25 insertions(+), 9 deletions(-)
xen/common/sched_credit2.c +8 -4
index ad0a5d4..2b852cc 100644
@@ -931,6 +931,7 @@ csched2_vcpu_sleep(const struct scheduler *ops, struct vcpu *vc)
     struct csched2_vcpu * const svc = CSCHED2_VCPU(vc);
 
     BUG_ON( is_idle_vcpu(vc) );
+    SCHED_STAT_CRANK(vcpu_sleep);
 
     if ( per_cpu(schedule_data, vc->processor).curr == vc )
         cpu_raise_softirq(vc->processor, SCHEDULE_SOFTIRQ);
@@ -956,19 +957,22 @@ csched2_vcpu_wake(const struct scheduler *ops, struct vcpu *vc)
 
     BUG_ON( is_idle_vcpu(vc) );
 
-    /* Make sure svc priority mod happens before runq check */
     if ( unlikely(per_cpu(schedule_data, vc->processor).curr == vc) )
     {
+        SCHED_STAT_CRANK(vcpu_wake_running);
         goto out;
     }
-
     if ( unlikely(__vcpu_on_runq(svc)) )
     {
-        /* If we've boosted someone that's already on a runqueue, prioritize
-         * it and inform the cpu in question. */
+        SCHED_STAT_CRANK(vcpu_wake_onrunq);
         goto out;
     }
 
+    if ( likely(vcpu_runnable(vc)) )
+        SCHED_STAT_CRANK(vcpu_wake_runnable);
+    else
+        SCHED_STAT_CRANK(vcpu_wake_not_runnable);
+
     /* If the context hasn't been saved for this vcpu yet, we can't put it on
      * another runqueue.  Instead, we set a flag so that it will be put on the runqueue
      * after the context has been saved. */
xen/common/sched_rt.c +12 -0
index 58dd646..49d1b83 100644
@@ -851,6 +851,7 @@ rt_vcpu_sleep(const struct scheduler *ops, struct vcpu *vc)
     struct rt_vcpu * const svc = rt_vcpu(vc);
 
     BUG_ON( is_idle_vcpu(vc) );
+    SCHED_STAT_CRANK(vcpu_sleep);
 
     if ( curr_on_cpu(vc->processor) == vc )
         cpu_raise_softirq(vc->processor, SCHEDULE_SOFTIRQ);
@@ -966,11 +967,22 @@ rt_vcpu_wake(const struct scheduler *ops, struct vcpu *vc)
     BUG_ON( is_idle_vcpu(vc) );
 
     if ( unlikely(curr_on_cpu(vc->processor) == vc) )
+    {
+        SCHED_STAT_CRANK(vcpu_wake_running);
         return;
+    }
 
     /* on RunQ/DepletedQ, just update info is ok */
     if ( unlikely(__vcpu_on_q(svc)) )
+    {
+        SCHED_STAT_CRANK(vcpu_wake_onrunq);
         return;
+    }
+
+    if ( likely(vcpu_runnable(vc)) )
+        SCHED_STAT_CRANK(vcpu_wake_runnable);
+    else
+        SCHED_STAT_CRANK(vcpu_wake_not_runnable);
 
     /* If context hasn't been saved for this vcpu yet, we can't put it on
      * the Runqueue/DepletedQ. Instead, we set a flag so that it will be
xen/include/xen/perfc_defn.h +5 -5
index 3ac7b45..2dc78fe 100644
@@ -21,6 +21,11 @@ PERFCOUNTER(dom_init,               "sched: dom_init")
 PERFCOUNTER(dom_destroy,            "sched: dom_destroy")
 PERFCOUNTER(vcpu_init,              "sched: vcpu_init")
 PERFCOUNTER(vcpu_destroy,           "sched: vcpu_destroy")
+PERFCOUNTER(vcpu_sleep,             "sched: vcpu_sleep")
+PERFCOUNTER(vcpu_wake_running,      "sched: vcpu_wake_running")
+PERFCOUNTER(vcpu_wake_onrunq,       "sched: vcpu_wake_onrunq")
+PERFCOUNTER(vcpu_wake_runnable,     "sched: vcpu_wake_runnable")
+PERFCOUNTER(vcpu_wake_not_runnable, "sched: vcpu_wake_not_runnable")
 
 /* credit specific counters */
 PERFCOUNTER(delay_ms,               "csched: delay")
@@ -32,11 +37,6 @@ PERFCOUNTER(acct_reorder,           "csched: acct_reorder")
 PERFCOUNTER(acct_min_credit,        "csched: acct_min_credit")
 PERFCOUNTER(acct_vcpu_active,       "csched: acct_vcpu_active")
 PERFCOUNTER(acct_vcpu_idle,         "csched: acct_vcpu_idle")
-PERFCOUNTER(vcpu_sleep,             "csched: vcpu_sleep")
-PERFCOUNTER(vcpu_wake_running,      "csched: vcpu_wake_running")
-PERFCOUNTER(vcpu_wake_onrunq,       "csched: vcpu_wake_onrunq")
-PERFCOUNTER(vcpu_wake_runnable,     "csched: vcpu_wake_runnable")
-PERFCOUNTER(vcpu_wake_not_runnable, "csched: vcpu_wake_not_runnable")
 PERFCOUNTER(vcpu_park,              "csched: vcpu_park")
 PERFCOUNTER(vcpu_unpark,            "csched: vcpu_unpark")
 PERFCOUNTER(tickle_idlers_none,     "csched: tickle_idlers_none")
Acked-by on v2 2/4
#4 lore raw

Re: [PATCH v2 2/4] xen: sched: make counters for vCPU sleep and wakeup generic

Quoted 10 lines · Dario Faggioli

and update them from Credit2 and RTDS. In Credit2, while there, remove some stale comments too.

One comment...

Quoted 20 lines
---
 xen/common/sched_credit2.c   |   12 ++++++++----
 xen/common/sched_rt.c        |   12 ++++++++++++
 xen/include/xen/perfc_defn.h |   10 +++++-----
 3 files changed, 25 insertions(+), 9 deletions(-)
xen/common/sched_credit2.c +1 -0
index ad0a5d4..2b852cc 100644
@@ -931,6 +931,7 @@ csched2_vcpu_sleep(const struct scheduler *ops, struct vcpu *vc)
     struct csched2_vcpu * const svc = CSCHED2_VCPU(vc);
 
     BUG_ON( is_idle_vcpu(vc) );
+    SCHED_STAT_CRANK(vcpu_sleep);
 
     if ( per_cpu(schedule_data, vc->processor).curr == vc )
         cpu_raise_softirq(vc->processor, SCHEDULE_SOFTIRQ);
@@ -956,19 +957,22 @@ csched2_vcpu_wake(const struct scheduler *ops, struct vcpu *vc)
 

xen/common/sched_credit2.c csched2_vcpu_wake(const struct scheduler *ops, struct vcpu *vc) · line 965

Quoted 10 lines
xen/common/sched_credit2.c +1 -2
     BUG_ON( is_idle_vcpu(vc) );
 
-    /* Make sure svc priority mod happens before runq check */
     if ( unlikely(per_cpu(schedule_data, vc->processor).curr == vc) )
     {
+        SCHED_STAT_CRANK(vcpu_wake_running);
         goto out;
     }
-
     if ( unlikely(__vcpu_on_runq(svc)) )

Does this make the 'if' butt right up against the '{'? Is that bad?

Other than that:

However, it doesn't apply cleanly at the moment, so you'll probably need to send a refresh. (Sorry for taking so long!)

-George

#5 lore raw

Re: [PATCH v2 2/4] xen: sched: make counters for vCPU sleep and wakeup generic

Quoted 30 lines · George Dunlap
Quoted 14 lines · Dario Faggioli
xen/common/sched_credit2.c +1 -0
index ad0a5d4..2b852cc 100644
@@ -931,6 +931,7 @@ csched2_vcpu_sleep(const struct scheduler *ops, struct vcpu *vc)
     struct csched2_vcpu * const svc = CSCHED2_VCPU(vc);
 
     BUG_ON( is_idle_vcpu(vc) );
+    SCHED_STAT_CRANK(vcpu_sleep);
 
     if ( per_cpu(schedule_data, vc->processor).curr == vc )
         cpu_raise_softirq(vc->processor, SCHEDULE_SOFTIRQ);
@@ -956,19 +957,22 @@ csched2_vcpu_wake(const struct scheduler *ops, struct vcpu *vc)
 

xen/common/sched_credit2.c csched2_vcpu_wake(const struct scheduler *ops, struct vcpu *vc) · line 965

Quoted 10 lines
xen/common/sched_credit2.c +1 -2
     BUG_ON( is_idle_vcpu(vc) );
 
-    /* Make sure svc priority mod happens before runq check */
     if ( unlikely(per_cpu(schedule_data, vc->processor).curr == vc) )
     {
+        SCHED_STAT_CRANK(vcpu_wake_running);
         goto out;
     }
-
     if ( unlikely(__vcpu_on_runq(svc)) )

Does this make the 'if' butt right up against the '{'? Is that bad?

Quoted 4 lines

Other than that:

As far as I can see, the series is in:

http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=8b0e94da0e23221a6d7ea19bfbd24a407db44de8

and whoever committed it (Jan, probably?), took care of leaving that blank line in place, which I'm fine with, of course. :-)

Quoted 3 lines

However, it doesn't apply cleanly at the moment, so you'll probably need to send a refresh. (Sorry for taking so long!)

NP, and thanks for reviewing. I was prepared to refresh and resend, but as I said, it's been checked-in already, so thanks for that! :-D

Regards,
Dario

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

#6 lore raw

Re: [PATCH v2 2/4] xen: sched: make counters for vCPU sleep and wakeup generic

Quoted 33 lines · Dario Faggioli
Quoted 32 lines · George Dunlap
Quoted 14 lines · Dario Faggioli
xen/common/sched_credit2.c +1 -0
index ad0a5d4..2b852cc 100644
@@ -931,6 +931,7 @@ csched2_vcpu_sleep(const struct scheduler *ops, struct vcpu *vc)
     struct csched2_vcpu * const svc = CSCHED2_VCPU(vc);
 
     BUG_ON( is_idle_vcpu(vc) );
+    SCHED_STAT_CRANK(vcpu_sleep);
 
     if ( per_cpu(schedule_data, vc->processor).curr == vc )
         cpu_raise_softirq(vc->processor, SCHEDULE_SOFTIRQ);
@@ -956,19 +957,22 @@ csched2_vcpu_wake(const struct scheduler *ops, struct vcpu *vc)
 

xen/common/sched_credit2.c csched2_vcpu_wake(const struct scheduler *ops, struct vcpu *vc) · line 965

Quoted 10 lines
xen/common/sched_credit2.c +1 -2
     BUG_ON( is_idle_vcpu(vc) );
 
-    /* Make sure svc priority mod happens before runq check */
     if ( unlikely(per_cpu(schedule_data, vc->processor).curr == vc) )
     {
+        SCHED_STAT_CRANK(vcpu_wake_running);
         goto out;
     }
-
     if ( unlikely(__vcpu_on_runq(svc)) )

Does this make the 'if' butt right up against the '{'? Is that bad?

Other than that:

Quoted 8 lines
Quoted 2 lines

As far as I can see, the series is in:

http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=8b0e94da0e23221a6d7ea19bfbd24a407db44de8

and whoever committed it (Jan, probably?), took care of leaving that blank line in place, which I'm fine with, of course. :-)

Sweet. :-)

-George

#7 lore raw

PATCH v2 3/4 xen: sched: make counters for vCPU tickling generic

In reply to Dario Faggioli

and update them from Credit2 and RTDS schedulers.

---
Changes from v1:
* fixed the 'no_tickle' case, in Credit2, as requested during review

---
 xen/common/sched_credit2.c   |    4 ++++
 xen/common/sched_rt.c        |    2 ++
 xen/include/xen/perfc_defn.h |    4 ++--
 3 files changed, 8 insertions(+), 2 deletions(-)
xen/common/sched_credit2.c +4 -0
index 2b852cc..c0f7452 100644
@@ -556,7 +556,10 @@ runq_tickle(const struct scheduler *ops, unsigned int cpu, struct csched2_vcpu *
     /* Only switch to another processor if the credit difference is greater
      * than the migrate resistance */
     if ( ipid == -1 || lowest + CSCHED2_MIGRATE_RESIST > new->credit )
+    {
+        SCHED_STAT_CRANK(tickle_idlers_none);
         goto no_tickle;
+    }
 
 tickle:
     BUG_ON(ipid == -1);
@@ -571,6 +574,7 @@ tickle:
                   (unsigned char *)&d);
     }
     cpumask_set_cpu(ipid, &rqd->tickled);
+    SCHED_STAT_CRANK(tickle_idlers_some);
     cpu_raise_softirq(ipid, SCHEDULE_SOFTIRQ);
 
 no_tickle:
xen/common/sched_rt.c +2 -0
index 49d1b83..2ad0c68 100644
@@ -929,6 +929,7 @@ runq_tickle(const struct scheduler *ops, struct rt_vcpu *new)
     }
 
     /* didn't tickle any cpu */
+    SCHED_STAT_CRANK(tickle_idlers_none);
     return;
 out:
     /* TRACE */
@@ -944,6 +945,7 @@ out:
     }
 
     cpumask_set_cpu(cpu_to_tickle, &prv->tickled);
+    SCHED_STAT_CRANK(tickle_idlers_some);
     cpu_raise_softirq(cpu_to_tickle, SCHEDULE_SOFTIRQ);
     return;
 }
xen/include/xen/perfc_defn.h +2 -2
index 2dc78fe..f754331 100644
@@ -26,6 +26,8 @@ PERFCOUNTER(vcpu_wake_running,      "sched: vcpu_wake_running")
 PERFCOUNTER(vcpu_wake_onrunq,       "sched: vcpu_wake_onrunq")
 PERFCOUNTER(vcpu_wake_runnable,     "sched: vcpu_wake_runnable")
 PERFCOUNTER(vcpu_wake_not_runnable, "sched: vcpu_wake_not_runnable")
+PERFCOUNTER(tickle_idlers_none,     "sched: tickle_idlers_none")
+PERFCOUNTER(tickle_idlers_some,     "sched: tickle_idlers_some")
 
 /* credit specific counters */
 PERFCOUNTER(delay_ms,               "csched: delay")
@@ -39,8 +41,6 @@ PERFCOUNTER(acct_vcpu_active,       "csched: acct_vcpu_active")
 PERFCOUNTER(acct_vcpu_idle,         "csched: acct_vcpu_idle")
 PERFCOUNTER(vcpu_park,              "csched: vcpu_park")
 PERFCOUNTER(vcpu_unpark,            "csched: vcpu_unpark")
-PERFCOUNTER(tickle_idlers_none,     "csched: tickle_idlers_none")
-PERFCOUNTER(tickle_idlers_some,     "csched: tickle_idlers_some")
 PERFCOUNTER(load_balance_idle,      "csched: load_balance_idle")
 PERFCOUNTER(load_balance_over,      "csched: load_balance_over")
 PERFCOUNTER(load_balance_other,     "csched: load_balance_other")
Acked-by on v2 3/4
#8 lore raw

Re: [PATCH v2 3/4] xen: sched: make counters for vCPU tickling generic

Quoted 9 lines · Dario Faggioli

and update them from Credit2 and RTDS schedulers.

Quoted 76 lines

---
Changes from v1:
* fixed the 'no_tickle' case, in Credit2, as requested during review

---
 xen/common/sched_credit2.c   |    4 ++++
 xen/common/sched_rt.c        |    2 ++
 xen/include/xen/perfc_defn.h |    4 ++--
 3 files changed, 8 insertions(+), 2 deletions(-)
xen/common/sched_credit2.c +4 -0
index 2b852cc..c0f7452 100644
@@ -556,7 +556,10 @@ runq_tickle(const struct scheduler *ops, unsigned int cpu, struct csched2_vcpu *
     /* Only switch to another processor if the credit difference is greater
      * than the migrate resistance */
     if ( ipid == -1 || lowest + CSCHED2_MIGRATE_RESIST > new->credit )
+    {
+        SCHED_STAT_CRANK(tickle_idlers_none);
         goto no_tickle;
+    }
 
 tickle:
     BUG_ON(ipid == -1);
@@ -571,6 +574,7 @@ tickle:
                   (unsigned char *)&d);
     }
     cpumask_set_cpu(ipid, &rqd->tickled);
+    SCHED_STAT_CRANK(tickle_idlers_some);
     cpu_raise_softirq(ipid, SCHEDULE_SOFTIRQ);
 
 no_tickle:
xen/common/sched_rt.c +2 -0
index 49d1b83..2ad0c68 100644
@@ -929,6 +929,7 @@ runq_tickle(const struct scheduler *ops, struct rt_vcpu *new)
     }
 
     /* didn't tickle any cpu */
+    SCHED_STAT_CRANK(tickle_idlers_none);
     return;
 out:
     /* TRACE */
@@ -944,6 +945,7 @@ out:
     }
 
     cpumask_set_cpu(cpu_to_tickle, &prv->tickled);
+    SCHED_STAT_CRANK(tickle_idlers_some);
     cpu_raise_softirq(cpu_to_tickle, SCHEDULE_SOFTIRQ);
     return;
 }
xen/include/xen/perfc_defn.h +2 -2
index 2dc78fe..f754331 100644
@@ -26,6 +26,8 @@ PERFCOUNTER(vcpu_wake_running,      "sched: vcpu_wake_running")
 PERFCOUNTER(vcpu_wake_onrunq,       "sched: vcpu_wake_onrunq")
 PERFCOUNTER(vcpu_wake_runnable,     "sched: vcpu_wake_runnable")
 PERFCOUNTER(vcpu_wake_not_runnable, "sched: vcpu_wake_not_runnable")
+PERFCOUNTER(tickle_idlers_none,     "sched: tickle_idlers_none")
+PERFCOUNTER(tickle_idlers_some,     "sched: tickle_idlers_some")
 
 /* credit specific counters */
 PERFCOUNTER(delay_ms,               "csched: delay")
@@ -39,8 +41,6 @@ PERFCOUNTER(acct_vcpu_active,       "csched: acct_vcpu_active")
 PERFCOUNTER(acct_vcpu_idle,         "csched: acct_vcpu_idle")
 PERFCOUNTER(vcpu_park,              "csched: vcpu_park")
 PERFCOUNTER(vcpu_unpark,            "csched: vcpu_unpark")
-PERFCOUNTER(tickle_idlers_none,     "csched: tickle_idlers_none")
-PERFCOUNTER(tickle_idlers_some,     "csched: tickle_idlers_some")
 PERFCOUNTER(load_balance_idle,      "csched: load_balance_idle")
 PERFCOUNTER(load_balance_over,      "csched: load_balance_over")
 PERFCOUNTER(load_balance_other,     "csched: load_balance_other")
#9 lore raw

PATCH v2 4/4 xen: credit2: add a few performance counters

In reply to Dario Faggioli

for events that are specific to Credit2 (as it happens for Credit1 already).

---
Changes from v1:
* fixed the repeated typo in perfc_defn.h, as requested during review.

---
 xen/common/sched_credit2.c   |   23 +++++++++++++++++++++++
 xen/include/xen/perfc_defn.h |   15 ++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletion(-)
xen/common/sched_credit2.c +23 -0
index c0f7452..bf0d651 100644
@@ -654,6 +654,8 @@ static void reset_credit(const struct scheduler *ops, int cpu, s_time_t now,
         }
     }
 
+    SCHED_STAT_CRANK(credit_reset);
+
     /* No need to resort runqueue, as everyone's order should be the same. */
 }
 
@@ -673,6 +675,7 @@ void burn_credits(struct csched2_runqueue_data *rqd, struct csched2_vcpu *svc, s
     delta = now - svc->start_time;
 
     if ( delta > 0 ) {
+        SCHED_STAT_CRANK(burn_credits_t2c);
         t2c_update(rqd, delta, svc);
         svc->start_time = now;
 
@@ -713,6 +716,7 @@ static void update_max_weight(struct csched2_runqueue_data *rqd, int new_weight,
     {
         rqd->max_weight = new_weight;
         d2printk("%s: Runqueue id %d max weight %d\n", __func__, rqd->id, rqd->max_weight);
+        SCHED_STAT_CRANK(upd_max_weight_quick);
     }
     else if ( old_weight == rqd->max_weight )
     {
@@ -729,6 +733,7 @@ static void update_max_weight(struct csched2_runqueue_data *rqd, int new_weight,
 
         rqd->max_weight = max_weight;
         d2printk("%s: Runqueue %d max weight %d\n", __func__, rqd->id, rqd->max_weight);
+        SCHED_STAT_CRANK(upd_max_weight_full);
     }
 }
 
@@ -750,6 +755,7 @@ __csched2_vcpu_check(struct vcpu *vc)
     {
         BUG_ON( !is_idle_vcpu(vc) );
     }
+    SCHED_STAT_CRANK(vcpu_check);
 }
 #define CSCHED2_VCPU_CHECK(_vc)  (__csched2_vcpu_check(_vc))
 #else
@@ -1203,6 +1209,7 @@ static void migrate(const struct scheduler *ops,
         svc->migrate_rqd = trqd;
         set_bit(_VPF_migrating, &svc->vcpu->pause_flags);
         set_bit(__CSFLAG_runq_migrate_request, &svc->flags);
+        SCHED_STAT_CRANK(migrate_requested);
     }
     else
     {
@@ -1223,7 +1230,10 @@ static void migrate(const struct scheduler *ops,
             update_load(ops, svc->rqd, svc, 1, now);
             runq_insert(ops, svc->vcpu->processor, svc);
             runq_tickle(ops, svc->vcpu->processor, svc, now);
+            SCHED_STAT_CRANK(migrate_on_runq);
         }
+        else
+            SCHED_STAT_CRANK(migrate_no_runq);
     }
 }
 
@@ -1577,7 +1587,10 @@ csched2_runtime(const struct scheduler *ops, int cpu, struct csched2_vcpu *snext
     /* The next guy may actually have a higher credit, if we've tried to
      * avoid migrating him from a different cpu.  DTRT.  */
     if ( rt_credit <= 0 )
+    {
         time = CSCHED2_MIN_TIMER;
+        SCHED_STAT_CRANK(runtime_min_timer);
+    }
     else
     {
         /* FIXME: See if we can eliminate this conversion if we know time
@@ -1588,9 +1601,15 @@ csched2_runtime(const struct scheduler *ops, int cpu, struct csched2_vcpu *snext
 
         /* Check limits */
         if ( time < CSCHED2_MIN_TIMER )
+        {
             time = CSCHED2_MIN_TIMER;
+            SCHED_STAT_CRANK(runtime_min_timer);
+        }
         else if ( time > CSCHED2_MAX_TIMER )
+        {
             time = CSCHED2_MAX_TIMER;
+            SCHED_STAT_CRANK(runtime_max_timer);
+        }
     }
 
     return time;
@@ -1623,7 +1642,10 @@ runq_candidate(struct csched2_runqueue_data *rqd,
          * its credit is at least CSCHED2_MIGRATE_RESIST higher. */
         if ( svc->vcpu->processor != cpu
              && snext->credit + CSCHED2_MIGRATE_RESIST > svc->credit )
+        {
+            SCHED_STAT_CRANK(migrate_resisted);
             continue;
+        }
 
         /* If the next one on the list has more credit than current
          * (or idle, if current is not runnable), choose it. */
@@ -1768,6 +1790,7 @@ csched2_schedule(
         {
             snext->credit += CSCHED2_MIGRATE_COMPENSATION;
             snext->vcpu->processor = cpu;
+            SCHED_STAT_CRANK(migrated);
             ret.migrated = 1;
         }
     }
xen/include/xen/perfc_defn.h +14 -1
index f754331..526002d 100644
@@ -28,10 +28,10 @@ PERFCOUNTER(vcpu_wake_runnable,     "sched: vcpu_wake_runnable")
 PERFCOUNTER(vcpu_wake_not_runnable, "sched: vcpu_wake_not_runnable")
 PERFCOUNTER(tickle_idlers_none,     "sched: tickle_idlers_none")
 PERFCOUNTER(tickle_idlers_some,     "sched: tickle_idlers_some")
+PERFCOUNTER(vcpu_check,             "sched: vcpu_check")
 
 /* credit specific counters */
 PERFCOUNTER(delay_ms,               "csched: delay")
-PERFCOUNTER(vcpu_check,             "csched: vcpu_check")
 PERFCOUNTER(acct_run,               "csched: acct_run")
 PERFCOUNTER(acct_no_work,           "csched: acct_no_work")
 PERFCOUNTER(acct_balance,           "csched: acct_balance")
@@ -51,6 +51,19 @@ PERFCOUNTER(migrate_running,        "csched: migrate_running")
 PERFCOUNTER(migrate_kicked_away,    "csched: migrate_kicked_away")
 PERFCOUNTER(vcpu_hot,               "csched: vcpu_hot")
 
+/* credit2 specific counters */
+PERFCOUNTER(burn_credits_t2c,       "csched2: burn_credits_t2c")
+PERFCOUNTER(upd_max_weight_quick,   "csched2: update_max_weight_quick")
+PERFCOUNTER(upd_max_weight_full,    "csched2: update_max_weight_full")
+PERFCOUNTER(migrate_requested,      "csched2: migrate_requested")
+PERFCOUNTER(migrate_on_runq,        "csched2: migrate_on_runq")
+PERFCOUNTER(migrate_no_runq,        "csched2: migrate_no_runq")
+PERFCOUNTER(runtime_min_timer,      "csched2: runtime_min_timer")
+PERFCOUNTER(runtime_max_timer,      "csched2: runtime_max_timer")
+PERFCOUNTER(migrated,               "csched2: migrated")
+PERFCOUNTER(migrate_resisted,       "csched2: migrate_resisted")
+PERFCOUNTER(credit_reset,           "csched2: credit_reset")
+
 PERFCOUNTER(need_flush_tlb_flush,   "PG_need_flush tlb flushes")
 
 /*#endif*/ /* __XEN_PERFC_DEFN_H__ */
Acked-by on v2 4/4
#10 lore raw

Re: [PATCH v2 4/4] xen: credit2: add a few performance counters

Quoted 22 lines · Dario Faggioli

for events that are specific to Credit2 (as it happens for Credit1 already).

---
Changes from v1:
* fixed the repeated typo in perfc_defn.h, as requested during review.

---
 xen/common/sched_credit2.c   |   23 +++++++++++++++++++++++
 xen/include/xen/perfc_defn.h |   15 ++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletion(-)
xen/common/sched_credit2.c +0 -0
index c0f7452..bf0d651 100644

xen/common/sched_credit2.c static void reset_credit(const struct scheduler *ops, int cpu, s_time_t now, · line 658

Quoted 5 lines
xen/common/sched_credit2.c +2 -0
@@ -654,6 +654,8 @@ static void reset_credit(const struct scheduler *ops, int cpu, s_time_t now,
         }
     }
 
+    SCHED_STAT_CRANK(credit_reset);
+

Is this one actually useful? Anyway, it's the only one I could find that I had that question for, so not a big deal to leave it in. :-)

One more minor thing:

xen/include/xen/perfc_defn.h PERFCOUNTER(vcpu_wake_runnable, "sched: vcpu_wake_runnable") · line 34

Quoted 13 lines
xen/include/xen/perfc_defn.h +1 -1
index f754331..526002d 100644
@@ -28,10 +28,10 @@ PERFCOUNTER(vcpu_wake_runnable,     "sched: vcpu_wake_runnable")
 PERFCOUNTER(vcpu_wake_not_runnable, "sched: vcpu_wake_not_runnable")
 PERFCOUNTER(tickle_idlers_none,     "sched: tickle_idlers_none")
 PERFCOUNTER(tickle_idlers_some,     "sched: tickle_idlers_some")
+PERFCOUNTER(vcpu_check,             "sched: vcpu_check")
 
 /* credit specific counters */
 PERFCOUNTER(delay_ms,               "csched: delay")
-PERFCOUNTER(vcpu_check,             "csched: vcpu_check")

You forgot to mention making this one generic in your patch description.
But that's probably not worth a re-spin either. :-)

-George

#11 lore raw
In reply to Dario Faggioli
Quoted 10 lines · Dario Faggioli

Take 2 of this:

http://lists.xen.org/archives/html/xen-devel/2015-02/msg03249.html

I've made all the changes suggested during v1.

The series has Meng's Reviewed-by for the changes to sched_rt.c, and Jan's Ack for the non-strictly scheduling related part (1 file! :-D), so I think what is missing is George's view/Ack.

George, ping

No intention to push, of course... just a remainder in case this failed to show up on your radar. :-D

Thanks and Regards,
Dario

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

#12 lore raw
Quoted 7 lines · Dario Faggioli
Quoted 6 lines · Dario Faggioli

Take 2 of this:

http://lists.xen.org/archives/html/xen-devel/2015-02/msg03249.html

I've made all the changes suggested during v1.

Quoted 8 lines
Quoted 4 lines

The series has Meng's Reviewed-by for the changes to sched_rt.c, and Jan's Ack for the non-strictly scheduling related part (1 file! :-D), so I think what is missing is George's view/Ack.

George, ping

No intention to push, of course... just a remainder in case this failed to show up on your radar. :-D

Yep, it's on my radar... just trying to catch up on stuff... I should have a chance to look at it next week, I think.

-George