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

Re: [Xen-devel] [PATCH v2 4/7] xen/tools: tracing: add record for credit1 runqueue stealing.



On 06/04/17 09:16, Dario Faggioli wrote:
> Including whether we actually tried stealing a vCPU from
> a given pCPU, or we skipped that one, because of lock
> contention.
> 
> Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
> ---
> Cc: George Dunlap <george.dunlap@xxxxxxxxxx>
> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
> ---
>  tools/xentrace/formats       |    1 +
>  tools/xentrace/xenalyze.c    |   11 +++++++++++
>  xen/common/sched_credit.c    |    6 +++++-
>  xen/include/xen/perfc_defn.h |    1 +
>  4 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/xentrace/formats b/tools/xentrace/formats
> index a055231..8b31780 100644
> --- a/tools/xentrace/formats
> +++ b/tools/xentrace/formats
> @@ -47,6 +47,7 @@
>  0x00022008  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  csched:unboost       [ 
> dom:vcpu = 0x%(1)04x%(2)04x ]
>  0x00022009  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  csched:schedule      [ 
> cpu[16]:tasklet[8]:idle[8] = %(1)08x ]
>  0x0002200A  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  csched:ratelimit     [ 
> dom:vcpu = 0x%(1)08x, runtime = %(2)d ]
> +0x0002200B  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  csched:steal_check   [ 
> peer_cpu = %(1)d, checked = %(2)d ]
>  
>  0x00022201  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  csched2:tick
>  0x00022202  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  csched2:runq_pos       [ 
> dom:vcpu = 0x%(1)08x, pos = %(2)d]
> diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c
> index 029c89d..fa608ad 100644
> --- a/tools/xentrace/xenalyze.c
> +++ b/tools/xentrace/xenalyze.c
> @@ -7651,6 +7651,17 @@ void sched_process(struct pcpu_info *p)
>                         r->runtime / 1000, r->runtime % 1000);
>              }
>              break;
> +        case TRC_SCHED_CLASS_EVT(CSCHED, 11): /* STEAL_CHECK   */
> +            if(opt.dump_all) {
> +                struct {
> +                    unsigned int peer_cpu, check;
> +                } *r = (typeof(r))ri->d;
> +
> +                printf(" %s csched:load_balance %s %u\n",
> +                       ri->dump_header, r->check ? "checking" : "skipping",
> +                       r->peer_cpu);
> +            }
> +            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 c753089..49caa0a 100644
> --- a/xen/common/sched_credit.c
> +++ b/xen/common/sched_credit.c
> @@ -134,6 +134,7 @@
>  #define TRC_CSCHED_BOOST_END     TRC_SCHED_CLASS_EVT(CSCHED, 8)
>  #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)
>  
>  
>  /*
> @@ -1738,14 +1739,17 @@ csched_load_balance(struct csched_private *prv, int 
> cpu,
>                   * balancing and trying to lock this CPU.
>                   */
>                  spinlock_t *lock = pcpu_schedule_trylock(peer_cpu);
> -
> +                SCHED_STAT_CRANK(steal_trylock);
>                  if ( !lock )
>                  {
>                      SCHED_STAT_CRANK(steal_trylock_failed);
> +                    TRACE_2D(TRC_CSCHED_STEAL_CHECK, peer_cpu, /* skipp'n */ 
> 0);

Was this to try to keep the line under 80 characters? :-)

I think you could write "skipped" here and it would be the same number
of characters; or just "skip" would be fine too.  Let me know what you
think and I can change it on check-in.

Acked-by: George Dunlap <george.dunlap@xxxxxxxxxx>

>                      peer_cpu = cpumask_cycle(peer_cpu, &workers);
>                      continue;
>                  }
>  
> +                TRACE_2D(TRC_CSCHED_STEAL_CHECK, peer_cpu, /* checked */ 1);
> +
>                  /* Any work over there to steal? */
>                  speer = cpumask_test_cpu(peer_cpu, online) ?
>                      csched_runq_steal(peer_cpu, cpu, snext->pri, bstep) : 
> NULL;
> diff --git a/xen/include/xen/perfc_defn.h b/xen/include/xen/perfc_defn.h
> index 0d702f0..53849af 100644
> --- a/xen/include/xen/perfc_defn.h
> +++ b/xen/include/xen/perfc_defn.h
> @@ -48,6 +48,7 @@ PERFCOUNTER(vcpu_unpark,            "csched: vcpu_unpark")
>  PERFCOUNTER(load_balance_idle,      "csched: load_balance_idle")
>  PERFCOUNTER(load_balance_over,      "csched: load_balance_over")
>  PERFCOUNTER(load_balance_other,     "csched: load_balance_other")
> +PERFCOUNTER(steal_trylock,          "csched: steal_trylock")
>  PERFCOUNTER(steal_trylock_failed,   "csched: steal_trylock_failed")
>  PERFCOUNTER(steal_peer_idle,        "csched: steal_peer_idle")
>  PERFCOUNTER(migrate_queued,         "csched: migrate_queued")
> 


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

 


Rackspace

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