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

[Xen-changelog] Fix migration for SMP guests with 1 vcpu.



# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 1032271a0abf3f11946e4d5b312560845d2baaed
# Parent  3cde4433ecdac12dee23132a47435b6af0b9dc30
Fix migration for SMP guests with 1 vcpu.
Free/setup timer irq on suspend/restore.
Only tested to localhost.  Also add initial code for >1 vcpu guests.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r 3cde4433ecda -r 1032271a0abf 
linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c       Tue Aug  2 
19:19:16 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c       Tue Aug  2 
23:13:13 2005
@@ -1560,10 +1560,14 @@
 
 void smp_suspend(void)
 {
+       /* XXX todo: take down time and ipi's on all cpus */
+       local_teardown_timer_irq();
        smp_intr_exit();
 }
 
 void smp_resume(void)
 {
+       /* XXX todo: restore time and ipi's on all cpus */
        smp_intr_init();
-}
+       local_setup_timer_irq();
+}
diff -r 3cde4433ecda -r 1032271a0abf 
linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c  Tue Aug  2 19:19:16 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c  Tue Aug  2 23:13:13 2005
@@ -860,6 +860,8 @@
 void time_suspend(void)
 {
        /* nothing */
+       teardown_irq(per_cpu(timer_irq, 0), &irq_timer);
+       unbind_virq_from_irq(VIRQ_TIMER);
 }
 
 /* No locking required. We are only CPU running, and interrupts are off. */
@@ -874,10 +876,25 @@
        processed_system_time =
                per_cpu(shadow_time, smp_processor_id()).system_timestamp;
        per_cpu(processed_system_time, 0) = processed_system_time;
+
+       per_cpu(timer_irq, 0) = bind_virq_to_irq(VIRQ_TIMER);
+       (void)setup_irq(per_cpu(timer_irq, 0), &irq_timer);
 }
 
 #ifdef CONFIG_SMP
 static char timer_name[NR_CPUS][15];
+void local_setup_timer_irq(void)
+{
+       int cpu = smp_processor_id();
+
+       if (cpu == 0)
+               return;
+       per_cpu(timer_irq, cpu) = bind_virq_to_irq(VIRQ_TIMER);
+       sprintf(timer_name[cpu], "timer%d", cpu);
+       BUG_ON(request_irq(per_cpu(timer_irq, cpu), timer_interrupt,
+                          SA_INTERRUPT, timer_name[cpu], NULL));
+}
+
 void local_setup_timer(void)
 {
        int seq, cpu = smp_processor_id();
@@ -888,10 +905,17 @@
                        per_cpu(shadow_time, cpu).system_timestamp;
        } while (read_seqretry(&xtime_lock, seq));
 
-       per_cpu(timer_irq, cpu) = bind_virq_to_irq(VIRQ_TIMER);
-       sprintf(timer_name[cpu], "timer%d", cpu);
-       BUG_ON(request_irq(per_cpu(timer_irq, cpu), timer_interrupt,
-                          SA_INTERRUPT, timer_name[cpu], NULL));
+       local_setup_timer_irq();
+}
+
+void local_teardown_timer_irq(void)
+{
+       int cpu = smp_processor_id();
+
+       if (cpu == 0)
+               return;
+       free_irq(per_cpu(timer_irq, cpu), NULL);
+       unbind_virq_from_irq(VIRQ_TIMER);
 }
 #endif
 

_______________________________________________
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®.