xen/sched: move per-vcpu scheduler private data pointer to sched_unit

This prepares making the different schedulers vcpu agnostic.

Note that some scheduler specific accessor function are misnamed after
this patch. This will be corrected in later patches.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
This commit is contained in:
Juergen Gross authored and Jan Beulich committed 2019-09-27 15:15:39 +02:00
1 parent 6cc3f5e106
commit f9634b2d90
7 files changed
+22 -22

No files matched your search

+2 -2
View File
@@ -53,7 +53,7 @@
* Return a pointer to the ARINC 653-specific scheduler data information * Return a pointer to the ARINC 653-specific scheduler data information
* associated with the given VCPU (vc) * associated with the given VCPU (vc)
*/ */
#define AVCPU(vc) ((arinc653_vcpu_t *)(vc)->sched_priv) #define AVCPU(vc) ((arinc653_vcpu_t *)(vc)->sched_unit->priv)
/** /**
* Return the global scheduler private data given the scheduler ops pointer * Return the global scheduler private data given the scheduler ops pointer
@@ -653,7 +653,7 @@ a653_switch_sched(struct scheduler *new_ops, unsigned int cpu,
ASSERT(!pdata && svc && is_idle_vcpu(svc->vc)); ASSERT(!pdata && svc && is_idle_vcpu(svc->vc));
idle_vcpu[cpu]->sched_priv = vdata; idle_vcpu[cpu]->sched_unit->priv = vdata;
return &sd->_lock; return &sd->_lock;
} }
+3 -3
View File
@@ -83,7 +83,7 @@
((struct csched_private *)((_ops)->sched_data)) ((struct csched_private *)((_ops)->sched_data))
#define CSCHED_PCPU(_c) \ #define CSCHED_PCPU(_c) \
((struct csched_pcpu *)per_cpu(schedule_data, _c).sched_priv) ((struct csched_pcpu *)per_cpu(schedule_data, _c).sched_priv)
#define CSCHED_VCPU(_vcpu) ((struct csched_vcpu *) (_vcpu)->sched_priv) #define CSCHED_VCPU(_vcpu) ((struct csched_vcpu *) (_vcpu)->sched_unit->priv)
#define CSCHED_DOM(_dom) ((struct csched_dom *) (_dom)->sched_priv) #define CSCHED_DOM(_dom) ((struct csched_dom *) (_dom)->sched_priv)
#define RUNQ(_cpu) (&(CSCHED_PCPU(_cpu)->runq)) #define RUNQ(_cpu) (&(CSCHED_PCPU(_cpu)->runq))
@@ -634,7 +634,7 @@ csched_switch_sched(struct scheduler *new_ops, unsigned int cpu,
ASSERT(svc && is_idle_vcpu(svc->vcpu)); ASSERT(svc && is_idle_vcpu(svc->vcpu));
idle_vcpu[cpu]->sched_priv = vdata; idle_vcpu[cpu]->sched_unit->priv = vdata;
/* /*
* We are holding the runqueue lock already (it's been taken in * We are holding the runqueue lock already (it's been taken in
@@ -1017,7 +1017,7 @@ static void
csched_unit_insert(const struct scheduler *ops, struct sched_unit *unit) csched_unit_insert(const struct scheduler *ops, struct sched_unit *unit)
{ {
struct vcpu *vc = unit->vcpu_list; struct vcpu *vc = unit->vcpu_list;
struct csched_vcpu *svc = vc->sched_priv; struct csched_vcpu *svc = unit->priv;
spinlock_t *lock; spinlock_t *lock;
BUG_ON( is_idle_vcpu(vc) ); BUG_ON( is_idle_vcpu(vc) );
+5 -5
View File
@@ -573,7 +573,7 @@ static inline struct csched2_pcpu *csched2_pcpu(unsigned int cpu)
static inline struct csched2_vcpu *csched2_vcpu(const struct vcpu *v) static inline struct csched2_vcpu *csched2_vcpu(const struct vcpu *v)
{ {
return v->sched_priv; return v->sched_unit->priv;
} }
static inline struct csched2_dom *csched2_dom(const struct domain *d) static inline struct csched2_dom *csched2_dom(const struct domain *d)
@@ -971,7 +971,7 @@ _runq_assign(struct csched2_vcpu *svc, struct csched2_runqueue_data *rqd)
static void static void
runq_assign(const struct scheduler *ops, struct vcpu *vc) runq_assign(const struct scheduler *ops, struct vcpu *vc)
{ {
struct csched2_vcpu *svc = vc->sched_priv; struct csched2_vcpu *svc = vc->sched_unit->priv;
ASSERT(svc->rqd == NULL); ASSERT(svc->rqd == NULL);
@@ -998,7 +998,7 @@ _runq_deassign(struct csched2_vcpu *svc)
static void static void
runq_deassign(const struct scheduler *ops, struct vcpu *vc) runq_deassign(const struct scheduler *ops, struct vcpu *vc)
{ {
struct csched2_vcpu *svc = vc->sched_priv; struct csched2_vcpu *svc = vc->sched_unit->priv;
ASSERT(svc->rqd == c2rqd(ops, vc->processor)); ASSERT(svc->rqd == c2rqd(ops, vc->processor));
@@ -3109,7 +3109,7 @@ static void
csched2_unit_insert(const struct scheduler *ops, struct sched_unit *unit) csched2_unit_insert(const struct scheduler *ops, struct sched_unit *unit)
{ {
struct vcpu *vc = unit->vcpu_list; struct vcpu *vc = unit->vcpu_list;
struct csched2_vcpu *svc = vc->sched_priv; struct csched2_vcpu *svc = unit->priv;
struct csched2_dom * const sdom = svc->sdom; struct csched2_dom * const sdom = svc->sdom;
spinlock_t *lock; spinlock_t *lock;
@@ -3891,7 +3891,7 @@ csched2_switch_sched(struct scheduler *new_ops, unsigned int cpu,
ASSERT(!local_irq_is_enabled()); ASSERT(!local_irq_is_enabled());
write_lock(&prv->lock); write_lock(&prv->lock);
idle_vcpu[cpu]->sched_priv = vdata; idle_vcpu[cpu]->sched_unit->priv = vdata;
rqi = init_pdata(prv, pdata, cpu); rqi = init_pdata(prv, pdata, cpu);
+2 -2
View File
@@ -116,7 +116,7 @@ static inline struct null_private *null_priv(const struct scheduler *ops)
static inline struct null_vcpu *null_vcpu(const struct vcpu *v) static inline struct null_vcpu *null_vcpu(const struct vcpu *v)
{ {
return v->sched_priv; return v->sched_unit->priv;
} }
static inline bool vcpu_check_affinity(struct vcpu *v, unsigned int cpu, static inline bool vcpu_check_affinity(struct vcpu *v, unsigned int cpu,
@@ -422,7 +422,7 @@ static spinlock_t *null_switch_sched(struct scheduler *new_ops,
ASSERT(nvc && is_idle_vcpu(nvc->vcpu)); ASSERT(nvc && is_idle_vcpu(nvc->vcpu));
idle_vcpu[cpu]->sched_priv = vdata; idle_vcpu[cpu]->sched_unit->priv = vdata;
/* /*
* We are holding the runqueue lock already (it's been taken in * We are holding the runqueue lock already (it's been taken in
+2 -2
View File
@@ -235,7 +235,7 @@ static inline struct rt_private *rt_priv(const struct scheduler *ops)
static inline struct rt_vcpu *rt_vcpu(const struct vcpu *vcpu) static inline struct rt_vcpu *rt_vcpu(const struct vcpu *vcpu)
{ {
return vcpu->sched_priv; return vcpu->sched_unit->priv;
} }
static inline struct list_head *rt_runq(const struct scheduler *ops) static inline struct list_head *rt_runq(const struct scheduler *ops)
@@ -760,7 +760,7 @@ rt_switch_sched(struct scheduler *new_ops, unsigned int cpu,
dprintk(XENLOG_DEBUG, "RTDS: timer initialized on cpu %u\n", cpu); dprintk(XENLOG_DEBUG, "RTDS: timer initialized on cpu %u\n", cpu);
} }
idle_vcpu[cpu]->sched_priv = vdata; idle_vcpu[cpu]->sched_unit->priv = vdata;
return &prv->lock; return &prv->lock;
} }
+7 -7
View File
@@ -81,7 +81,7 @@ static spinlock_t *
sched_idle_switch_sched(struct scheduler *new_ops, unsigned int cpu, sched_idle_switch_sched(struct scheduler *new_ops, unsigned int cpu,
void *pdata, void *vdata) void *pdata, void *vdata)
{ {
idle_vcpu[cpu]->sched_priv = NULL; idle_vcpu[cpu]->sched_unit->priv = NULL;
return &sched_free_cpu_lock; return &sched_free_cpu_lock;
} }
@@ -327,8 +327,8 @@ int sched_init_vcpu(struct vcpu *v, unsigned int processor)
init_timer(&v->poll_timer, poll_timer_fn, init_timer(&v->poll_timer, poll_timer_fn,
v, v->processor); v, v->processor);
v->sched_priv = sched_alloc_udata(dom_scheduler(d), unit, d->sched_priv); unit->priv = sched_alloc_udata(dom_scheduler(d), unit, d->sched_priv);
if ( v->sched_priv == NULL ) if ( unit->priv == NULL )
{ {
xfree(unit); xfree(unit);
return 1; return 1;
@@ -424,7 +424,7 @@ int sched_move_domain(struct domain *d, struct cpupool *c)
{ {
spinlock_t *lock; spinlock_t *lock;
vcpudata = v->sched_priv; vcpudata = v->sched_unit->priv;
migrate_timer(&v->periodic_timer, new_p); migrate_timer(&v->periodic_timer, new_p);
migrate_timer(&v->singleshot_timer, new_p); migrate_timer(&v->singleshot_timer, new_p);
@@ -442,7 +442,7 @@ int sched_move_domain(struct domain *d, struct cpupool *c)
*/ */
spin_unlock_irq(lock); spin_unlock_irq(lock);
v->sched_priv = vcpu_priv[v->vcpu_id]; v->sched_unit->priv = vcpu_priv[v->vcpu_id];
if ( !d->is_dying ) if ( !d->is_dying )
sched_move_irqs(v); sched_move_irqs(v);
@@ -474,7 +474,7 @@ void sched_destroy_vcpu(struct vcpu *v)
if ( test_and_clear_bool(v->is_urgent) ) if ( test_and_clear_bool(v->is_urgent) )
atomic_dec(&per_cpu(schedule_data, v->processor).urgent_count); atomic_dec(&per_cpu(schedule_data, v->processor).urgent_count);
sched_remove_unit(vcpu_scheduler(v), unit); sched_remove_unit(vcpu_scheduler(v), unit);
sched_free_udata(vcpu_scheduler(v), v->sched_priv); sched_free_udata(vcpu_scheduler(v), unit->priv);
v->sched_unit = NULL; v->sched_unit = NULL;
xfree(unit); xfree(unit);
} }
@@ -1929,7 +1929,7 @@ int schedule_cpu_switch(unsigned int cpu, struct cpupool *c)
*/ */
old_lock = pcpu_schedule_lock_irqsave(cpu, &flags); old_lock = pcpu_schedule_lock_irqsave(cpu, &flags);
vpriv_old = idle->sched_priv; vpriv_old = idle->sched_unit->priv;
ppriv_old = sd->sched_priv; ppriv_old = sd->sched_priv;
new_lock = sched_switch_sched(new_ops, cpu, ppriv, vpriv); new_lock = sched_switch_sched(new_ops, cpu, ppriv, vpriv);
+1 -1
View File
@@ -162,7 +162,6 @@ struct vcpu
struct timer poll_timer; /* timeout for SCHEDOP_poll */ struct timer poll_timer; /* timeout for SCHEDOP_poll */
struct sched_unit *sched_unit; struct sched_unit *sched_unit;
void *sched_priv; /* scheduler-specific data */
struct vcpu_runstate_info runstate; struct vcpu_runstate_info runstate;
#ifndef CONFIG_COMPAT #ifndef CONFIG_COMPAT
@@ -277,6 +276,7 @@ struct vcpu
struct sched_unit { struct sched_unit {
struct domain *domain; struct domain *domain;
struct vcpu *vcpu_list; struct vcpu *vcpu_list;
void *priv; /* scheduler private data */
unsigned int unit_id; unsigned int unit_id;
}; };
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.