diff mbox

[02/14] xen: sched: move up the trace record for vcpu_wake and vcpu_sleep

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

Commit Message

Dario Faggioli Feb. 5, 2016, 6:33 p.m. UTC
vcpu_wake() and vcpu_sleep() are called before the specific
schedulers wakeup and sleep routines (in fact, it is them
that calls those specific routine).

Make the trace reflect that, by moving the records up. In
fact, it is more natural and easy to find the record of
the event (e.g., the wakeup) *before* the records of the
actions that deals with the event itself.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
Cc: George Dunlap <george.dunlap@citrix.com>
---
 xen/common/schedule.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

Comments

Konrad Rzeszutek Wilk Feb. 15, 2016, 4:18 p.m. UTC | #1
On Fri, Feb 05, 2016 at 07:33:42PM +0100, Dario Faggioli wrote:
> vcpu_wake() and vcpu_sleep() are called before the specific
> schedulers wakeup and sleep routines (in fact, it is them
> that calls those specific routine).

Yeah!!

> 
> Make the trace reflect that, by moving the records up. In
> fact, it is more natural and easy to find the record of
> the event (e.g., the wakeup) *before* the records of the
> actions that deals with the event itself.
> 

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
> ---
> Cc: George Dunlap <george.dunlap@citrix.com>
> ---
>  xen/common/schedule.c |   16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/xen/common/schedule.c b/xen/common/schedule.c
> index 7306d71..c87922f 100644
> --- a/xen/common/schedule.c
> +++ b/xen/common/schedule.c
> @@ -381,7 +381,11 @@ void sched_destroy_domain(struct domain *d)
>  void vcpu_sleep_nosync(struct vcpu *v)
>  {
>      unsigned long flags;
> -    spinlock_t *lock = vcpu_schedule_lock_irqsave(v, &flags);
> +    spinlock_t *lock;
> +
> +    TRACE_2D(TRC_SCHED_SLEEP, v->domain->domain_id, v->vcpu_id);
> +
> +    lock = vcpu_schedule_lock_irqsave(v, &flags);
>  
>      if ( likely(!vcpu_runnable(v)) )
>      {
> @@ -392,8 +396,6 @@ void vcpu_sleep_nosync(struct vcpu *v)
>      }
>  
>      vcpu_schedule_unlock_irqrestore(lock, flags, v);
> -
> -    TRACE_2D(TRC_SCHED_SLEEP, v->domain->domain_id, v->vcpu_id);
>  }
>  
>  void vcpu_sleep_sync(struct vcpu *v)
> @@ -409,7 +411,11 @@ void vcpu_sleep_sync(struct vcpu *v)
>  void vcpu_wake(struct vcpu *v)
>  {
>      unsigned long flags;
> -    spinlock_t *lock = vcpu_schedule_lock_irqsave(v, &flags);
> +    spinlock_t *lock;
> +
> +    TRACE_2D(TRC_SCHED_WAKE, v->domain->domain_id, v->vcpu_id);
> +
> +    lock = vcpu_schedule_lock_irqsave(v, &flags);
>  
>      if ( likely(vcpu_runnable(v)) )
>      {
> @@ -424,8 +430,6 @@ void vcpu_wake(struct vcpu *v)
>      }
>  
>      vcpu_schedule_unlock_irqrestore(lock, flags, v);
> -
> -    TRACE_2D(TRC_SCHED_WAKE, v->domain->domain_id, v->vcpu_id);
>  }
>  
>  void vcpu_unblock(struct vcpu *v)
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
diff mbox

Patch

diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 7306d71..c87922f 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -381,7 +381,11 @@  void sched_destroy_domain(struct domain *d)
 void vcpu_sleep_nosync(struct vcpu *v)
 {
     unsigned long flags;
-    spinlock_t *lock = vcpu_schedule_lock_irqsave(v, &flags);
+    spinlock_t *lock;
+
+    TRACE_2D(TRC_SCHED_SLEEP, v->domain->domain_id, v->vcpu_id);
+
+    lock = vcpu_schedule_lock_irqsave(v, &flags);
 
     if ( likely(!vcpu_runnable(v)) )
     {
@@ -392,8 +396,6 @@  void vcpu_sleep_nosync(struct vcpu *v)
     }
 
     vcpu_schedule_unlock_irqrestore(lock, flags, v);
-
-    TRACE_2D(TRC_SCHED_SLEEP, v->domain->domain_id, v->vcpu_id);
 }
 
 void vcpu_sleep_sync(struct vcpu *v)
@@ -409,7 +411,11 @@  void vcpu_sleep_sync(struct vcpu *v)
 void vcpu_wake(struct vcpu *v)
 {
     unsigned long flags;
-    spinlock_t *lock = vcpu_schedule_lock_irqsave(v, &flags);
+    spinlock_t *lock;
+
+    TRACE_2D(TRC_SCHED_WAKE, v->domain->domain_id, v->vcpu_id);
+
+    lock = vcpu_schedule_lock_irqsave(v, &flags);
 
     if ( likely(vcpu_runnable(v)) )
     {
@@ -424,8 +430,6 @@  void vcpu_wake(struct vcpu *v)
     }
 
     vcpu_schedule_unlock_irqrestore(lock, flags, v);
-
-    TRACE_2D(TRC_SCHED_WAKE, v->domain->domain_id, v->vcpu_id);
 }
 
 void vcpu_unblock(struct vcpu *v)