direct-io.hg

changeset 13473:d607d575ec6a

[IA64] Can't inject event, when guest is executing rfi

Can't inject event, when guest is executing rfi, and both
both PSCB(v, ifs) and regs->ifs are valid

It's very rare case, but I did catch it.
It caused domain0 crash

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
author awilliam@xenbuild2.aw
date Thu Jan 11 14:27:39 2007 -0700 (2007-01-11)
parents b440f5dbca1f
children db72b85b81bb
files xen/arch/ia64/xen/faults.c xen/arch/ia64/xen/vcpu.c xen/include/asm-ia64/vcpu.h
line diff
     1.1 --- a/xen/arch/ia64/xen/faults.c	Fri Jan 12 12:52:54 2007 -0700
     1.2 +++ b/xen/arch/ia64/xen/faults.c	Thu Jan 11 14:27:39 2007 -0700
     1.3 @@ -134,6 +134,11 @@ void reflect_event(struct pt_regs *regs)
     1.4  	if (!event_pending(v))
     1.5  		return;
     1.6  
     1.7 +	// can't inject event, when XEN is emulating rfi 
     1.8 +	// and both PSCB(v, ifs) and regs->ifs are valid
     1.9 +	if (regs->cr_iip == *(unsigned long *)dorfirfi)
    1.10 +		return;
    1.11 +
    1.12  	if (!PSCB(v, interrupt_collection_enabled))
    1.13  		printk("psr.ic off, delivering event, ipsr=%lx,iip=%lx,"
    1.14  		       "isr=%lx,viip=0x%lx\n",
     2.1 --- a/xen/arch/ia64/xen/vcpu.c	Fri Jan 12 12:52:54 2007 -0700
     2.2 +++ b/xen/arch/ia64/xen/vcpu.c	Thu Jan 11 14:27:39 2007 -0700
     2.3 @@ -1326,7 +1326,6 @@ IA64FAULT vcpu_rfi(VCPU * vcpu)
     2.4  	u64 int_enable, regspsr = 0;
     2.5  	u64 ifs;
     2.6  	REGS *regs = vcpu_regs(vcpu);
     2.7 -	extern void dorfirfi(void);
     2.8  
     2.9  	psr.i64 = PSCB(vcpu, ipsr);
    2.10  	if (psr.ia64_psr.cpl < 3)
    2.11 @@ -1350,18 +1349,24 @@ IA64FAULT vcpu_rfi(VCPU * vcpu)
    2.12  		return IA64_ILLOP_FAULT;
    2.13  	}
    2.14  	PSCB(vcpu, incomplete_regframe) = 0;	// is this necessary?
    2.15 +
    2.16  	ifs = PSCB(vcpu, ifs);
    2.17 -	//if ((ifs & regs->cr_ifs & 0x8000000000000000L) && ifs != regs->cr_ifs) {
    2.18 -	//if ((ifs & 0x8000000000000000L) && ifs != regs->cr_ifs) {
    2.19 -	if (ifs & regs->cr_ifs & 0x8000000000000000L) {
    2.20 -		// TODO: validate PSCB(vcpu,iip)
    2.21 -		// TODO: PSCB(vcpu,ipsr) = psr;
    2.22 -		PSCB(vcpu, ipsr) = psr.i64;
    2.23 -		// now set up the trampoline
    2.24 -		regs->cr_iip = *(unsigned long *)dorfirfi; // function pointer!!
    2.25 -		__asm__ __volatile("mov %0=psr;;":"=r"(regspsr)::"memory");
    2.26 -		regs->cr_ipsr =
    2.27 -		    regspsr & ~(IA64_PSR_I | IA64_PSR_IC | IA64_PSR_BN);
    2.28 +	if (ifs > 0x8000000000000000UL) {
    2.29 +		if (regs->cr_ifs > 0x8000000000000000UL) {
    2.30 +			// TODO: validate PSCB(vcpu,iip)
    2.31 +			// TODO: PSCB(vcpu,ipsr) = psr;
    2.32 +			PSCB(vcpu, ipsr) = psr.i64;
    2.33 +			// now set up the trampoline
    2.34 +			regs->cr_iip = *(unsigned long *)dorfirfi; // func ptr!
    2.35 +			__asm__ __volatile("mov %0=psr;;":"=r"(regspsr)
    2.36 +			                   ::"memory");
    2.37 +			regs->cr_ipsr = regspsr & ~(IA64_PSR_I | IA64_PSR_IC |
    2.38 +			                            IA64_PSR_BN);
    2.39 +		} else {
    2.40 +			regs->cr_ifs = ifs;
    2.41 +			regs->cr_ipsr = psr.i64;
    2.42 +			regs->cr_iip = PSCB(vcpu, iip);
    2.43 +		}
    2.44  	} else {
    2.45  		regs->cr_ipsr = psr.i64;
    2.46  		regs->cr_iip = PSCB(vcpu, iip);
     3.1 --- a/xen/include/asm-ia64/vcpu.h	Fri Jan 12 12:52:54 2007 -0700
     3.2 +++ b/xen/include/asm-ia64/vcpu.h	Thu Jan 11 14:27:39 2007 -0700
     3.3 @@ -23,6 +23,8 @@ extern u64 cycle_to_ns(u64 cycle);
     3.4  
     3.5  #define SPURIOUS_VECTOR 0xf
     3.6  
     3.7 +extern void dorfirfi(void);
     3.8 +
     3.9  /* general registers */
    3.10  extern u64 vcpu_get_gr(VCPU * vcpu, unsigned long reg);
    3.11  extern IA64FAULT vcpu_get_gr_nat(VCPU * vcpu, unsigned long reg, u64 * val);