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

[Xen-changelog] [xen-unstable] xen: Extra %esp tracing on double fault.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1175511006 -3600
# Node ID 149943a5d2c812c211decfc29e47e85f3182bc46
# Parent  8f9ca49175ce979b63f5845dcf95aebe60e325da
xen: Extra %esp tracing on double fault.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/traps.c            |   17 +++++++++++++----
 xen/arch/x86/x86_32/traps.c     |    2 +-
 xen/arch/x86/x86_64/traps.c     |    2 +-
 xen/include/asm-x86/processor.h |    2 +-
 4 files changed, 16 insertions(+), 7 deletions(-)

diff -r 8f9ca49175ce -r 149943a5d2c8 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Sat Mar 31 19:02:09 2007 +0100
+++ b/xen/arch/x86/traps.c      Mon Apr 02 11:50:06 2007 +0100
@@ -285,23 +285,32 @@ void show_xen_trace()
     show_trace(&regs);
 }
 
-void show_stack_overflow(unsigned long esp)
+void show_stack_overflow(unsigned int cpu, unsigned long esp)
 {
 #ifdef MEMORY_GUARD
-    unsigned long esp_top;
+    unsigned long esp_top, esp_bottom;
     unsigned long *stack, addr;
 
-    esp_top = (esp | (STACK_SIZE - 1)) - (DEBUG_STACK_SIZE - 1);
+    esp_bottom = (esp | (STACK_SIZE - 1)) + 1;
+    esp_top    = esp_bottom - DEBUG_STACK_SIZE;
+
+    printk("Valid stack range: %p-%p, sp=%p, tss.esp0=%p\n",
+           (void *)esp_top, (void *)esp_bottom, (void *)esp,
+           (void *)init_tss[cpu].esp0);
 
     /* Trigger overflow trace if %esp is within 512 bytes of the guard page. */
     if ( ((unsigned long)(esp - esp_top) > 512) &&
          ((unsigned long)(esp_top - esp) > 512) )
+    {
+        printk("No stack overflow detected. Skipping stack trace.\n");
         return;
+    }
 
     if ( esp < esp_top )
         esp = esp_top;
 
-    printk("Xen stack overflow:\n   ");
+    printk("Xen stack overflow (dumping trace %p-%p):\n   ",
+           (void *)esp, (void *)esp_bottom);
 
     stack = (unsigned long *)esp;
     while ( ((long)stack & (STACK_SIZE-BYTES_PER_LONG)) != 0 )
diff -r 8f9ca49175ce -r 149943a5d2c8 xen/arch/x86/x86_32/traps.c
--- a/xen/arch/x86/x86_32/traps.c       Sat Mar 31 19:02:09 2007 +0100
+++ b/xen/arch/x86/x86_32/traps.c       Mon Apr 02 11:50:06 2007 +0100
@@ -167,7 +167,7 @@ asmlinkage void do_double_fault(void)
            tss->esi, tss->edi, tss->ebp, tss->esp);
     printk("ds: %04x   es: %04x   fs: %04x   gs: %04x   ss: %04x\n",
            tss->ds, tss->es, tss->fs, tss->gs, tss->ss);
-    show_stack_overflow(tss->esp);
+    show_stack_overflow(cpu, tss->esp);
 
     panic("DOUBLE FAULT -- system shutdown\n");
 }
diff -r 8f9ca49175ce -r 149943a5d2c8 xen/arch/x86/x86_64/traps.c
--- a/xen/arch/x86/x86_64/traps.c       Sat Mar 31 19:02:09 2007 +0100
+++ b/xen/arch/x86/x86_64/traps.c       Mon Apr 02 11:50:06 2007 +0100
@@ -171,7 +171,7 @@ asmlinkage void do_double_fault(struct c
     printk("r12: %016lx   r13: %016lx   r14: %016lx\n",
            regs->r12, regs->r13, regs->r14);
     printk("r15: %016lx\n", regs->r15);
-    show_stack_overflow(regs->rsp);
+    show_stack_overflow(cpu, regs->rsp);
 
     panic("DOUBLE FAULT -- system shutdown\n");
 }
diff -r 8f9ca49175ce -r 149943a5d2c8 xen/include/asm-x86/processor.h
--- a/xen/include/asm-x86/processor.h   Sat Mar 31 19:02:09 2007 +0100
+++ b/xen/include/asm-x86/processor.h   Mon Apr 02 11:50:06 2007 +0100
@@ -553,7 +553,7 @@ extern always_inline void prefetchw(cons
 
 void show_stack(struct cpu_user_regs *regs);
 void show_xen_trace(void);
-void show_stack_overflow(unsigned long esp);
+void show_stack_overflow(unsigned int cpu, unsigned long esp);
 void show_registers(struct cpu_user_regs *regs);
 void show_execution_state(struct cpu_user_regs *regs);
 void show_page_walk(unsigned long addr);

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