From: Jeff Kubascik Date: Fri, 17 Apr 2020 07:27:21 +0000 (+0200) Subject: sched/core: fix bug when moving a domain between cpupools X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~396 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ee97008433f15e60478058c8ace514b939b6f862;p=xen.git sched/core: fix bug when moving a domain between cpupools For each UNIT, sched_set_affinity is called before unit->priv is updated to the new cpupool private UNIT data structure. The issue is sched_set_affinity will call the adjust_affinity method of the cpupool. If defined, the new cpupool may use unit->priv (e.g. credit), which at this point still references the old cpupool private UNIT data structure. This change fixes the bug by moving the switch of unit->priv earler in the function. Signed-off-by: Jeff Kubascik Reviewed-by: Juergen Gross Acked-by: Dario Faggioli --- diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 626861a3fe..c4ed070470 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -686,6 +686,7 @@ int sched_move_domain(struct domain *d, struct cpupool *c) unsigned int unit_p = new_p; unitdata = unit->priv; + unit->priv = unit_priv[unit_idx]; for_each_sched_unit_vcpu ( unit, v ) { @@ -707,7 +708,6 @@ int sched_move_domain(struct domain *d, struct cpupool *c) */ spin_unlock_irq(lock); - unit->priv = unit_priv[unit_idx]; if ( !d->is_dying ) sched_move_irqs(unit);