mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
sched_rt: implement the .free_pdata hook
which is called by cpu_schedule_down(), and is necessary for resetting the spinlock pointers in schedule_data from the RTDS global runqueue lock, back to the default _lock fields in the struct. Not doing so causes Xen to explode, e.g., when removing pCPUs from an RTDS cpupool and assigning them to another one. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Reviewed-by: Meng Xu <mengxu@cis.upenn.edu> Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
This commit is contained in:
1 parent
319442762f
commit
3c1eee0472
1 file changed
+18
@@ -444,6 +444,23 @@ rt_alloc_pdata(const struct scheduler *ops, int cpu)
|
||||
return (void *)1;
|
||||
}
|
||||
|
||||
static void
|
||||
rt_free_pdata(const struct scheduler *ops, void *pcpu, int cpu)
|
||||
{
|
||||
struct rt_private *prv = rt_priv(ops);
|
||||
struct schedule_data *sd = &per_cpu(schedule_data, cpu);
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&prv->lock, flags);
|
||||
|
||||
/* Move spinlock back to the default lock */
|
||||
ASSERT(sd->schedule_lock == &prv->lock);
|
||||
ASSERT(!spin_is_locked(&sd->_lock));
|
||||
sd->schedule_lock = &sd->_lock;
|
||||
|
||||
spin_unlock_irqrestore(&prv->lock, flags);
|
||||
}
|
||||
|
||||
static void *
|
||||
rt_alloc_domdata(const struct scheduler *ops, struct domain *dom)
|
||||
{
|
||||
@@ -1108,6 +1125,7 @@ const struct scheduler sched_rtds_def = {
|
||||
.init = rt_init,
|
||||
.deinit = rt_deinit,
|
||||
.alloc_pdata = rt_alloc_pdata,
|
||||
.free_pdata = rt_free_pdata,
|
||||
.alloc_domdata = rt_alloc_domdata,
|
||||
.free_domdata = rt_free_domdata,
|
||||
.init_domain = rt_dom_init,
|
||||
|
||||