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

[Xen-devel] [PATCH] reduce useless output from 'd' console command



Instead of printing context of the interrupt/IPI that invoked the
output function, print just the interrupted context, and avoid
printing the same context twice if the interrupted context was in guest
space. This not only makes analyzing the output easier, it also helps
reduce the amount of output in some cases, which is pretty significant
given how easily the ring buffer overruns. (IA64 part only compile
tested.)

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: 2008-06-12/xen/arch/ia64/linux-xen/smp.c
===================================================================
--- 2008-06-12.orig/xen/arch/ia64/linux-xen/smp.c       2008-06-12 
16:46:04.000000000 +0200
+++ 2008-06-12/xen/arch/ia64/linux-xen/smp.c    2008-06-11 08:37:37.000000000 
+0200
@@ -175,7 +175,7 @@ handle_IPI (int irq, void *dev_id, struc
                                       * At this point the structure may be 
gone unless
                                       * wait is true.
                                       */
-                                     (*func)(info);
+                                     (*func)(info ?: regs);
 
                                      /* Notify the sending CPU that the task 
is done.  */
                                      mb();
Index: 2008-06-12/xen/arch/x86/smp.c
===================================================================
--- 2008-06-12.orig/xen/arch/x86/smp.c  2008-06-12 16:46:04.000000000 +0200
+++ 2008-06-12/xen/arch/x86/smp.c       2008-06-11 08:35:19.000000000 +0200
@@ -357,7 +357,7 @@ fastcall void smp_call_function_interrup
 
     if ( call_data->wait )
     {
-        (*func)(info);
+        (*func)(info ?: regs);
         mb();
         atomic_inc(&call_data->finished);
     }
@@ -365,7 +365,7 @@ fastcall void smp_call_function_interrup
     {
         mb();
         atomic_inc(&call_data->started);
-        (*func)(info);
+        (*func)(info ?: regs);
     }
 
     irq_exit();
Index: 2008-06-12/xen/common/keyhandler.c
===================================================================
--- 2008-06-12.orig/xen/common/keyhandler.c     2008-06-12 16:46:04.000000000 
+0200
+++ 2008-06-12/xen/common/keyhandler.c  2008-06-12 16:46:54.000000000 +0200
@@ -91,14 +91,25 @@ static void show_handlers(unsigned char 
                    key_table[i].desc);
 }
 
-static void __dump_execstate(void *unused)
+static void __dump_execstate(void *_regs)
 {
-    dump_execution_state();
-    printk("*** Dumping CPU%d guest state: ***\n", smp_processor_id());
+    struct cpu_user_regs *regs = _regs;
+    unsigned int cpu = smp_processor_id();
+
+    if ( !guest_mode(regs) )
+    {
+        printk("\n*** Dumping CPU%u host state: ***\n", cpu);
+        show_execution_state(regs);
+    }
     if ( is_idle_vcpu(current) )
-        printk("No guest context (CPU is idle).\n");
+        printk("No guest context (CPU%u is idle).\n", cpu);
     else
+    {
+        printk("*** Dumping CPU%u guest state (d%d:v%d): ***\n",
+               smp_processor_id(), current->domain->domain_id,
+               current->vcpu_id);
         show_execution_state(guest_cpu_user_regs());
+    }
 }
 
 static void dump_registers(unsigned char key, struct cpu_user_regs *regs)
@@ -108,14 +119,12 @@ static void dump_registers(unsigned char
     printk("'%c' pressed -> dumping registers\n", key);
 
     /* Get local execution state out immediately, in case we get stuck. */
-    printk("\n*** Dumping CPU%d host state: ***\n", smp_processor_id());
-    __dump_execstate(NULL);
+    __dump_execstate(regs);
 
     for_each_online_cpu ( cpu )
     {
         if ( cpu == smp_processor_id() )
             continue;
-        printk("\n*** Dumping CPU%d host state: ***\n", cpu);
         on_selected_cpus(cpumask_of_cpu(cpu), __dump_execstate, NULL, 1, 1);
     }
 
Index: 2008-06-12/xen/include/asm-ia64/linux-xen/asm/ptrace.h
===================================================================
--- 2008-06-12.orig/xen/include/asm-ia64/linux-xen/asm/ptrace.h 2008-06-12 
16:46:04.000000000 +0200
+++ 2008-06-12/xen/include/asm-ia64/linux-xen/asm/ptrace.h      2008-06-11 
08:57:07.000000000 +0200
@@ -278,7 +278,7 @@ struct switch_stack {
 # define ia64_task_regs(t)             (((struct pt_regs *) ((char *) (t) + 
IA64_STK_OFFSET)) - 1)
 # define ia64_psr(regs)                        ((struct ia64_psr *) 
&(regs)->cr_ipsr)
 #ifdef XEN
-# define guest_mode(regs)              (ia64_psr(regs)->cpl != 0)
+# define guest_mode(regs)              (ia64_psr(regs)->cpl && 
!ia64_psr(regs)->vm)
 # define guest_kernel_mode(regs)       (ia64_psr(regs)->cpl == 
CONFIG_CPL0_EMUL)
 # define vmx_guest_kernel_mode(regs)   (ia64_psr(regs)->cpl == 0)
 # define regs_increment_iip(regs)                                      \



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.