@@ -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;
@@ -983,7 +983,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;
@@ -940,7 +940,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;
@@ -1022,7 +1022,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();
@@ -406,7 +406,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);
@@ -415,7 +415,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) )
{
@@ -428,6 +428,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) )
@@ -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 *);
@@ -758,6 +758,13 @@ 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.
+ */
+/* 'Default' wakeup. */
+#define _WF_wakeup 0
+#define WF_wakeup (1U<<_WF_wakeup)
+
static inline int vcpu_runnable(struct vcpu *v)
{
return !(v->pause_flags |
For making it possible to pass to the specific scheduler code information about the nature of the wakeup, and let it act accordingly, if necessary. For now, this will only be useful to Credit1, that needs to differentiate between 'regular' wakeups (happening, for instance, because an I/O event), and wakeups "artificially induced" for migrating a vCPU to another pCPU. In this patch, only the WF_wakeup flag is introduced, and used everything. In fact, instead of changing the prototype of vcpu_wake(), the _vcpu_wake() helper is introduced. This can change, in case, at some point, the majority of wakeup paths will end up wanting to pass a flag. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> --- Cc: George Dunlap <george.dunlap@eu.citrix.com> Cc: Josh Whitehead <josh.whitehead@dornerworks.com> Cc: Robert VanVossen <robert.vanvossen@dornerworks.com> Cc: Meng Xu <mengxu@cis.upenn.edu> --- xen/common/sched_arinc653.c | 2 +- xen/common/sched_credit.c | 2 +- xen/common/sched_credit2.c | 2 +- xen/common/sched_rt.c | 2 +- xen/common/schedule.c | 9 +++++++-- xen/include/xen/sched-if.h | 3 ++- xen/include/xen/sched.h | 7 +++++++ 7 files changed, 20 insertions(+), 7 deletions(-)