commit b71e3f10898a6d1c849bd9135f15aa8367d897d0 Author: Dario Faggioli Date: Wed Oct 28 00:47:17 2015 +0100 Signed-off-by: Dario Faggioli diff --git a/xen/common/sched_arinc653.c b/xen/common/sched_arinc653.c index dbe02ed..de65e96 100644 --- a/xen/common/sched_arinc653.c +++ b/xen/common/sched_arinc653.c @@ -537,7 +537,7 @@ a653sched_vcpu_sleep(const struct scheduler *ops, struct vcpu *vc) * @param vc Pointer to the VCPU structure for the current domain */ static void -a653sched_vcpu_wake(const struct scheduler *ops, struct vcpu *vc) +a653sched_vcpu_wake(const struct scheduler *ops, struct vcpu *vc, unsigned wf) { if ( AVCPU(vc) != NULL ) AVCPU(vc)->awake = 1; diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index b8f28fe..683feeb 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -966,7 +966,7 @@ csched_vcpu_sleep(const struct scheduler *ops, struct vcpu *vc) } static void -csched_vcpu_wake(const struct scheduler *ops, struct vcpu *vc) +csched_vcpu_wake(const struct scheduler *ops, struct vcpu *vc, unsigned wf) { struct csched_vcpu * const svc = CSCHED_VCPU(vc); const unsigned int cpu = vc->processor; diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index 6695729..6b32778 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -957,7 +957,7 @@ csched2_vcpu_sleep(const struct scheduler *ops, struct vcpu *vc) } static void -csched2_vcpu_wake(const struct scheduler *ops, struct vcpu *vc) +csched2_vcpu_wake(const struct scheduler *ops, struct vcpu *vc, unsigned wf) { struct csched2_vcpu * const svc = CSCHED2_VCPU(vc); s_time_t now = 0; diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c index 6a341b1..677e3f4 100644 --- a/xen/common/sched_rt.c +++ b/xen/common/sched_rt.c @@ -1031,7 +1031,7 @@ out: * TODO: what if these two vcpus belongs to the same domain? */ static void -rt_vcpu_wake(const struct scheduler *ops, struct vcpu *vc) +rt_vcpu_wake(const struct scheduler *ops, struct vcpu *vc, unsigned wf) { struct rt_vcpu * const svc = rt_vcpu(vc); s_time_t now = NOW(); diff --git a/xen/common/schedule.c b/xen/common/schedule.c index c5f640f..bacee73 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -407,7 +407,7 @@ void vcpu_sleep_sync(struct vcpu *v) sync_vcpu_execstate(v); } -void vcpu_wake(struct vcpu *v) +static void _vcpu_wake(struct vcpu *v, unsigned wake_flags) { unsigned long flags; spinlock_t *lock = vcpu_schedule_lock_irqsave(v, &flags); @@ -416,7 +416,7 @@ void vcpu_wake(struct vcpu *v) { if ( v->runstate.state >= RUNSTATE_blocked ) vcpu_runstate_change(v, RUNSTATE_runnable, NOW()); - SCHED_OP(VCPU2OP(v), wake, v); + SCHED_OP(VCPU2OP(v), wake, v, wake_flags); } else if ( !(v->pause_flags & VPF_blocked) ) { @@ -429,6 +429,11 @@ void vcpu_wake(struct vcpu *v) TRACE_2D(TRC_SCHED_WAKE, v->domain->domain_id, v->vcpu_id); } +void vcpu_wake(struct vcpu *v) +{ + return _vcpu_wake(v, WF_wakeup); +} + void vcpu_unblock(struct vcpu *v) { if ( !test_and_clear_bit(_VPF_blocked, &v->pause_flags) ) @@ -577,8 +582,8 @@ static void vcpu_migrate(struct vcpu *v) if ( old_cpu != new_cpu ) sched_move_irqs(v); - /* Wake on new CPU. */ - vcpu_wake(v); + /* Wake on new CPU (and let the scheduler know it's a migration). */ + _vcpu_wake(v, WF_migrating); } /* diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h index 493d43f..af1ed60 100644 --- a/xen/include/xen/sched-if.h +++ b/xen/include/xen/sched-if.h @@ -144,7 +144,8 @@ struct scheduler { void (*remove_vcpu) (const struct scheduler *, struct vcpu *); void (*sleep) (const struct scheduler *, struct vcpu *); - void (*wake) (const struct scheduler *, struct vcpu *); + void (*wake) (const struct scheduler *, struct vcpu *, + unsigned int); void (*yield) (const struct scheduler *, struct vcpu *); void (*context_saved) (const struct scheduler *, struct vcpu *); diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 3729b0f..6e7a108 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -753,6 +753,16 @@ static inline struct domain *next_domain_in_cpupool( #define _VPF_in_reset 7 #define VPF_in_reset (1UL<<_VPF_in_reset) +/* + * VCPU wake up flags. + */ +/* VCPU being actually woken up. */ +#define _WF_wakeup 0 +#define WF_wakeup (1U<<_WF_wakeup) +/* VCPU being (woken just after having been) migrated. */ +#define _WF_migrating 1 +#define WF_migrating (1U<<_WF_migrating) + static inline int vcpu_runnable(struct vcpu *v) { return !(v->pause_flags |