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] Cleanups for printing debug tracing to the console.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Cleanups for printing debug tracing to the console.
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Mon, 16 May 2005 08:41:49 +0000
Delivery-date: Mon, 16 May 2005 09:03:34 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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 Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1412, 2005/05/16 09:41:49+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Cleanups for printing debug tracing to the console.
        Also, rename get_cpu_user_regs -> guest_cpu_user_regs.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 arch/ia64/xenmisc.c              |    2 
 arch/x86/domain.c                |    8 +--
 arch/x86/mm.c                    |    2 
 arch/x86/traps.c                 |   91 +++++++++++++++++++++++++++++++++++++++
 arch/x86/vmx_intercept.c         |    2 
 arch/x86/vmx_io.c                |    2 
 arch/x86/vmx_vmcs.c              |    2 
 arch/x86/x86_32/traps.c          |   75 --------------------------------
 arch/x86/x86_64/traps.c          |   77 ---------------------------------
 common/domain.c                  |    5 +-
 common/schedule.c                |    4 -
 drivers/char/console.c           |   15 +++---
 include/asm-x86/x86_32/current.h |    4 -
 include/asm-x86/x86_64/current.h |    4 -
 14 files changed, 121 insertions(+), 172 deletions(-)


diff -Nru a/xen/arch/ia64/xenmisc.c b/xen/arch/ia64/xenmisc.c
--- a/xen/arch/ia64/xenmisc.c   2005-05-16 05:04:09 -04:00
+++ b/xen/arch/ia64/xenmisc.c   2005-05-16 05:04:09 -04:00
@@ -72,7 +72,7 @@
        return;
 }
 
-struct pt_regs *get_cpu_user_regs(void) { return ia64_task_regs(current); }
+struct pt_regs *guest_cpu_user_regs(void) { return ia64_task_regs(current); }
 
 void raise_actimer_softirq(void)
 {
diff -Nru a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     2005-05-16 05:04:09 -04:00
+++ b/xen/arch/x86/domain.c     2005-05-16 05:04:09 -04:00
@@ -607,7 +607,7 @@
 
     if ( unlikely(!all_segs_okay) )
     {
-        struct cpu_user_regs *regs = get_cpu_user_regs();
+        struct cpu_user_regs *regs = guest_cpu_user_regs();
         unsigned long   *rsp =
             (n->arch.flags & TF_kernel_mode) ?
             (unsigned long *)regs->rsp : 
@@ -666,7 +666,7 @@
 
 long do_switch_to_user(void)
 {
-    struct cpu_user_regs  *regs = get_cpu_user_regs();
+    struct cpu_user_regs  *regs = guest_cpu_user_regs();
     struct switch_to_user  stu;
     struct exec_domain    *ed = current;
 
@@ -715,7 +715,7 @@
 
 static void __context_switch(void)
 {
-    struct cpu_user_regs *stack_regs = get_cpu_user_regs();
+    struct cpu_user_regs *stack_regs = guest_cpu_user_regs();
     unsigned int         cpu = smp_processor_id();
     struct exec_domain  *p = percpu_ctxt[cpu].curr_ed;
     struct exec_domain  *n = current;
@@ -851,7 +851,7 @@
     }
     else
     {
-        regs       = get_cpu_user_regs();
+        regs       = guest_cpu_user_regs();
 #if defined(__i386__)
         regs->eax  = op;
         regs->eip -= 2;  /* re-execute 'int 0x82' */
diff -Nru a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c 2005-05-16 05:04:09 -04:00
+++ b/xen/arch/x86/mm.c 2005-05-16 05:04:09 -04:00
@@ -2836,7 +2836,7 @@
     return EXCRET_fault_fixed;
 
  emulate:
-    if ( x86_emulate_memop(get_cpu_user_regs(), addr,
+    if ( x86_emulate_memop(guest_cpu_user_regs(), addr,
                            &ptwr_mem_emulator, BITS_PER_LONG/8) )
         return 0;
     perfc_incrc(ptwr_emulations);
diff -Nru a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      2005-05-16 05:04:09 -04:00
+++ b/xen/arch/x86/traps.c      2005-05-16 05:04:10 -04:00
@@ -90,6 +90,97 @@
 asmlinkage void spurious_interrupt_bug(void);
 asmlinkage void machine_check(void);
 
+static int debug_stack_lines = 20;
+integer_param("debug_stack_lines", debug_stack_lines);
+
+static inline int kernel_text_address(unsigned long addr)
+{
+    if (addr >= (unsigned long) &_stext &&
+        addr <= (unsigned long) &_etext)
+        return 1;
+    return 0;
+
+}
+
+void show_guest_stack(void)
+{
+    int i;
+    struct cpu_user_regs *regs = guest_cpu_user_regs();
+    unsigned long *stack = (unsigned long *)regs->esp, addr;
+
+    printk("Guest stack trace from "__OP"sp=%p:\n   ", stack);
+
+    for ( i = 0; i < (debug_stack_lines*8); i++ )
+    {
+        if ( ((long)stack & (STACK_SIZE-1)) == 0 )
+            break;
+        if ( get_user(addr, stack) )
+        {
+            if ( i != 0 )
+                printk("\n    ");
+            printk("Fault while accessing guest memory.");
+            i = 1;
+            break;
+        }
+        if ( (i != 0) && ((i % 8) == 0) )
+            printk("\n   ");
+        printk("%p ", _p(addr));
+        stack++;
+    }
+    if ( i == 0 )
+        printk("Stack empty.");
+    printk("\n");
+}
+
+void show_trace(unsigned long *esp)
+{
+    unsigned long *stack = esp, addr;
+    int i = 0;
+
+    printk("Xen call trace from "__OP"sp=%p:\n   ", stack);
+
+    while ( ((long) stack & (STACK_SIZE-1)) != 0 )
+    {
+        addr = *stack++;
+        if ( kernel_text_address(addr) )
+        {
+            if ( (i != 0) && ((i % 6) == 0) )
+                printk("\n   ");
+            printk("[<%p>] ", _p(addr));
+            i++;
+        }
+    }
+    if ( i == 0 )
+        printk("Trace empty.");
+    printk("\n");
+}
+
+void show_stack(unsigned long *esp)
+{
+    unsigned long *stack = esp, addr;
+    int i;
+
+    printk("Xen stack trace from "__OP"sp=%p:\n   ", stack);
+
+    for ( i = 0; i < (debug_stack_lines*8); i++ )
+    {
+        if ( ((long)stack & (STACK_SIZE-1)) == 0 )
+            break;
+        if ( (i != 0) && ((i % 8) == 0) )
+            printk("\n   ");
+        addr = *stack++;
+        if ( kernel_text_address(addr) )
+            printk("[%p] ", _p(addr));
+        else
+            printk("%p ", _p(addr));
+    }
+    if ( i == 0 )
+        printk("Stack empty.");
+    printk("\n");
+
+    show_trace(esp);
+}
+
 /*
  * This is called for faults at very unexpected times (e.g., when interrupts
  * are disabled). In such situations we can't do much that is safe. We try to
diff -Nru a/xen/arch/x86/vmx_intercept.c b/xen/arch/x86/vmx_intercept.c
--- a/xen/arch/x86/vmx_intercept.c      2005-05-16 05:04:10 -04:00
+++ b/xen/arch/x86/vmx_intercept.c      2005-05-16 05:04:10 -04:00
@@ -140,7 +140,7 @@
 /* vmx_io_assist light-weight version, specific to PIT DM */ 
 static void resume_pit_io(ioreq_t *p)
 {
-    struct cpu_user_regs *regs = get_cpu_user_regs();
+    struct cpu_user_regs *regs = guest_cpu_user_regs();
     unsigned long old_eax = regs->eax;
     p->state = STATE_INVALID;
 
diff -Nru a/xen/arch/x86/vmx_io.c b/xen/arch/x86/vmx_io.c
--- a/xen/arch/x86/vmx_io.c     2005-05-16 05:04:09 -04:00
+++ b/xen/arch/x86/vmx_io.c     2005-05-16 05:04:09 -04:00
@@ -187,7 +187,7 @@
     vcpu_iodata_t *vio;
     ioreq_t *p;
     struct domain *d = ed->domain;
-    struct cpu_user_regs *regs = get_cpu_user_regs();
+    struct cpu_user_regs *regs = guest_cpu_user_regs();
     unsigned long old_eax;
     int sign;
     struct mi_per_cpu_info *mpci_p;
diff -Nru a/xen/arch/x86/vmx_vmcs.c b/xen/arch/x86/vmx_vmcs.c
--- a/xen/arch/x86/vmx_vmcs.c   2005-05-16 05:04:10 -04:00
+++ b/xen/arch/x86/vmx_vmcs.c   2005-05-16 05:04:10 -04:00
@@ -162,7 +162,7 @@
     struct Xgt_desc_struct desc;
     unsigned long pfn = 0;
     struct pfn_info *page;
-    struct cpu_user_regs *regs = get_cpu_user_regs();
+    struct cpu_user_regs *regs = guest_cpu_user_regs();
 
     vmx_stts();
     set_bit(_VCPUF_guest_stts, &ed->vcpu_flags);
diff -Nru a/xen/arch/x86/x86_32/traps.c b/xen/arch/x86/x86_32/traps.c
--- a/xen/arch/x86/x86_32/traps.c       2005-05-16 05:04:09 -04:00
+++ b/xen/arch/x86/x86_32/traps.c       2005-05-16 05:04:09 -04:00
@@ -15,81 +15,6 @@
 /* All CPUs have their own IDT to allow set_fast_trap(). */
 idt_entry_t *idt_tables[NR_CPUS] = { 0 };
 
-static int kstack_depth_to_print = 8*20;
-
-static inline int kernel_text_address(unsigned long addr)
-{
-    if (addr >= (unsigned long) &_stext &&
-        addr <= (unsigned long) &_etext)
-        return 1;
-    return 0;
-
-}
-
-void show_guest_stack(void)
-{
-    int i;
-    struct cpu_user_regs *regs = get_cpu_user_regs();
-    unsigned long *stack = (unsigned long *)regs->esp;
-
-    printk("Guest EIP is %08x\n   ", regs->eip);
-
-    for ( i = 0; i < kstack_depth_to_print; i++ )
-    {
-        if ( ((long)stack & (STACK_SIZE-1)) == 0 )
-            break;
-        if ( i && ((i % 8) == 0) )
-            printk("\n   ");
-        printk("%08lx ", *stack++);
-    }
-    printk("\n");
-    
-}
-
-void show_trace(unsigned long *esp)
-{
-    unsigned long *stack, addr;
-    int i;
-
-    printk("Call Trace from ESP=%p:\n   ", esp);
-    stack = esp;
-    i = 0;
-    while (((long) stack & (STACK_SIZE-1)) != 0) {
-        addr = *stack++;
-        if (kernel_text_address(addr)) {
-            if (i && ((i % 6) == 0))

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Cleanups for printing debug tracing to the console., BitKeeper Bot <=