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

[Xen-changelog] [xen-unstable] x86, cpu hotplug: Synchronise vcpu state earlier during cpu offline.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1270624140 -3600
# Node ID 7794f61c61f3b0c90e367a87b287850b31645742
# Parent  adce8bc43fcccf8730b1da962be60c457c51fa1b
x86, cpu hotplug: Synchronise vcpu state earlier during cpu offline.

Needs to happen before non-idle VCPU is fully descheduled after CPU is
removed from cpu_online_map. Else sync_vcpu_execstate() doesn't work
properly.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/domain.c  |    3 ++-
 xen/arch/x86/smpboot.c |   17 ++++++++++-------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff -r adce8bc43fcc -r 7794f61c61f3 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Tue Apr 06 07:16:47 2010 +0100
+++ b/xen/arch/x86/domain.c     Wed Apr 07 08:09:00 2010 +0100
@@ -1442,7 +1442,8 @@ void context_switch(struct vcpu *prev, s
 
     set_current(next);
 
-    if ( (per_cpu(curr_vcpu, cpu) == next) || is_idle_vcpu(next) )
+    if ( (per_cpu(curr_vcpu, cpu) == next) ||
+         (is_idle_vcpu(next) && cpu_online(cpu)) )
     {
         local_irq_enable();
     }
diff -r adce8bc43fcc -r 7794f61c61f3 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c    Tue Apr 06 07:16:47 2010 +0100
+++ b/xen/arch/x86/smpboot.c    Wed Apr 07 08:09:00 2010 +0100
@@ -997,17 +997,13 @@ static int __devinit do_boot_cpu(int api
        return boot_error;
 }
 
-static void idle_task_exit(void)
-{
-       /* Give up lazy state borrowed by this idle vcpu */
-       __sync_lazy_execstate();
-}
-
 void cpu_exit_clear(void)
 {
        int cpu = raw_smp_processor_id();
 
-       idle_task_exit();
+       /* Previous non-idle state should be synchronised already. */
+       if (__sync_lazy_execstate())
+               BUG();
 
        cpucount --;
        cpu_uninit();
@@ -1301,6 +1297,13 @@ int __cpu_disable(void)
        cpu_mcheck_disable();
 
        remove_siblinginfo(cpu);
+
+       /*
+        * If we are running the idle vcpu, sync last non-idle vcpu's state
+        * before changing cpu_online_map. If we are running non-idle vcpu,
+        * we will synchronously sync the state in context_switch() later.
+        */
+       __sync_lazy_execstate();
 
        /* It's now safe to remove this processor from the online map */
        cpu_clear(cpu, cpu_online_map);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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