From: "Jan Beulich" Subject: Re: [PATCH] x86/S3: Restore broken vcpu affinity on resume (v3) Date: Wed, 27 Mar 2013 12:50:52 +0000 Message-ID: <5152F93C02000078000C8DE2@nat28.tlf.novell.com> References: <1364387797-17939-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: <1364387797-17939-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 27.03.13 at 13:36, Ben Guthro wrote: > --- a/xen/arch/x86/acpi/power.c > +++ b/xen/arch/x86/acpi/power.c > @@ -96,7 +96,11 @@ static void thaw_domains(void) > > rcu_read_lock(&domlist_read_lock); > for_each_domain ( d ) > + { > + if (system_state == SYS_STATE_resume) I don't think there's a way to get here with system_state other than SYS_STATE_resume. Also, should there be a need to re-submit again, there are spaces missing inside the parentheses. > + restore_vcpu_affinity(d); > domain_unpause(d); > + } > rcu_read_unlock(&domlist_read_lock); > } > > --- a/xen/common/schedule.c > +++ b/xen/common/schedule.c > @@ -541,6 +541,38 @@ void vcpu_force_reschedule(struct vcpu *v) > } > } > > +void restore_vcpu_affinity(struct domain *d) > +{ > + struct vcpu *v; > + > + for_each_vcpu ( d, v ) > + { > + vcpu_schedule_lock_irq(v); > + > + if (v->affinity_broken) And here again. > + { > + printk("Restoring vcpu affinity for domain %d vcpu %d\n", > + v->domain->domain_id, v->vcpu_id); XENLOG_DEBUG perhaps? Otherwise this can get pretty noisy even without loglvl= override during resume if there are many and/or big domains. To conserve on ring and transmit buffer space, I'd also suggest shortening the text to "Restoring affinity for d%dv%d\n" (and using d->domain_id). Jan > + 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); > +} > + > /* > * This function is used by cpu_hotplug code from stop_machine context > * and from cpupools to switch schedulers on a cpu.