From: "Jan Beulich" Subject: Re: [PATCH] x86/S3: Restore broken vcpu affinity on resume Date: Wed, 27 Mar 2013 09:19:46 +0000 Message-ID: <5152C7C202000078000C8CE9@nat28.tlf.novell.com> References: <1364318408-15970-1-git-send-email-benjamin.guthro@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1364318408-15970-1-git-send-email-benjamin.guthro@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ben Guthro Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 26.03.13 at 18:20, Ben Guthro 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); > + } > + } > +}