WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [IA64] Display the information in fault handler

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [IA64] Display the information in fault handler
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 23 May 2006 12:44:29 +0000
Delivery-date: Tue, 23 May 2006 05:48:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID c3506e73b63e187988e96c3a043e7acb7680e332
# Parent  f024bb5f5a075ccf65fe41e1b2111a531d0714b7
[IA64] Display the information in fault handler

  This patch modifies the interruption handler to display the
information about the interruption and then do panic in the case of the
fault occurred in hypervisor, or reflect to the guest when handling the
fault in guest.

  The modification is as follows:
1. In each handler in IVT, the procedure is added to branch to fault
handler or reflection according to ipsr.cpl.
2. In the case of the fault occurred in hypervisor(ipsr.cpl==0), the
fault handler displays the information (vector, registers, and stack by
calling show_registers()), and then do panic().
3. In the case of the fault occurred in guest(ipsr.cpl!=0), it is
reflected to the guest.

  With this modification, some faults which were always treated to be
reflected to the guest are changed to do panic when they occur in
hypervisor.

Signed-off-by: Tetsu Yamamoto <yamamoto.tetsu@xxxxxxxxxxxxxx>
---
 xen/arch/ia64/xen/ivt.S     |   49 ++++----
 xen/arch/ia64/xen/process.c |  264 ++++++++++++++++----------------------------
 2 files changed, 129 insertions(+), 184 deletions(-)

diff -r f024bb5f5a07 -r c3506e73b63e xen/arch/ia64/xen/ivt.S
--- a/xen/arch/ia64/xen/ivt.S   Wed May 10 15:29:54 2006 -0600
+++ b/xen/arch/ia64/xen/ivt.S   Wed May 10 15:50:27 2006 -0600
@@ -100,6 +100,15 @@
        mov r19=n;;                     /* prepare to save predicates */        
        \
        br.sptk.many dispatch_to_fault_handler
 
+#define FAULT_OR_REFLECT(n)                                                    
        \
+       mov r31=pr;                                                             
        \
+       mov r20=cr.ipsr;;                                                       
        \
+       mov r19=n;      /* prepare to save predicates */                        
        \
+       extr.u r20=r20,IA64_PSR_CPL0_BIT,2;;                                    
        \
+       cmp.ne p6,p0=r0,r20;    /* cpl != 0?*/                                  
        \
+(p6)   br.dptk.many dispatch_reflection;                                       
        \
+       br.sptk.few dispatch_to_fault_handler
+
 #ifdef XEN
 #define REFLECT(n)                                                             
        \
        mov r31=pr;                                                             
        \
@@ -697,7 +706,7 @@ ENTRY(ikey_miss)
 ENTRY(ikey_miss)
        DBG_FAULT(6)
 #ifdef XEN
-       REFLECT(6)
+       FAULT_OR_REFLECT(6)
 #endif
        FAULT(6)
 END(ikey_miss)
@@ -746,7 +755,7 @@ ENTRY(dkey_miss)
 ENTRY(dkey_miss)
        DBG_FAULT(7)
 #ifdef XEN
-       REFLECT(7)
+       FAULT_OR_REFLECT(7)
 #endif
        FAULT(7)
 END(dkey_miss)
@@ -757,7 +766,7 @@ ENTRY(dirty_bit)
 ENTRY(dirty_bit)
        DBG_FAULT(8)
 #ifdef XEN
-       REFLECT(8)
+       FAULT_OR_REFLECT(8)
 #endif
        /*
         * What we do here is to simply turn on the dirty bit in the PTE.  We 
need to
@@ -1523,7 +1532,7 @@ ENTRY(page_not_present)
 ENTRY(page_not_present)
        DBG_FAULT(20)
 #ifdef XEN
-       REFLECT(20)
+       FAULT_OR_REFLECT(20)
 #endif
        mov r16=cr.ifa
        rsm psr.dt
@@ -1546,7 +1555,7 @@ ENTRY(key_permission)
 ENTRY(key_permission)
        DBG_FAULT(21)
 #ifdef XEN
-       REFLECT(21)
+       FAULT_OR_REFLECT(21)
 #endif
        mov r16=cr.ifa
        rsm psr.dt
@@ -1562,7 +1571,7 @@ ENTRY(iaccess_rights)
 ENTRY(iaccess_rights)
        DBG_FAULT(22)
 #ifdef XEN
-       REFLECT(22)
+       FAULT_OR_REFLECT(22)
 #endif
        mov r16=cr.ifa
        rsm psr.dt
@@ -1637,7 +1646,7 @@ ENTRY(disabled_fp_reg)
        mov pr=r20,-1
        ;;
 #endif
-       REFLECT(25)
+       FAULT_OR_REFLECT(25)
 //floating_panic:
 //     br.sptk.many floating_panic
        ;;
@@ -1656,7 +1665,7 @@ ENTRY(nat_consumption)
 ENTRY(nat_consumption)
        DBG_FAULT(26)
 #ifdef XEN
-       REFLECT(26)
+       FAULT_OR_REFLECT(26)
 #endif
        FAULT(26)
 END(nat_consumption)
@@ -1668,7 +1677,7 @@ ENTRY(speculation_vector)
        DBG_FAULT(27)
 #ifdef XEN
        // this probably need not reflect...
-       REFLECT(27)
+       FAULT_OR_REFLECT(27)
 #endif
        /*
         * A [f]chk.[as] instruction needs to take the branch to the recovery 
code but
@@ -1714,7 +1723,7 @@ ENTRY(debug_vector)
 ENTRY(debug_vector)
        DBG_FAULT(29)
 #ifdef XEN
-       REFLECT(29)
+       FAULT_OR_REFLECT(29)
 #endif
        FAULT(29)
 END(debug_vector)
@@ -1725,7 +1734,7 @@ ENTRY(unaligned_access)
 ENTRY(unaligned_access)
        DBG_FAULT(30)
 #ifdef XEN
-       REFLECT(30)
+       FAULT_OR_REFLECT(30)
 #endif
        mov r16=cr.ipsr
        mov r31=pr              // prepare to save predicates
@@ -1739,7 +1748,7 @@ ENTRY(unsupported_data_reference)
 ENTRY(unsupported_data_reference)
        DBG_FAULT(31)
 #ifdef XEN
-       REFLECT(31)
+       FAULT_OR_REFLECT(31)
 #endif
        FAULT(31)
 END(unsupported_data_reference)
@@ -1750,7 +1759,7 @@ ENTRY(floating_point_fault)
 ENTRY(floating_point_fault)
        DBG_FAULT(32)
 #ifdef XEN
-       REFLECT(32)
+       FAULT_OR_REFLECT(32)
 #endif
        FAULT(32)
 END(floating_point_fault)
@@ -1761,7 +1770,7 @@ ENTRY(floating_point_trap)
 ENTRY(floating_point_trap)
        DBG_FAULT(33)
 #ifdef XEN
-       REFLECT(33)
+       FAULT_OR_REFLECT(33)
 #endif
        FAULT(33)
 END(floating_point_trap)
@@ -1772,7 +1781,7 @@ ENTRY(lower_privilege_trap)
 ENTRY(lower_privilege_trap)
        DBG_FAULT(34)
 #ifdef XEN
-       REFLECT(34)
+       FAULT_OR_REFLECT(34)
 #endif
        FAULT(34)
 END(lower_privilege_trap)
@@ -1783,7 +1792,7 @@ ENTRY(taken_branch_trap)
 ENTRY(taken_branch_trap)
        DBG_FAULT(35)
 #ifdef XEN
-       REFLECT(35)
+       FAULT_OR_REFLECT(35)
 #endif
        FAULT(35)
 END(taken_branch_trap)
@@ -1794,7 +1803,7 @@ ENTRY(single_step_trap)
 ENTRY(single_step_trap)
        DBG_FAULT(36)
 #ifdef XEN
-       REFLECT(36)
+       FAULT_OR_REFLECT(36)
 #endif
        FAULT(36)
 END(single_step_trap)
@@ -1853,7 +1862,7 @@ ENTRY(ia32_exception)
 ENTRY(ia32_exception)
        DBG_FAULT(45)
 #ifdef XEN
-       REFLECT(45)
+       FAULT_OR_REFLECT(45)
 #endif
        FAULT(45)
 END(ia32_exception)
@@ -1864,7 +1873,7 @@ ENTRY(ia32_intercept)
 ENTRY(ia32_intercept)
        DBG_FAULT(46)
 #ifdef XEN
-       REFLECT(46)
+       FAULT_OR_REFLECT(46)
 #endif
 #ifdef CONFIG_IA32_SUPPORT
        mov r31=pr
@@ -1897,7 +1906,7 @@ ENTRY(ia32_interrupt)
 ENTRY(ia32_interrupt)
        DBG_FAULT(47)
 #ifdef XEN
-       REFLECT(47)
+       FAULT_OR_REFLECT(47)
 #endif
 #ifdef CONFIG_IA32_SUPPORT
        mov r31=pr
diff -r f024bb5f5a07 -r c3506e73b63e xen/arch/ia64/xen/process.c
--- a/xen/arch/ia64/xen/process.c       Wed May 10 15:29:54 2006 -0600
+++ b/xen/arch/ia64/xen/process.c       Wed May 10 15:50:27 2006 -0600
@@ -367,10 +367,10 @@ ia64_fault (unsigned long vector, unsign
                "Unknown fault 9", "Unknown fault 10", "Unknown fault 11", 
"Unknown fault 12",
                "Unknown fault 13", "Unknown fault 14", "Unknown fault 15"
        };
-#if 0
-printf("ia64_fault, vector=0x%p, ifa=%p, iip=%p, ipsr=%p, isr=%p\n",
- vector, ifa, regs->cr_iip, regs->cr_ipsr, isr);
-#endif
+
+       printf("ia64_fault, vector=0x%p, ifa=%p, iip=%p, ipsr=%p, isr=%p\n",
+              vector, ifa, regs->cr_iip, regs->cr_ipsr, isr);
+
 
        if ((isr & IA64_ISR_NA) && ((isr & IA64_ISR_CODE_MASK) == 
IA64_ISR_CODE_LFETCH)) {
                /*
@@ -383,15 +383,48 @@ printf("ia64_fault, vector=0x%p, ifa=%p,
        }
 
        switch (vector) {
-             case 24: /* General Exception */
+           case 0:
+               printk("VHPT Translation.\n");
+               break;
+         
+           case 4:
+               printk("Alt ITLB.\n");
+               break;
+         
+           case 6:
+               printk("Instruction Key Miss.\n");
+               break;
+
+           case 7: 
+               printk("Data Key Miss.\n");
+               break;
+
+           case 8: 
+               printk("Dirty-bit.\n");
+               break;
+
+           case 20:
+               printk("Page Not Found.\n");
+               break;
+
+           case 21:
+               printk("Key Permission.\n");
+               break;
+
+           case 22:
+               printk("Instruction Access Rights.\n");
+               break;
+
+           case 24: /* General Exception */
                code = (isr >> 4) & 0xf;
                sprintf(buf, "General Exception: %s%s", reason[code],
-                       (code == 3) ? ((isr & (1UL << 37))
-                                      ? " (RSE access)" : " (data access)") : 
"");
+                       (code == 3) ? ((isr & (1UL << 37)) ? " (RSE access)" :
+                                      " (data access)") : "");
                if (code == 8) {
 # ifdef CONFIG_IA64_PRINT_HAZARDS
                        printk("%s[%d]: possible hazard @ ip=%016lx (pr = 
%016lx)\n",
-                              current->comm, current->pid, regs->cr_iip + 
ia64_psr(regs)->ri,
+                              current->comm, current->pid,
+                              regs->cr_iip + ia64_psr(regs)->ri,
                               regs->pr);
 # endif
                        printf("ia64_fault: returning on hazard\n");
@@ -399,162 +432,65 @@ printf("ia64_fault, vector=0x%p, ifa=%p,
                }
                break;
 
-             case 25: /* Disabled FP-Register */
-               if (isr & 2) {
-                       //disabled_fph_fault(regs);
-                       //return;
-               }
-               sprintf(buf, "Disabled FPL fault---not supposed to happen!");
-               break;
-
-             case 26: /* NaT Consumption */
-               if (user_mode(regs)) {
-                       void *addr;
-
-                       if (((isr >> 4) & 0xf) == 2) {
-                               /* NaT page consumption */
-                               //sig = SIGSEGV;
-                               //code = SEGV_ACCERR;
-                               addr = (void *) ifa;
-                       } else {
-                               /* register NaT consumption */
-                               //sig = SIGILL;
-                               //code = ILL_ILLOPN;
-                               addr = (void *) (regs->cr_iip + 
ia64_psr(regs)->ri);
-                       }
-                       //siginfo.si_signo = sig;
-                       //siginfo.si_code = code;
-                       //siginfo.si_errno = 0;
-                       //siginfo.si_addr = addr;
-                       //siginfo.si_imm = vector;
-                       //siginfo.si_flags = __ISR_VALID;
-                       //siginfo.si_isr = isr;
-                       //force_sig_info(sig, &siginfo, current);
-                       //return;
-               } //else if (ia64_done_with_exception(regs))
-                       //return;
-               sprintf(buf, "NaT consumption");
-               break;
-
-             case 31: /* Unsupported Data Reference */
-               if (user_mode(regs)) {
-                       //siginfo.si_signo = SIGILL;
-                       //siginfo.si_code = ILL_ILLOPN;
-                       //siginfo.si_errno = 0;
-                       //siginfo.si_addr = (void *) (regs->cr_iip + 
ia64_psr(regs)->ri);
-                       //siginfo.si_imm = vector;
-                       //siginfo.si_flags = __ISR_VALID;
-                       //siginfo.si_isr = isr;
-                       //force_sig_info(SIGILL, &siginfo, current);
-                       //return;
-               }
-               sprintf(buf, "Unsupported data reference");
-               break;
-
-             case 29: /* Debug */
-             case 35: /* Taken Branch Trap */
-             case 36: /* Single Step Trap */
-               //if (fsys_mode(current, regs)) {}
-               switch (vector) {
-                     case 29:
-                       //siginfo.si_code = TRAP_HWBKPT;
-#ifdef CONFIG_ITANIUM
-                       /*
-                        * Erratum 10 (IFA may contain incorrect address) now 
has
-                        * "NoFix" status.  There are no plans for fixing this.
-                        */
-                       if (ia64_psr(regs)->is == 0)
-                         ifa = regs->cr_iip;
-#endif
-                       break;
-                     case 35: ifa = 0; break;
-                     case 36: ifa = 0; break;
-                     //case 35: siginfo.si_code = TRAP_BRANCH; ifa = 0; break;
-                     //case 36: siginfo.si_code = TRAP_TRACE; ifa = 0; break;
-               }
-               //siginfo.si_signo = SIGTRAP;
-               //siginfo.si_errno = 0;
-               //siginfo.si_addr  = (void *) ifa;
-               //siginfo.si_imm   = 0;
-               //siginfo.si_flags = __ISR_VALID;
-               //siginfo.si_isr   = isr;
-               //force_sig_info(SIGTRAP, &siginfo, current);
-               //return;
-
-             case 32: /* fp fault */
-             case 33: /* fp trap */
-               //result = handle_fpu_swa((vector == 32) ? 1 : 0, regs, isr);
-               //if ((result < 0) || (current->thread.flags & 
IA64_THREAD_FPEMU_SIGFPE)) {
-                       //siginfo.si_signo = SIGFPE;
-                       //siginfo.si_errno = 0;
-                       //siginfo.si_code = FPE_FLTINV;
-                       //siginfo.si_addr = (void *) (regs->cr_iip + 
ia64_psr(regs)->ri);
-                       //siginfo.si_flags = __ISR_VALID;
-                       //siginfo.si_isr = isr;
-                       //siginfo.si_imm = 0;
-                       //force_sig_info(SIGFPE, &siginfo, current);
-               //}
-               //return;
-               sprintf(buf, "FP fault/trap");
-               break;
-
-             case 34:
-               if (isr & 0x2) {
-                       /* Lower-Privilege Transfer Trap */
-                       /*
-                        * Just clear PSR.lp and then return immediately: all 
the
-                        * interesting work (e.g., signal delivery is done in 
the kernel
-                        * exit path).
-                        */
-                       //ia64_psr(regs)->lp = 0;
-                       //return;
-                       sprintf(buf, "Lower-Privilege Transfer trap");
-               } else {
-                       /* Unimplemented Instr. Address Trap */
-                       if (user_mode(regs)) {
-                               //siginfo.si_signo = SIGILL;
-                               //siginfo.si_code = ILL_BADIADDR;
-                               //siginfo.si_errno = 0;
-                               //siginfo.si_flags = 0;
-                               //siginfo.si_isr = 0;
-                               //siginfo.si_imm = 0;
-                               //siginfo.si_addr = (void *) (regs->cr_iip + 
ia64_psr(regs)->ri);
-                               //force_sig_info(SIGILL, &siginfo, current);
-                               //return;
-                       }
-                       sprintf(buf, "Unimplemented Instruction Address fault");
-               }
-               break;
-
-             case 45:
-               printk(KERN_ERR "Unexpected IA-32 exception (Trap 45)\n");
-               printk(KERN_ERR "  iip - 0x%lx, ifa - 0x%lx, isr - 0x%lx\n",
-                      regs->cr_iip, ifa, isr);
-               //force_sig(SIGSEGV, current);
-               break;
-
-             case 46:
-               printk(KERN_ERR "Unexpected IA-32 intercept trap (Trap 46)\n");
-               printk(KERN_ERR "  iip - 0x%lx, ifa - 0x%lx, isr - 0x%lx, iim - 
0x%lx\n",
-                      regs->cr_iip, ifa, isr, iim);
-               //force_sig(SIGSEGV, current);
-               return;
-
-             case 47:
-               sprintf(buf, "IA-32 Interruption Fault (int 0x%lx)", isr >> 16);
-               break;
-
-             default:
-               sprintf(buf, "Fault %lu", vector);
-               break;
-       }
-       //die_if_kernel(buf, regs, error);
-printk("ia64_fault: %s: reflecting\n",buf);
-PSCB(current,itir) = vcpu_get_itir_on_fault(current,ifa);
-PSCB(current,ifa) = ifa;
-reflect_interruption(isr,regs,IA64_GENEX_VECTOR);
-//while(1);
-       //force_sig(SIGILL, current);
+           case 25:
+               printk("Disabled FP-Register.\n");
+               break;
+
+           case 26:
+               printk("NaT consumption.\n");
+               break;
+
+           case 29:
+               printk("Debug.\n");
+               break;
+
+           case 30:
+               printk("Unaligned Reference.\n");
+               break;
+
+           case 31:
+               printk("Unsupported data reference.\n");
+               break;
+
+           case 32:
+               printk("Floating-Point Fault.\n");
+               break;
+
+           case 33:
+               printk("Floating-Point Trap.\n");
+               break;
+
+           case 34:
+               printk("Lower Privilege Transfer Trap.\n");
+               break;
+
+           case 35:
+               printk("Taken Branch Trap.\n");
+               break;
+
+           case 36:
+               printk("Single Step Trap.\n");
+               break;
+    
+           case 45:
+               printk("IA-32 Exception.\n");
+               break;
+
+           case 46:
+               printk("IA-32 Intercept.\n");
+               break;
+
+           case 47:
+               printk("IA-32 Interrupt.\n");
+               break;
+
+           default:
+               printk("Fault %lu\n", vector);
+               break;
+       }
+
+       show_registers(regs);
+       panic("Fault in Xen.\n");
 }
 
 unsigned long running_on_sim = 0;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [IA64] Display the information in fault handler, Xen patchbot-unstable <=