From: kaf24@firebug.cl.cam.ac.uk Date: Sat, 7 Jan 2006 16:52:43 +0000 (+0100) Subject: Handle migration of x86 VCPUs between physical CPUs. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16553^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1088bc0f6dcbfdfa7f282188f517ce7df3bcbd86;p=xen.git Handle migration of x86 VCPUs between physical CPUs. If required, context_switch() must pull state off of old CPU. Signed-off-by: Keir Fraser --- diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index dd79e2aad4..e44c79a1dd 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -749,11 +749,21 @@ void context_switch(struct vcpu *prev, struct vcpu *next) { unsigned int cpu = smp_processor_id(); + ASSERT(local_irq_is_enabled()); + set_current(next); if ( (percpu_ctxt[cpu].curr_vcpu != next) && !is_idle_domain(next->domain) ) { + /* This may happen if next has been migrated by the scheduler. */ + if ( unlikely(!cpus_empty(next->vcpu_dirty_cpumask)) ) + { + ASSERT(!cpu_isset(cpu, next->vcpu_dirty_cpumask)); + sync_vcpu_execstate(next); + ASSERT(cpus_empty(next->vcpu_dirty_cpumask)); + } + local_irq_disable(); __context_switch(); local_irq_enable();