diff mbox

[v2,03/16] xen: sched: improve domain creation tracing

Message ID 20160216181129.27876.21579.stgit@Solace.station (mailing list archive)
State New, archived
Headers show

Commit Message

Dario Faggioli Feb. 16, 2016, 6:11 p.m. UTC
by doing the following two things:

 - move TRC_SCHED_DOM_{ADD,REM}, into the functions
   that do the actual scheduling-related domain
   initialization;

 - add two 'generic' DOM_{ADD,REM} events. They're
   made part of the TRC_DOM0 tracing class, as Dom0
   is, usually, from where domains are created and
   destroyed.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
Changes from v1:
 * added generic domain creation and destruction events, as
   suggested during review.
---
 xen/common/domain.c        |    5 ++++-
 xen/common/schedule.c      |    4 ++--
 xen/include/public/trace.h |    6 ++++++
 3 files changed, 12 insertions(+), 3 deletions(-)

Comments

George Dunlap Feb. 18, 2016, 11:04 a.m. UTC | #1
On 16/02/16 18:11, Dario Faggioli wrote:
> by doing the following two things:
> 
>  - move TRC_SCHED_DOM_{ADD,REM}, into the functions
>    that do the actual scheduling-related domain
>    initialization;
> 
>  - add two 'generic' DOM_{ADD,REM} events. They're
>    made part of the TRC_DOM0 tracing class, as Dom0
>    is, usually, from where domains are created and
>    destroyed.
> 
> Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>

Reviewed-by: George Dunlap <george.dunlap@citrix.com>

Since this changes domain.c, I guess this would need an ack from "The
Rest" -- probably either from Jan or Ian, since they're somewhat
familiar with this code...?

 -George

> ---
> Cc: George Dunlap <george.dunlap@eu.citrix.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
> Changes from v1:
>  * added generic domain creation and destruction events, as
>    suggested during review.
> ---
>  xen/common/domain.c        |    5 ++++-
>  xen/common/schedule.c      |    4 ++--
>  xen/include/public/trace.h |    6 ++++++
>  3 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/common/domain.c b/xen/common/domain.c
> index 425767c..45273d4 100644
> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -270,6 +270,8 @@ struct domain *domain_create(domid_t domid, unsigned int domcr_flags,
>  
>      d->domain_id = domid;
>  
> +    TRACE_1D(TRC_DOM0_DOM_ADD, d->domain_id);
> +
>      lock_profile_register_struct(LOCKPROF_TYPE_PERDOM, d, domid, "Domain");
>  
>      if ( (err = xsm_alloc_security_domain(d)) != 0 )
> @@ -864,10 +866,11 @@ void domain_destroy(struct domain *d)
>      if ( atomic_cmpxchg(&d->refcnt, 0, DOMAIN_DESTROYED) != 0 )
>          return;
>  
> +    TRACE_1D(TRC_DOM0_DOM_REM, d->domain_id);
> +
>      cpupool_rm_domain(d);
>  
>      /* Delete from task list and task hashtable. */
> -    TRACE_1D(TRC_SCHED_DOM_REM, d->domain_id);
>      spin_lock(&domlist_update_lock);
>      pd = &domain_list;
>      while ( *pd != d ) 
> diff --git a/xen/common/schedule.c b/xen/common/schedule.c
> index c87922f..27695e3 100644
> --- a/xen/common/schedule.c
> +++ b/xen/common/schedule.c
> @@ -241,8 +241,6 @@ int sched_init_vcpu(struct vcpu *v, unsigned int processor)
>      if ( v->sched_priv == NULL )
>          return 1;
>  
> -    TRACE_2D(TRC_SCHED_DOM_ADD, v->domain->domain_id, v->vcpu_id);
> -
>      /* Idle VCPUs are scheduled immediately, so don't put them in runqueue. */
>      if ( is_idle_domain(d) )
>      {
> @@ -369,12 +367,14 @@ void sched_destroy_vcpu(struct vcpu *v)
>  int sched_init_domain(struct domain *d)
>  {
>      SCHED_STAT_CRANK(dom_init);
> +    TRACE_1D(TRC_SCHED_DOM_ADD, d->domain_id);
>      return SCHED_OP(DOM2OP(d), init_domain, d);
>  }
>  
>  void sched_destroy_domain(struct domain *d)
>  {
>      SCHED_STAT_CRANK(dom_destroy);
> +    TRACE_1D(TRC_SCHED_DOM_REM, d->domain_id);
>      SCHED_OP(DOM2OP(d), destroy_domain, d);
>  }
>  
> diff --git a/xen/include/public/trace.h b/xen/include/public/trace.h
> index 274f8f6..5ef9c37 100644
> --- a/xen/include/public/trace.h
> +++ b/xen/include/public/trace.h
> @@ -85,6 +85,9 @@
>        ((TRC_SCHED_##_c << TRC_SCHED_ID_SHIFT) & TRC_SCHED_ID_MASK) ) + \
>      (_e & TRC_SCHED_EVT_MASK) )
>  
> +/* Trace classes for DOM0 operations */
> +#define TRC_DOM0_DOMOPS     0x00041000   /* Domains manipulations */
> +
>  /* Trace classes for Hardware */
>  #define TRC_HW_PM           0x00801000   /* Power management traces */
>  #define TRC_HW_IRQ          0x00802000   /* Traces relating to the handling of IRQs */
> @@ -113,6 +116,9 @@
>  #define TRC_SCHED_SWITCH_INFNEXT (TRC_SCHED_VERBOSE + 15)
>  #define TRC_SCHED_SHUTDOWN_CODE  (TRC_SCHED_VERBOSE + 16)
>  
> +#define TRC_DOM0_DOM_ADD         (TRC_DOM0_DOMOPS + 1)
> +#define TRC_DOM0_DOM_REM         (TRC_DOM0_DOMOPS + 2)
> +
>  #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)
>
Dario Faggioli Feb. 24, 2016, 11:21 a.m. UTC | #2
On Thu, 2016-02-18 at 11:04 +0000, George Dunlap wrote:
> On 16/02/16 18:11, Dario Faggioli wrote:
> > by doing the following two things:
> > 
> >  - move TRC_SCHED_DOM_{ADD,REM}, into the functions
> >    that do the actual scheduling-related domain
> >    initialization;
> > 
> >  - add two 'generic' DOM_{ADD,REM} events. They're
> >    made part of the TRC_DOM0 tracing class, as Dom0
> >    is, usually, from where domains are created and
> >    destroyed.
> > 
> > Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
> 
> Reviewed-by: George Dunlap <george.dunlap@citrix.com>
> 
> Since this changes domain.c, I guess this would need an ack from "The
> Rest" -- probably either from Jan or Ian, since they're somewhat
> familiar with this code...?
> 
Ping (Ian, Jan)?

Also, George, I haven't seen any comment from you on patch 16 ("PATCH
v2 16/16] xenalyze: handle DOM0 operaions events",
<20160216181331.27876.31120.stgit@Solace.station> )... Is that because
you want to see others' opinion on this patch first?

As far as I can tell, these two patches (i.e., 03/16 and 16/16) is all
that is preventing this series to be checked in (with the exception of
patch 15, which I'll resend as part of another, follow-up, series, as
agreed with George).

Thanks and Regards,
Dario
Jan Beulich Feb. 24, 2016, 11:52 a.m. UTC | #3
>>> On 24.02.16 at 12:21, <dario.faggioli@citrix.com> wrote:
> On Thu, 2016-02-18 at 11:04 +0000, George Dunlap wrote:
>> On 16/02/16 18:11, Dario Faggioli wrote:
>> > by doing the following two things:
>> > 
>> >  - move TRC_SCHED_DOM_{ADD,REM}, into the functions
>> >    that do the actual scheduling-related domain
>> >    initialization;
>> > 
>> >  - add two 'generic' DOM_{ADD,REM} events. They're
>> >    made part of the TRC_DOM0 tracing class, as Dom0
>> >    is, usually, from where domains are created and
>> >    destroyed.
>> > 
>> > Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
>> 
>> Reviewed-by: George Dunlap <george.dunlap@citrix.com>
>> 
>> Since this changes domain.c, I guess this would need an ack from "The
>> Rest" -- probably either from Jan or Ian, since they're somewhat
>> familiar with this code...?
>> 
> Ping (Ian, Jan)?

This has even passed the push gate already.

Jan
Dario Faggioli Feb. 24, 2016, 1:20 p.m. UTC | #4
On Wed, 2016-02-24 at 04:52 -0700, Jan Beulich wrote:
> > > > On 24.02.16 at 12:21, <dario.faggioli@citrix.com> wrote:
> > On Thu, 2016-02-18 at 11:04 +0000, George Dunlap wrote:
> > > On 16/02/16 18:11, Dario Faggioli wrote:
> > > > by doing the following two things:
> > > > 
> > > >  - move TRC_SCHED_DOM_{ADD,REM}, into the functions
> > > >    that do the actual scheduling-related domain
> > > >    initialization;
> > > > 
> > > >  - add two 'generic' DOM_{ADD,REM} events. They're
> > > >    made part of the TRC_DOM0 tracing class, as Dom0
> > > >    is, usually, from where domains are created and
> > > >    destroyed.
> > > > 
> > > > Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
> > > 
> > > Reviewed-by: George Dunlap <george.dunlap@citrix.com>
> > > 
> > > Since this changes domain.c, I guess this would need an ack from
> > > "The
> > > Rest" -- probably either from Jan or Ian, since they're somewhat
> > > familiar with this code...?
> > > 
> > Ping (Ian, Jan)?
> 
> This has even passed the push gate already.
> 
Ah, good to hear that! :-)

I see it now:

commit 7d42c7615045e75b9231a309ec452d7543099773
Author: Dario Faggioli <dario.faggioli@citrix.com>
Date:   Thu Feb 18 15:03:34 2016 +0100
....
....
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>

So, it looks like you've acked it and, I presume, checked it in.

My bad not double checking if it was in... I just didn't think that
could be the case, as I thought an answer to George's suggestion of an
Ack would hit the mailing list, if only for the sake of
archives/history (unless I've also missed such email! :-P).

In any case, sorry for the noise.

Thanks and Regards,
Dario
diff mbox

Patch

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 425767c..45273d4 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -270,6 +270,8 @@  struct domain *domain_create(domid_t domid, unsigned int domcr_flags,
 
     d->domain_id = domid;
 
+    TRACE_1D(TRC_DOM0_DOM_ADD, d->domain_id);
+
     lock_profile_register_struct(LOCKPROF_TYPE_PERDOM, d, domid, "Domain");
 
     if ( (err = xsm_alloc_security_domain(d)) != 0 )
@@ -864,10 +866,11 @@  void domain_destroy(struct domain *d)
     if ( atomic_cmpxchg(&d->refcnt, 0, DOMAIN_DESTROYED) != 0 )
         return;
 
+    TRACE_1D(TRC_DOM0_DOM_REM, d->domain_id);
+
     cpupool_rm_domain(d);
 
     /* Delete from task list and task hashtable. */
-    TRACE_1D(TRC_SCHED_DOM_REM, d->domain_id);
     spin_lock(&domlist_update_lock);
     pd = &domain_list;
     while ( *pd != d ) 
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index c87922f..27695e3 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -241,8 +241,6 @@  int sched_init_vcpu(struct vcpu *v, unsigned int processor)
     if ( v->sched_priv == NULL )
         return 1;
 
-    TRACE_2D(TRC_SCHED_DOM_ADD, v->domain->domain_id, v->vcpu_id);
-
     /* Idle VCPUs are scheduled immediately, so don't put them in runqueue. */
     if ( is_idle_domain(d) )
     {
@@ -369,12 +367,14 @@  void sched_destroy_vcpu(struct vcpu *v)
 int sched_init_domain(struct domain *d)
 {
     SCHED_STAT_CRANK(dom_init);
+    TRACE_1D(TRC_SCHED_DOM_ADD, d->domain_id);
     return SCHED_OP(DOM2OP(d), init_domain, d);
 }
 
 void sched_destroy_domain(struct domain *d)
 {
     SCHED_STAT_CRANK(dom_destroy);
+    TRACE_1D(TRC_SCHED_DOM_REM, d->domain_id);
     SCHED_OP(DOM2OP(d), destroy_domain, d);
 }
 
diff --git a/xen/include/public/trace.h b/xen/include/public/trace.h
index 274f8f6..5ef9c37 100644
--- a/xen/include/public/trace.h
+++ b/xen/include/public/trace.h
@@ -85,6 +85,9 @@ 
       ((TRC_SCHED_##_c << TRC_SCHED_ID_SHIFT) & TRC_SCHED_ID_MASK) ) + \
     (_e & TRC_SCHED_EVT_MASK) )
 
+/* Trace classes for DOM0 operations */
+#define TRC_DOM0_DOMOPS     0x00041000   /* Domains manipulations */
+
 /* Trace classes for Hardware */
 #define TRC_HW_PM           0x00801000   /* Power management traces */
 #define TRC_HW_IRQ          0x00802000   /* Traces relating to the handling of IRQs */
@@ -113,6 +116,9 @@ 
 #define TRC_SCHED_SWITCH_INFNEXT (TRC_SCHED_VERBOSE + 15)
 #define TRC_SCHED_SHUTDOWN_CODE  (TRC_SCHED_VERBOSE + 16)
 
+#define TRC_DOM0_DOM_ADD         (TRC_DOM0_DOMOPS + 1)
+#define TRC_DOM0_DOM_REM         (TRC_DOM0_DOMOPS + 2)
+
 #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)