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

[Xen-changelog] [IA64] fixed switch to idle domain bug



# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID dcbe36ee21718d5f423c6415ed79ce6a8d0ab4f9
# Parent  3c091740f6ff3abe77ffd4ef0610a05b0fd98f6f
[IA64] fixed switch to idle domain bug

Previously when switching to idle domain, cr.pta is set to dom0's VHPT,
then when switching from VTIdomain to idle domain, cr.pta is set to
dom0's VHPT, and in idle domain, VHPT will be not remapped by TR, so
there may be unexpected vhpt fault in idle domain, which may cause
domain crash. Above only happens in host smp platform not host up
platform. This patch is intended to fix this bug.

Signed-off-by: Kevin Tian <kevin.tian@xxxxxxxxx>
Signed-off-by: Anthony Xu <anthony.xu@xxxxxxxxx>

diff -r 3c091740f6ff -r dcbe36ee2171 xen/arch/ia64/xen/xenmisc.c
--- a/xen/arch/ia64/xen/xenmisc.c       Fri Feb 17 21:57:19 2006
+++ b/xen/arch/ia64/xen/xenmisc.c       Fri Feb 17 22:02:40 2006
@@ -295,6 +295,7 @@
 void context_switch(struct vcpu *prev, struct vcpu *next)
 {
     uint64_t spsr;
+    uint64_t pta;
 
     local_irq_save(spsr);
     if(VMX_DOMAIN(prev)){
@@ -302,9 +303,9 @@
     }
        context_switch_count++;
        switch_to(prev,next,prev);
-    if(VMX_DOMAIN(current)){
-        vtm_domain_in(current);
-    }
+//    if(VMX_DOMAIN(current)){
+//        vtm_domain_in(current);
+//    }
 
 // leave this debug for now: it acts as a heartbeat when more than
 // one domain is active
@@ -317,18 +318,26 @@
 }
 
     if (VMX_DOMAIN(current)){
+        vtm_domain_in(current);
                vmx_load_all_rr(current);
     }else{
-       extern char ia64_ivt;
-       ia64_set_iva(&ia64_ivt);
-       ia64_set_pta(VHPT_ADDR | (1 << 8) | (VHPT_SIZE_LOG2 << 2) |
-               VHPT_ENABLED);
+       extern char ia64_ivt;
+       ia64_set_iva(&ia64_ivt);
        if (!is_idle_domain(current->domain)) {
+               ia64_set_pta(VHPT_ADDR | (1 << 8) | (VHPT_SIZE_LOG2 << 2) |
+                       VHPT_ENABLED);
                load_region_regs(current);
                vcpu_load_kernel_regs(current);
-                   if (vcpu_timer_expired(current)) vcpu_pend_timer(current);
-       }
-           if (vcpu_timer_expired(current)) vcpu_pend_timer(current);
+                   if (vcpu_timer_expired(current))
+                vcpu_pend_timer(current);
+       }else {
+        /* When switching to idle domain, only need to disable vhpt
+        * walker. Then all accesses happen within idle context will
+        * be handled by TR mapping and identity mapping.
+        */
+           pta = ia64_get_pta();
+           ia64_set_pta(pta & ~VHPT_ENABLED);
+        }
     }
 
     local_irq_restore(spsr);
diff -r 3c091740f6ff -r dcbe36ee2171 
xen/include/asm-ia64/linux-xen/asm/processor.h
--- a/xen/include/asm-ia64/linux-xen/asm/processor.h    Fri Feb 17 21:57:19 2006
+++ b/xen/include/asm-ia64/linux-xen/asm/processor.h    Fri Feb 17 22:02:40 2006
@@ -639,6 +639,19 @@
        return r;
 }
 
+#ifdef XEN
+/* Get the page table address and control bits.  */
+static inline __u64
+ia64_get_pta (void)
+{
+   __u64 r;
+   ia64_srlz_d();
+   r = ia64_getreg(_IA64_REG_CR_PTA);
+   ia64_srlz_d();
+   return r;
+}
+#endif
+
 static inline void
 ia64_set_dbr (__u64 regnum, __u64 value)
 {

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