[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v1 2/5] xen: sched: null: don't assign down vcpus to pcpus
If a pCPU has been/is being offlined, we don't want it to be neither assigned to any pCPU, nor in the wait list. So, avoid doing that while inserting or migrating vcpus. Signed-off-by: Dario Faggioli <dfaggioli@xxxxxxxx> --- Cc: George Dunlap <george.dunlap@xxxxxxxxxxxxx> Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx> Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx> --- xen/common/sched_null.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/xen/common/sched_null.c b/xen/common/sched_null.c index f372172c32..1426124525 100644 --- a/xen/common/sched_null.c +++ b/xen/common/sched_null.c @@ -340,6 +340,8 @@ static unsigned int pick_cpu(struct null_private *prv, struct vcpu *v) static void vcpu_assign(struct null_private *prv, struct vcpu *v, unsigned int cpu) { + ASSERT(is_vcpu_online(v)); + per_cpu(npc, cpu).vcpu = v; v->processor = cpu; cpumask_clear_cpu(cpu, &prv->cpus_free); @@ -454,8 +456,14 @@ static void null_vcpu_insert(const struct scheduler *ops, struct vcpu *v) ASSERT(!is_idle_vcpu(v)); lock = vcpu_schedule_lock_irq(v); - retry: + if ( unlikely(!is_vcpu_online(v)) ) + { + vcpu_schedule_unlock_irq(lock, v); + return; + } + + retry: cpu = v->processor = pick_cpu(prv, v); spin_unlock(lock); @@ -617,6 +625,21 @@ static void null_vcpu_migrate(const struct scheduler *ops, struct vcpu *v, SCHED_STAT_CRANK(migrated); + /* + * If it was/it's going offline, we don't want it neither assigned to + * a vcpu, nor in the waitqueue. + * + * If it was on a cpu, we've removed it from there above. If it is in the + * waitqueue, we remove it from there now. And then we bail. + */ + if ( unlikely(!is_vcpu_online(v)) ) + { + spin_lock(&prv->waitq_lock); + list_del_init(&nvc->waitq_elem); + spin_unlock(&prv->waitq_lock); + goto out; + } + /* * Let's now consider new_cpu, which is where v is being sent. It can be * either free, or have a vCPU already assigned to it. @@ -657,6 +680,7 @@ static void null_vcpu_migrate(const struct scheduler *ops, struct vcpu *v, * at least. In case of suspend, any temporary inconsistency caused * by this, will be fixed-up during resume. */ + out: v->processor = new_cpu; } _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |