ia64/xen-unstable

changeset 6001:1032271a0abf

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@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Tue Aug 02 23:13:13 2005 +0000 (2005-08-02)
parents 3cde4433ecda
children 565cec5b9cc2
files linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c	Tue Aug 02 19:19:16 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c	Tue Aug 02 23:13:13 2005 +0000
     1.3 @@ -1560,10 +1560,14 @@ static void smp_intr_exit(void)
     1.4  
     1.5  void smp_suspend(void)
     1.6  {
     1.7 +	/* XXX todo: take down time and ipi's on all cpus */
     1.8 +	local_teardown_timer_irq();
     1.9  	smp_intr_exit();
    1.10  }
    1.11  
    1.12  void smp_resume(void)
    1.13  {
    1.14 +	/* XXX todo: restore time and ipi's on all cpus */
    1.15  	smp_intr_init();
    1.16 +	local_setup_timer_irq();
    1.17  }
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c	Tue Aug 02 19:19:16 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c	Tue Aug 02 23:13:13 2005 +0000
     2.3 @@ -860,6 +860,8 @@ void start_hz_timer(void)
     2.4  void time_suspend(void)
     2.5  {
     2.6  	/* nothing */
     2.7 +	teardown_irq(per_cpu(timer_irq, 0), &irq_timer);
     2.8 +	unbind_virq_from_irq(VIRQ_TIMER);
     2.9  }
    2.10  
    2.11  /* No locking required. We are only CPU running, and interrupts are off. */
    2.12 @@ -874,10 +876,25 @@ void time_resume(void)
    2.13  	processed_system_time =
    2.14  		per_cpu(shadow_time, smp_processor_id()).system_timestamp;
    2.15  	per_cpu(processed_system_time, 0) = processed_system_time;
    2.16 +
    2.17 +	per_cpu(timer_irq, 0) = bind_virq_to_irq(VIRQ_TIMER);
    2.18 +	(void)setup_irq(per_cpu(timer_irq, 0), &irq_timer);
    2.19  }
    2.20  
    2.21  #ifdef CONFIG_SMP
    2.22  static char timer_name[NR_CPUS][15];
    2.23 +void local_setup_timer_irq(void)
    2.24 +{
    2.25 +	int cpu = smp_processor_id();
    2.26 +
    2.27 +	if (cpu == 0)
    2.28 +		return;
    2.29 +	per_cpu(timer_irq, cpu) = bind_virq_to_irq(VIRQ_TIMER);
    2.30 +	sprintf(timer_name[cpu], "timer%d", cpu);
    2.31 +	BUG_ON(request_irq(per_cpu(timer_irq, cpu), timer_interrupt,
    2.32 +	                   SA_INTERRUPT, timer_name[cpu], NULL));
    2.33 +}
    2.34 +
    2.35  void local_setup_timer(void)
    2.36  {
    2.37  	int seq, cpu = smp_processor_id();
    2.38 @@ -888,10 +905,17 @@ void local_setup_timer(void)
    2.39  			per_cpu(shadow_time, cpu).system_timestamp;
    2.40  	} while (read_seqretry(&xtime_lock, seq));
    2.41  
    2.42 -	per_cpu(timer_irq, cpu) = bind_virq_to_irq(VIRQ_TIMER);
    2.43 -	sprintf(timer_name[cpu], "timer%d", cpu);
    2.44 -	BUG_ON(request_irq(per_cpu(timer_irq, cpu), timer_interrupt,
    2.45 -	                   SA_INTERRUPT, timer_name[cpu], NULL));
    2.46 +	local_setup_timer_irq();
    2.47 +}
    2.48 +
    2.49 +void local_teardown_timer_irq(void)
    2.50 +{
    2.51 +	int cpu = smp_processor_id();
    2.52 +
    2.53 +	if (cpu == 0)
    2.54 +		return;
    2.55 +	free_irq(per_cpu(timer_irq, cpu), NULL);
    2.56 +	unbind_virq_from_irq(VIRQ_TIMER);
    2.57  }
    2.58  #endif
    2.59