ia64/xen-unstable

changeset 14692:149943a5d2c8

xen: Extra %esp tracing on double fault.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Mon Apr 02 11:50:06 2007 +0100 (2007-04-02)
parents 8f9ca49175ce
children f0f9533b2a23
files xen/arch/x86/traps.c xen/arch/x86/x86_32/traps.c xen/arch/x86/x86_64/traps.c xen/include/asm-x86/processor.h
line diff
     1.1 --- a/xen/arch/x86/traps.c	Sat Mar 31 19:02:09 2007 +0100
     1.2 +++ b/xen/arch/x86/traps.c	Mon Apr 02 11:50:06 2007 +0100
     1.3 @@ -285,23 +285,32 @@ void show_xen_trace()
     1.4      show_trace(&regs);
     1.5  }
     1.6  
     1.7 -void show_stack_overflow(unsigned long esp)
     1.8 +void show_stack_overflow(unsigned int cpu, unsigned long esp)
     1.9  {
    1.10  #ifdef MEMORY_GUARD
    1.11 -    unsigned long esp_top;
    1.12 +    unsigned long esp_top, esp_bottom;
    1.13      unsigned long *stack, addr;
    1.14  
    1.15 -    esp_top = (esp | (STACK_SIZE - 1)) - (DEBUG_STACK_SIZE - 1);
    1.16 +    esp_bottom = (esp | (STACK_SIZE - 1)) + 1;
    1.17 +    esp_top    = esp_bottom - DEBUG_STACK_SIZE;
    1.18 +
    1.19 +    printk("Valid stack range: %p-%p, sp=%p, tss.esp0=%p\n",
    1.20 +           (void *)esp_top, (void *)esp_bottom, (void *)esp,
    1.21 +           (void *)init_tss[cpu].esp0);
    1.22  
    1.23      /* Trigger overflow trace if %esp is within 512 bytes of the guard page. */
    1.24      if ( ((unsigned long)(esp - esp_top) > 512) &&
    1.25           ((unsigned long)(esp_top - esp) > 512) )
    1.26 +    {
    1.27 +        printk("No stack overflow detected. Skipping stack trace.\n");
    1.28          return;
    1.29 +    }
    1.30  
    1.31      if ( esp < esp_top )
    1.32          esp = esp_top;
    1.33  
    1.34 -    printk("Xen stack overflow:\n   ");
    1.35 +    printk("Xen stack overflow (dumping trace %p-%p):\n   ",
    1.36 +           (void *)esp, (void *)esp_bottom);
    1.37  
    1.38      stack = (unsigned long *)esp;
    1.39      while ( ((long)stack & (STACK_SIZE-BYTES_PER_LONG)) != 0 )
     2.1 --- a/xen/arch/x86/x86_32/traps.c	Sat Mar 31 19:02:09 2007 +0100
     2.2 +++ b/xen/arch/x86/x86_32/traps.c	Mon Apr 02 11:50:06 2007 +0100
     2.3 @@ -167,7 +167,7 @@ asmlinkage void do_double_fault(void)
     2.4             tss->esi, tss->edi, tss->ebp, tss->esp);
     2.5      printk("ds: %04x   es: %04x   fs: %04x   gs: %04x   ss: %04x\n",
     2.6             tss->ds, tss->es, tss->fs, tss->gs, tss->ss);
     2.7 -    show_stack_overflow(tss->esp);
     2.8 +    show_stack_overflow(cpu, tss->esp);
     2.9  
    2.10      panic("DOUBLE FAULT -- system shutdown\n");
    2.11  }
     3.1 --- a/xen/arch/x86/x86_64/traps.c	Sat Mar 31 19:02:09 2007 +0100
     3.2 +++ b/xen/arch/x86/x86_64/traps.c	Mon Apr 02 11:50:06 2007 +0100
     3.3 @@ -171,7 +171,7 @@ asmlinkage void do_double_fault(struct c
     3.4      printk("r12: %016lx   r13: %016lx   r14: %016lx\n",
     3.5             regs->r12, regs->r13, regs->r14);
     3.6      printk("r15: %016lx\n", regs->r15);
     3.7 -    show_stack_overflow(regs->rsp);
     3.8 +    show_stack_overflow(cpu, regs->rsp);
     3.9  
    3.10      panic("DOUBLE FAULT -- system shutdown\n");
    3.11  }
     4.1 --- a/xen/include/asm-x86/processor.h	Sat Mar 31 19:02:09 2007 +0100
     4.2 +++ b/xen/include/asm-x86/processor.h	Mon Apr 02 11:50:06 2007 +0100
     4.3 @@ -553,7 +553,7 @@ extern always_inline void prefetchw(cons
     4.4  
     4.5  void show_stack(struct cpu_user_regs *regs);
     4.6  void show_xen_trace(void);
     4.7 -void show_stack_overflow(unsigned long esp);
     4.8 +void show_stack_overflow(unsigned int cpu, unsigned long esp);
     4.9  void show_registers(struct cpu_user_regs *regs);
    4.10  void show_execution_state(struct cpu_user_regs *regs);
    4.11  void show_page_walk(unsigned long addr);