ia64/xen-unstable

changeset 9403:51c79c67908b

[IA64] Fix domain destroy bug when multiple domains exist

Currently vmx irq handler doesn't handle IA64_IPI_VECTOR, which is
instead pended to dom0 incorrectly. That bug made people observing
system hang when destroying domU with domVTI kept running. Actually
there's no need for two different irq handlers, which should be
same as long as softirq is checked at exit path back to guest. So
remove vmx version here.

With this fix, now we can create two domains (domU+domVTI), then
destroy domU, create another domVTI, destroy domVTI with all steps
successfully finished.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: Kevin Tian <kevin.tian@intel.com>
author awilliam@xenbuild.aw
date Fri Mar 24 10:46:14 2006 -0700 (2006-03-24)
parents e45666b8b05f
children 2e81aba147eb
files xen/arch/ia64/vmx/Makefile xen/arch/ia64/vmx/vmx_irq_ia64.c xen/arch/ia64/vmx/vmx_ivt.S
line diff
     1.1 --- a/xen/arch/ia64/vmx/Makefile	Fri Mar 24 10:41:48 2006 -0700
     1.2 +++ b/xen/arch/ia64/vmx/Makefile	Fri Mar 24 10:46:14 2006 -0700
     1.3 @@ -10,7 +10,6 @@ obj-y += vmx_entry.o
     1.4  obj-y += vmx_hypercall.o
     1.5  obj-y += vmx_init.o
     1.6  obj-y += vmx_interrupt.o
     1.7 -obj-y += vmx_irq_ia64.o
     1.8  obj-y += vmx_ivt.o
     1.9  obj-y += vmx_phy_mode.o
    1.10  obj-y += vmx_process.o
     2.1 --- a/xen/arch/ia64/vmx/vmx_irq_ia64.c	Fri Mar 24 10:41:48 2006 -0700
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,133 +0,0 @@
     2.4 -#include <linux/config.h>
     2.5 -#include <linux/module.h>
     2.6 -
     2.7 -#include <linux/jiffies.h>
     2.8 -#include <linux/errno.h>
     2.9 -#include <linux/init.h>
    2.10 -#include <linux/interrupt.h>
    2.11 -#include <linux/ioport.h>
    2.12 -#include <linux/kernel_stat.h>
    2.13 -#include <linux/slab.h>
    2.14 -#include <linux/ptrace.h>
    2.15 -#include <linux/random.h>	/* for rand_initialize_irq() */
    2.16 -#include <linux/signal.h>
    2.17 -#include <linux/smp.h>
    2.18 -#include <linux/smp_lock.h>
    2.19 -#include <linux/threads.h>
    2.20 -#include <linux/bitops.h>
    2.21 -
    2.22 -#include <asm/delay.h>
    2.23 -#include <asm/intrinsics.h>
    2.24 -#include <asm/io.h>
    2.25 -#include <asm/hw_irq.h>
    2.26 -#include <asm/machvec.h>
    2.27 -#include <asm/pgtable.h>
    2.28 -#include <asm/system.h>
    2.29 -
    2.30 -#include <asm/vcpu.h>
    2.31 -#include <xen/irq.h>
    2.32 -#ifdef CONFIG_SMP
    2.33 -#   define IS_RESCHEDULE(vec)   (vec == IA64_IPI_RESCHEDULE)
    2.34 -#else
    2.35 -#   define IS_RESCHEDULE(vec)   (0)
    2.36 -#endif
    2.37 -
    2.38 -#ifdef CONFIG_PERFMON
    2.39 -# include <asm/perfmon.h>
    2.40 -#endif
    2.41 -
    2.42 -#define IRQ_DEBUG	0
    2.43 -
    2.44 -#define vmx_irq_enter()		\
    2.45 -	add_preempt_count(HARDIRQ_OFFSET);
    2.46 -
    2.47 -/* Now softirq will be checked when leaving hypervisor, or else
    2.48 - * scheduler irq will be executed too early.
    2.49 - */
    2.50 -#define vmx_irq_exit(void)	\
    2.51 -	sub_preempt_count(HARDIRQ_OFFSET);
    2.52 -/*
    2.53 - * That's where the IVT branches when we get an external
    2.54 - * interrupt. This branches to the correct hardware IRQ handler via
    2.55 - * function ptr.
    2.56 - */
    2.57 -void
    2.58 -vmx_ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
    2.59 -{
    2.60 -	unsigned long saved_tpr;
    2.61 -	int	wake_dom0 = 0;
    2.62 -
    2.63 -
    2.64 -#if IRQ_DEBUG
    2.65 -	{
    2.66 -		unsigned long bsp, sp;
    2.67 -
    2.68 -		/*
    2.69 -		 * Note: if the interrupt happened while executing in
    2.70 -		 * the context switch routine (ia64_switch_to), we may
    2.71 -		 * get a spurious stack overflow here.  This is
    2.72 -		 * because the register and the memory stack are not
    2.73 -		 * switched atomically.
    2.74 -		 */
    2.75 -		bsp = ia64_getreg(_IA64_REG_AR_BSP);
    2.76 -		sp = ia64_getreg(_IA64_REG_AR_SP);
    2.77 -
    2.78 -		if ((sp - bsp) < 1024) {
    2.79 -			static unsigned char count;
    2.80 -			static long last_time;
    2.81 -
    2.82 -			if (jiffies - last_time > 5*HZ)
    2.83 -				count = 0;
    2.84 -			if (++count < 5) {
    2.85 -				last_time = jiffies;
    2.86 -				printk("ia64_handle_irq: DANGER: less than "
    2.87 -				       "1KB of free stack space!!\n"
    2.88 -				       "(bsp=0x%lx, sp=%lx)\n", bsp, sp);
    2.89 -			}
    2.90 -		}
    2.91 -	}
    2.92 -#endif /* IRQ_DEBUG */
    2.93 -
    2.94 -	/*
    2.95 -	 * Always set TPR to limit maximum interrupt nesting depth to
    2.96 -	 * 16 (without this, it would be ~240, which could easily lead
    2.97 -	 * to kernel stack overflows).
    2.98 -	 */
    2.99 -	vmx_irq_enter();
   2.100 -	saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
   2.101 -	ia64_srlz_d();
   2.102 -	while (vector != IA64_SPURIOUS_INT_VECTOR) {
   2.103 -	    if (!IS_RESCHEDULE(vector)) {
   2.104 -		ia64_setreg(_IA64_REG_CR_TPR, vector);
   2.105 -		ia64_srlz_d();
   2.106 -
   2.107 -		if (vector != IA64_TIMER_VECTOR) {
   2.108 -			/* FIXME: Leave IRQ re-route later */
   2.109 -			if (!VMX_DOMAIN(dom0->vcpu[0]))
   2.110 -				vcpu_pend_interrupt(dom0->vcpu[0],vector);
   2.111 -			else
   2.112 -				vmx_vcpu_pend_interrupt(dom0->vcpu[0],vector);
   2.113 -			wake_dom0 = 1;
   2.114 -		}
   2.115 -		else {	// FIXME: Handle Timer only now
   2.116 -			__do_IRQ(local_vector_to_irq(vector), regs);
   2.117 -		}
   2.118 -		
   2.119 -		/*
   2.120 -		 * Disable interrupts and send EOI:
   2.121 -		 */
   2.122 -		local_irq_disable();
   2.123 -		ia64_setreg(_IA64_REG_CR_TPR, saved_tpr);
   2.124 -	    }
   2.125 -	    ia64_eoi();
   2.126 -	    vector = ia64_get_ivr();
   2.127 -	}
   2.128 -	/*
   2.129 -	 * This must be done *after* the ia64_eoi().  For example, the keyboard softirq
   2.130 -	 * handler needs to be able to wait for further keyboard interrupts, which can't
   2.131 -	 * come through until ia64_eoi() has been done.
   2.132 -	 */
   2.133 -	vmx_irq_exit();
   2.134 -	if (wake_dom0 && current->domain != dom0 ) 
   2.135 -		vcpu_wake(dom0->vcpu[0]);
   2.136 -}
     3.1 --- a/xen/arch/ia64/vmx/vmx_ivt.S	Fri Mar 24 10:41:48 2006 -0700
     3.2 +++ b/xen/arch/ia64/vmx/vmx_ivt.S	Fri Mar 24 10:46:14 2006 -0700
     3.3 @@ -551,7 +551,7 @@ ENTRY(vmx_interrupt)
     3.4  	movl r14=ia64_leave_nested
     3.5  	;;
     3.6  	mov rp=r14
     3.7 -	br.call.sptk.many b6=vmx_ia64_handle_irq
     3.8 +	br.call.sptk.many b6=ia64_handle_irq
     3.9  	;;
    3.10  END(vmx_interrupt)
    3.11  
    3.12 @@ -1110,7 +1110,7 @@ ENTRY(vmx_dispatch_interrupt)
    3.13  	mov rp=r14
    3.14  	;;
    3.15  	add out1=16,sp		// pass pointer to pt_regs as second arg
    3.16 -	br.call.sptk.many b6=vmx_ia64_handle_irq
    3.17 +	br.call.sptk.many b6=ia64_handle_irq
    3.18  END(vmx_dispatch_interrupt)
    3.19  
    3.20