[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] x86/S3: Restore broken vcpu affinity on resume



>>> On 26.03.13 at 18:20, Ben Guthro <benjamin.guthro@xxxxxxxxxx> wrote:
> +void restore_vcpu_affinity()
> +{
> +    struct domain *d;
> +    struct vcpu *v;
> +    struct cpupool **c;
> +
> +    for_each_cpupool(c)
> +    {
> +        for_each_domain_in_cpupool ( d, *c )

On a second look, I wonder why the two loops above can't be
replaced by for_each_domain(), avoiding the need to widen the
scopes of the two CPU pool specific items.

Furthermore the function could then take a domain pointer
(rather than itself looping over all domains), and be called from
thaw_domains() right before the call to domain_unpause().

Jan

> +        {
> +            for_each_vcpu ( d, v )
> +            {
> +                vcpu_schedule_lock_irq(v);
> +
> +                if (v->affinity_broken)
> +                {
> +                    printk("Restoring vcpu affinity for domain %d vcpu %d\n",
> +                            v->domain->domain_id, v->vcpu_id);
> +                    cpumask_copy(v->cpu_affinity, v->cpu_affinity_saved);
> +                    v->affinity_broken = 0;
> +                }
> +
> +                if ( v->processor == smp_processor_id() )
> +                {
> +                    set_bit(_VPF_migrating, &v->pause_flags);
> +                    vcpu_schedule_unlock_irq(v);
> +                    vcpu_sleep_nosync(v);
> +                    vcpu_migrate(v);
> +                }
> +                else
> +                {
> +                    vcpu_schedule_unlock_irq(v);
> +                }
> +            }
> +
> +            domain_update_node_affinity(d);
> +        }
> +    }
> +}



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.