Message ID | 20160318190401.8117.69985.stgit@Solace.station (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Mar 18, 2016 at 3:04 PM, Dario Faggioli <dario.faggioli@citrix.com> wrote: > as doing that include changing the scheduler lock > mapping for the pCPU itself, and the correct way > of doing that is: > - take the lock that the pCPU is using right now > (which may be the lock of another scheduler); > - change the mapping of the lock to the RTDS one; > - release the lock (the one that has actually been > taken!) > > Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> > --- > Cc: Meng Xu <mengxu@cis.upenn.edu> > Cc: George Dunlap <george.dunlap@eu.citrix.com> > Cc: Tianyang Chen <tiche@seas.upenn.edu> Reviewed-by: Meng Xu <mengxu@cis.upenn.edu>
On 18/03/16 19:04, Dario Faggioli wrote: > as doing that include changing the scheduler lock > mapping for the pCPU itself, and the correct way > of doing that is: > - take the lock that the pCPU is using right now > (which may be the lock of another scheduler); > - change the mapping of the lock to the RTDS one; > - release the lock (the one that has actually been > taken!) > > Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Reviewed-by: George Dunlap <george.dunlap@citrix.com> > --- > Cc: Meng Xu <mengxu@cis.upenn.edu> > Cc: George Dunlap <george.dunlap@eu.citrix.com> > Cc: Tianyang Chen <tiche@seas.upenn.edu> > --- > xen/common/sched_rt.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c > index c896a6f..d98bfb6 100644 > --- a/xen/common/sched_rt.c > +++ b/xen/common/sched_rt.c > @@ -653,11 +653,16 @@ static void * > rt_alloc_pdata(const struct scheduler *ops, int cpu) > { > struct rt_private *prv = rt_priv(ops); > + spinlock_t *old_lock; > unsigned long flags; > > - spin_lock_irqsave(&prv->lock, flags); > + /* Move the scheduler lock to our global runqueue lock. */ > + old_lock = pcpu_schedule_lock_irqsave(cpu, &flags); > + > per_cpu(schedule_data, cpu).schedule_lock = &prv->lock; > - spin_unlock_irqrestore(&prv->lock, flags); > + > + /* _Not_ pcpu_schedule_unlock(): per_cpu().schedule_lock changed! */ > + spin_unlock_irqrestore(old_lock, flags); > > if ( !alloc_cpumask_var(&_cpumask_scratch[cpu]) ) > return NULL; >
diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c index c896a6f..d98bfb6 100644 --- a/xen/common/sched_rt.c +++ b/xen/common/sched_rt.c @@ -653,11 +653,16 @@ static void * rt_alloc_pdata(const struct scheduler *ops, int cpu) { struct rt_private *prv = rt_priv(ops); + spinlock_t *old_lock; unsigned long flags; - spin_lock_irqsave(&prv->lock, flags); + /* Move the scheduler lock to our global runqueue lock. */ + old_lock = pcpu_schedule_lock_irqsave(cpu, &flags); + per_cpu(schedule_data, cpu).schedule_lock = &prv->lock; - spin_unlock_irqrestore(&prv->lock, flags); + + /* _Not_ pcpu_schedule_unlock(): per_cpu().schedule_lock changed! */ + spin_unlock_irqrestore(old_lock, flags); if ( !alloc_cpumask_var(&_cpumask_scratch[cpu]) ) return NULL;
as doing that include changing the scheduler lock mapping for the pCPU itself, and the correct way of doing that is: - take the lock that the pCPU is using right now (which may be the lock of another scheduler); - change the mapping of the lock to the RTDS one; - release the lock (the one that has actually been taken!) Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> --- Cc: Meng Xu <mengxu@cis.upenn.edu> Cc: George Dunlap <george.dunlap@eu.citrix.com> Cc: Tianyang Chen <tiche@seas.upenn.edu> --- xen/common/sched_rt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)