return false;
}
-static void sched_reset_affinity_broken(const struct sched_unit *unit)
-{
- struct vcpu *v;
-
- for_each_sched_unit_vcpu ( unit, v )
- v->affinity_broken = false;
-}
-
-void restore_vcpu_affinity(struct domain *d)
-{
- unsigned int cpu = smp_processor_id();
- struct sched_unit *unit;
-
- ASSERT(system_state == SYS_STATE_resume);
-
- rcu_read_lock(&sched_res_rculock);
-
- for_each_sched_unit ( d, unit )
- {
- spinlock_t *lock;
- unsigned int old_cpu = sched_unit_master(unit);
- struct sched_resource *res;
-
- ASSERT(!unit_runnable(unit));
-
- /*
- * Re-assign the initial processor as after resume we have no
- * guarantee the old processor has come back to life again.
- *
- * Therefore, here, before actually unpausing the domains, we should
- * set v->processor of each of their vCPUs to something that will
- * make sense for the scheduler of the cpupool in which they are in.
- */
- lock = unit_schedule_lock_irq(unit);
-
- cpumask_and(cpumask_scratch_cpu(cpu), unit->cpu_hard_affinity,
- cpupool_domain_master_cpumask(d));
- if ( cpumask_empty(cpumask_scratch_cpu(cpu)) )
- {
- if ( sched_check_affinity_broken(unit) )
- {
- sched_set_affinity(unit, unit->cpu_hard_affinity_saved, NULL);
- sched_reset_affinity_broken(unit);
- cpumask_and(cpumask_scratch_cpu(cpu), unit->cpu_hard_affinity,
- cpupool_domain_master_cpumask(d));
- }
-
- if ( cpumask_empty(cpumask_scratch_cpu(cpu)) )
- {
- /* Affinity settings of one vcpu are for the complete unit. */
- printk(XENLOG_DEBUG "Breaking affinity for %pv\n",
- unit->vcpu_list);
- sched_set_affinity(unit, &cpumask_all, NULL);
- cpumask_and(cpumask_scratch_cpu(cpu), unit->cpu_hard_affinity,
- cpupool_domain_master_cpumask(d));
- }
- }
-
- res = get_sched_res(cpumask_any(cpumask_scratch_cpu(cpu)));
- sched_set_res(unit, res);
-
- spin_unlock_irq(lock);
-
- /* v->processor might have changed, so reacquire the lock. */
- lock = unit_schedule_lock_irq(unit);
- res = sched_pick_resource(unit_scheduler(unit), unit);
- sched_set_res(unit, res);
- spin_unlock_irq(lock);
-
- if ( old_cpu != sched_unit_master(unit) )
- sched_move_irqs(unit);
- }
-
- rcu_read_unlock(&sched_res_rculock);
-
- domain_update_node_affinity(d);
-}
-
/*
* This function is used by cpu_hotplug code via cpu notifier chain
* and from cpupools to switch schedulers on a cpu.